Skip to content

feat: add environment-backed output target - #18

Merged
VimCommando merged 2 commits into
mainfrom
feat/env-output
Aug 27, 2026
Merged

feat: add environment-backed output target#18
VimCommando merged 2 commits into
mainfrom
feat/env-output

Conversation

@VimCommando

Copy link
Copy Markdown
Owner

Summary

  • replace the ambiguous es:/ and elasticsearch:/ context targets with env:/
  • resolve Elastic settings from the process environment, then .env, with CLI authentication taking precedence
  • document and specify the behavior, and make the generated-ID integration test independent of parallel file order

Validation

  • cargo test (195 passed, 5 ignored)
  • cargo clippy --all-targets (0 errors; existing warnings remain)
  • openspec validate --all --strict --json

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

.env loading currently occurs before validating the env:/index URI form, which can surface the wrong failure mode for malformed env: outputs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces an explicit env:/<index> Elasticsearch output target that resolves connection settings from ELASTIC_ES_URL / ELASTIC_ES_API_KEY (process environment first, then .env), and returns es:/ / elasticsearch:/ to configured-host resolution to remove ambiguity and namespace conflicts.

Changes:

  • Add env:/<index> output dispatch and URL construction/validation using environment + optional .env loading.
  • Update CLI startup to conditionally load .env and to apply environment API key fallback only for env:/... outputs.
  • Add/adjust tests and documentation/specs, including making generated-ID integration tests independent of bulk operation ordering.
File summaries
File Description
tests/index_template.rs Makes the generated-ID/upsert CLI test resilient to parallel file discovery/order changes.
tests/env_output.rs Adds CLI integration tests covering env:/ behavior, .env precedence, and error cases.
src/output/mod.rs Adds env scheme dispatch and environment-based URL construction/validation.
src/main.rs Loads .env only for env:/ output and scopes environment API key fallback accordingly.
README.md Documents the new env:/index-name output and migration guidance.
openspec/specs/elasticsearch-environment-output/spec.md Adds a formal spec defining env:/ syntax, precedence rules, and validation requirements.
openspec/changes/archive/2026-08-26-add-elasticsearch-environment-output/tasks.md Tracks implementation and verification tasks for the new capability.
openspec/changes/archive/2026-08-26-add-elasticsearch-environment-output/specs/elasticsearch-environment-output/spec.md Archives the spec snapshot alongside the change proposal/design.
openspec/changes/archive/2026-08-26-add-elasticsearch-environment-output/proposal.md Records rationale, scope, and breaking-change note for the scheme migration.
openspec/changes/archive/2026-08-26-add-elasticsearch-environment-output/design.md Documents design decisions (scheme reservation, .env scoping, precedence).
openspec/changes/archive/2026-08-26-add-elasticsearch-environment-output/.openspec.yaml Adds openspec metadata for the archived change bundle.
CHANGELOG.md Notes the new .env fallback and the scheme migration in Unreleased.
Cargo.toml Adds the dotenvy dependency.
Cargo.lock Locks dotenvy in the dependency graph.
.agents/skills/espipe/SKILL.md Updates skill documentation/examples to use env:/ instead of es:/ / elasticsearch:/.
Review details
  • Files reviewed: 14/15 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main.rs Outdated
Comment thread CHANGELOG.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes consistently implement env:/ dispatch with scoped .env loading, preserve auth precedence, and add targeted tests/spec/docs without introducing obvious behavioral regressions.

Review details
  • Files reviewed: 14/15 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@VimCommando
VimCommando merged commit 4371ee8 into main Aug 27, 2026
1 check passed
@VimCommando
VimCommando deleted the feat/env-output branch August 27, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants