Skip to content

feat(fleet-secrets): dual-write put verb — OpStore, sync stamps, pending records (#17143) - #17167

Merged
dezren39 merged 1 commit into
mainfrom
xaltha/17143-dual-write-put
Nov 30, 2026
Merged

dezren39 merged 1 commit into
mainfrom
xaltha/17143-dual-write-put

Conversation

@dezren39

@dezren39 dezren39 commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Closes #17143. Refs #13948 (S5).

What

The dual-write put verb for the secrets plane:

  • fleet-secrets: OpStore — the write counterpart of OpSource. Creates an "API Credential" item titled by name (or edits the existing title in place), verifies by reading back through op read, errors value-free. Built from config or single-vault discovery under exactly OpSource's rules.
  • BwsStore::store_with_note — the sync stamp rides in the Bitwarden secret's note at create time and is verified on the read-back like the value.
  • SecretStore trait + dual_put — primary (Bitwarden) writes first (the commit point, design §5), then the mirror (1Password), each stamped fleet-sync/1 counterpart=<other-store>:<name> kind=secret hash=<truncated SHA-256 anchor>. Mirror failure after the primary landed → PutReport names the failed store and a name-only pending record (fleet-sync.pending.<name>, stamp text only — never the value) is left in the primary for the reconcile to close. Primary failure lands nothing and never touches the mirror.
  • fleet secrets put <name> — value on stdin; both stores must be configured or it exits 3 naming the missing one (never a silent single-store write); reports outcomes by store name.
  • set --store 1password now writes through OpStore; fleet secrets scoping S4: scoped fleet secrets set verb #15433's "no op write path" refusal is retired.
  • Book (book-live-update): reference gains set + put sections; verbs.md secrets table completed (set/put/refresh rows).

Standing write paths (issue item 3)

fleet secrets set (single-store by explicit --store) and fleet bridge exchange's BwsStore vault writes remain single-store deliberately: the former is the operator's explicit one-store tool (now available for both stores), the latter mints broker-local credentials that are not part of the dual-store estate. Seat-side direct bws create/edit flows should migrate to fleet secrets put; that migration is a seat runbook change, recorded here and on #13948.

Verification

  • cargo check -p fleet-secrets clean; cargo test -p fleet-secrets — 81 passed, including 7 new tests: OpStore create/edit/error hygiene, stamp agreement across sides, dual-put both-landed, one-sided + pending record, primary-failure isolation.
  • CLI tests cover the put arg matrix, both-landed and one-sided report lines, and the updated set_store_choice matrix.
  • Live both-stores acceptance (a real put resolvable from both stores) needs a seat with both stores provisioned for writes; this seat's op has no configured account in a plain shell and the Bitwarden write project is not configured here, so the live leg is recorded on Secrets plane: pick up and ship the dual-write put verb (#13948 S5) #17143 for the first dual-provisioned seat rather than faked.

Notes

  • bws secret create --note is used for the primary stamp; if a bws build without the flag is hit, the write fails loudly at create (runner error), never silently unstamped — and the read-back note comparison catches any silent drop.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ing records (#17143)

Ship the #13948 S5 dual-write put: fleet secrets put writes both
stores (Bitwarden primary = commit point, 1Password mirror), each
stamped at write time with fleet-sync/1 sync metadata (counterpart
store:name, kind, truncated SHA-256 last-hash anchor). A mirror
failure after the primary landed is reported one-sided by store
name and leaves a name-only pending record
(fleet-sync.pending.<name>) in the primary for the reconcile to
close; a primary failure lands nothing. New OpStore is the op
write counterpart of OpSource (create/edit by title, read-back
verified, value-free errors); BwsStore gains store_with_note with
read-back stamp verification. set --store 1password now writes
through OpStore, retiring #15433's refusal. Book reference gains
set + put sections; verbs.md table completed.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 85f9bd89-6751-4ec2-9db3-2116c9b71393
Commits

Reviewing files that changed from the base of the PR and between 78d9ed1 and 15680ac.

Files ignored due to path filters: 1

  • pkgs/fleet/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 5

  • pkgs/fleet/book/reference/secrets.md
  • pkgs/fleet/crates/fleet-secrets/Cargo.toml
  • pkgs/fleet/crates/fleet-secrets/src/lib.rs
  • pkgs/fleet/crates/fleet/src/secrets.rs
  • pkgs/fleet/docs/verbs.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

Secrets plane: pick up and ship the dual-write put verb (#13948 S5)

1 participant