Skip to content

fix: integration readiness — guides, example server, rollback, versioning#8

Merged
ceejbot merged 3 commits into
latestfrom
fix/integration-readiness
Mar 29, 2026
Merged

fix: integration readiness — guides, example server, rollback, versioning#8
ceejbot merged 3 commits into
latestfrom
fix/integration-readiness

Conversation

@ceejbot

@ceejbot ceejbot commented Mar 29, 2026

Copy link
Copy Markdown
Owner

Summary

Five fixes for day-one integration friction, preparing for handoff to colleagues.

1. Fix embedded guide API examples

docs/guide-embedded.md had wrong field names for PolicyGrant (non-existent domains, max_ttl_seconds, etc.). Updated to match actual API: AgentPattern, SecretPattern, allowed_domains, lease_terms: Option<LeaseTerms>. Fixed Vault::new signature (5 args) and access_secret parameter type.

2. Add JSON policy loading

PolicyConfig::from_file() and from_json() methods. PolicyConfig already derived Serialize + Deserialize — just needed convenience constructors. Added JSON policy example to cloud service guide with all three pattern types (Exact, Prefix, Any). Three new tests for parsing and round-tripping.

3. Example vault server

examples/vault_server.rs — a complete TCP server with EnvVarSource + RusqliteStore + TracingAuditLog + TokenAuthenticator. Prints registered tokens on startup. Colleagues can cargo run --example vault_server and test against it immediately.

4. Provisioner rollback on failure

If credential acquisition fails partway (e.g., 8th of 10 secrets doesn't exist), the provisioner now revokes all previously-acquired leases before exiting. Prevents orphaned leases.

5. Lease state schema version

LeaseState now includes version: u32 (default 1). The proxy warns and ignores files with unknown versions. Backward compatible via serde(default).

Test plan

  • cargo clippy --workspace --all-targets — clean
  • cargo test --workspace — 103 tests pass
  • cargo build --example vault_server — compiles
  • CI green

ceejbot added 3 commits March 28, 2026 21:21
PolicyGrant uses AgentPattern/SecretPattern/allowed_domains/lease_terms,
not the bare fields that were documented. Vault::new takes 5 args
including CipherAlgorithm. vault.initialize() must be called before
use. access_secret takes &str for target_domain, not &DomainScope.
Added note about JSON policy file loading.
… policies

PolicyConfig already derives Serialize/Deserialize. Add convenience
methods for loading from JSON files so operators don't need to write
Rust code to configure policies.

Includes JSON policy examples in the cloud service guide showing
agent/secret patterns (Exact, Prefix, Any) and lease terms format.
Tests verify round-trip serialization and parsing from JSON strings.
Three integration readiness fixes:

1. Example vault server (examples/vault_server.rs): Working TCP server
   with EnvVarSource + RusqliteStore + TracingAuditLog + TokenAuthenticator.
   Prints registered tokens on startup for testing.

2. Provisioner rollback on failure: If any credential acquisition fails
   partway through, all previously-acquired leases are revoked before
   exit. Prevents orphaned leases from partially-successful provisioning.

3. Lease state version field: LeaseState now has a version: u32 field
   (default 1). The proxy warns and ignores files with unknown versions.
   Backward compatible via serde(default).

Also fixes unnecessary qualifications in policy module caught by clippy.
@ceejbot ceejbot merged commit 01e9d9c into latest Mar 29, 2026
2 checks passed
@ceejbot ceejbot deleted the fix/integration-readiness branch March 29, 2026 04:48
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.

1 participant