Skip to content

fix(credential): extract resolve() from dfe-fetcher into shared module#42

Open
kazmosahebi wants to merge 4 commits into
mainfrom
feat/credential-resolver-extraction
Open

fix(credential): extract resolve() from dfe-fetcher into shared module#42
kazmosahebi wants to merge 4 commits into
mainfrom
feat/credential-resolver-extraction

Conversation

@kazmosahebi
Copy link
Copy Markdown

@kazmosahebi kazmosahebi commented May 26, 2026

Summary

  • Extracts dfe-fetcher's credential-spec resolver (vault:path:key, env:VAR, literal) into a new credential Cargo feature so downstream services (loader, future services) can share the same syntax.
  • New module at src/credential.rs: resolve / resolve_optional / CredentialError (typed enum: MissingEnvVar { name }, Vault, BadSpec, VaultUnsupported).
  • Feature gating: credential = [] is opt-in; the vault: arm is additionally gated on the existing secrets feature, so consumers that don't enable secrets get a clean VaultUnsupported error rather than silent failure.
  • credential added to the full aggregator so it ships with the everything-enabled build.

Closes #40.

Behaviour

Spec secrets on secrets off
env:FOO (set) resolved resolved
env:FOO (unset) MissingEnvVar { name: "FOO" } MissingEnvVar { name: "FOO" }
vault:path:key (reachable) resolved via secrets::SecretsManager VaultUnsupported
literal passthrough passthrough

Downstream consumers (separate PRs)

  • hyperi-io/dfe-fetcher#26 — re-exports from rustlib, drops local resolver
  • hyperi-io/dfe-loader#56 — adopts the resolver for ClickHouse credential specs

Test plan

  • cargo test --no-default-features --features credential --lib credential::tests → 6/6
  • cargo test --no-default-features --features credential,secrets --lib credential::tests → 5/5 (vault-without-feature test is #[cfg(not(feature = "secrets"))]-gated)
  • cargo clippy --no-default-features --features credential -- -D warnings clean
  • CI green

kazmosahebi added 4 commits May 27, 2026 12:26
Adds a new `credential` feature with `resolve` / `resolve_optional` /
`CredentialError`, supporting `env:VAR`, `vault:path:key`, and literal
specs. Vault arm is gated behind the existing `secrets` feature; when
off, `vault:` returns `CredentialError::VaultUnsupported` cleanly.

Closes #40.
Addresses code-review feedback:
- include `credential` in the `full` aggregator alongside other optional modules
- restore prior-art's more specific vault error messages
- correct the test comment about parallel-test safety
@kazmosahebi kazmosahebi force-pushed the feat/credential-resolver-extraction branch from 5f86db8 to 79e08ae Compare May 27, 2026 02:26
@kazmosahebi kazmosahebi changed the title feat(credential): extract resolve() from dfe-fetcher into shared module fix(credential): extract resolve() from dfe-fetcher into shared module May 27, 2026
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.

Extract credential::resolve from dfe-fetcher into shared module

1 participant