Repository navigation
feat(minimal): write the store rule from min secret set with fixed-token presets (T39) - #2577
Conversation
min secret set takes --upstream with --header/--prefix or --basic-auth, or --preset (anthropic, anthropic-api-key, cloudflare, linear, sentry), and writes the [secret-store-rules] rule for the item to the user-level config.toml, with no consent action (BEP-079). The rule is checked against the deny set, and a change to a different rule is confirmed on the terminal or needs --yes, before the value is read. The rule is written first and the item second. When the store refuses the item, config.toml is put back as it was.
…store-rule-from-min-secret-set-with-fi
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: not checked in git history. If that was not intentional, restore the earlier change. |
There was a problem hiding this comment.
arch-review: CONFIRM · the full ruling
This change makes host-store min secret set take --upstream and write a [secret-store-rules] rule, as BEP-079 asks. The design of record says the opposite. architecture.md line 513 says that for a host store, set takes no upstream and registers nothing, and that --upstream is refused for a host store. The code is otherwise in the right place, and it refuses the deny set before it reads the value. This PR cannot settle a conflict between the spec and the design, so the ruling is CONFIRM with one escalation. The task waits for a decision on gominimal/arch: amend line 513, or drop BEP-079 from the spec.
Ruled at 1279c03 against gominimal/arch@109541a48c31 by claude-opus-5-5.
…store-rule-from-min-secret-set-with-fi
The restore after a failed store write now puts config.toml back only when it still holds the bytes the rule write left, and writes through a symlinked config.toml to its target. The rule-read failure names the config file, and the no-confirm refusal no longer claims there is no terminal when --no-input is the cause.
There was a problem hiding this comment.
arch-review: CONFIRM · the full ruling
This change does what spec 24 BEP-079 asks. The rule goes only to the user-level config.toml. The deny set is checked before the value is read, and the rule carries no consent action. But architecture.md line 509 gives --upstream and --inject to --store gatehouse only. Line 513 says a host-store set "takes no upstream and registers nothing". The spec and the design disagree, and this change cannot amend the design. I escalate the question to the arch owner, and the task waits for that decision. No code change is asked now.
Ruled at 9aa6c48 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
Notes from the agent: Revise round 1. Threads PRRT_kwDOPdfcxM6wDlvk and PRRT_kwDOPdfcxM6wDlvo are escalations of a conflict between the spec and the design (BEP-079 against architecture.md). The bot asks for no change until a person decides on gominimal/arch, so the code is unchanged for them. The no-confirm refusal now says 'it cannot ask you to confirm the new rule'. No spec text pins it. I also ran |
|
/revise Round 2 of #2577, on the arch escalation at 9aa6c48 and two review findings. No round is in flight. The epic owner decided on 2026-10-26 that spec 24 BEP-079 wins over architecture.md lines 509 and 513. gominimal/arch#145 amends the design. So keep
Keep to Generated by Claude Code |
…store-rule-from-min-secret-set-with-fi
When a rule for the id exists, the rule that set writes now keeps the current action and store, because no flag sets them. A hand-set deny or ask is no longer dropped. With --yes, set prints one line on stderr that names the rule, the file and the fields that change.
…store-rule-from-min-secret-set-with-fi
There was a problem hiding this comment.
arch-review: CONFIRM · the full ruling
BEP-079 tells host-store min secret set to take --upstream and write the [secret-store-rules] rule. architecture.md line 513 says a host-store set "takes no upstream and registers nothing". Line 509 gives the authority flags only to --store gatehouse. The design is the record, and only the arch owner can change it. I escalate the question and give no ruling until the owner decides. The rest of the change agrees with Gatehouse §6.10 line 849.
Ruled at 9cb8839 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 2 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
Notes from the agent: Revise round 2. plan_rule now copies the current rule's action and store into the new rule, because no flag sets them. The change prompt shows the kept consent. With --yes, set prints one stderr line: |
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter approval at 9cb8839: every merge gate passes at this head (arch PASS at 9cb8839, zero open threads, every lane aggregator green). Squash title feat(minimal): write the store rule from min secret set with fixed-token presets (T39) and the squashed message pass commitlint. Queued for squash merge.
Generated by Claude Code
There was a problem hiding this comment.
arch-review: CONFIRM · the full ruling
This change does what spec 24 BEP-079 asks. The design of record refuses it. architecture.md line 513 says that for a host store, set takes no upstream and registers nothing. It also refuses --upstream and --inject for a host store. No code edit can settle this, so I file an escalation for the arch owner. The task waits for that decision. Where the design does speak, the rest of the change conforms: the user-level file only, the deny set before the value, and no value in the log.
Ruled at 130a9fd against gominimal/arch@109541a48c31 by claude-opus-5-5.
| conflicts_with = "preset", | ||
| requires = "form" | ||
| )] | ||
| pub upstream: Vec<String>, |
There was a problem hiding this comment.
BEP-079 · This flag gives host-store min secret set an upstream. architecture.md line 513 says: "for a host store, set takes no upstream and registers nothing". Spec 24 BEP-079 asks for the flag. The escalation asks the arch owner to decide. Do not change this line until the owner decides.
There was a problem hiding this comment.
Disputed — not addressed: No change this round. The task covers BEP-079, and BEP-079 asks for --upstream on host-store min secret set. The thread itself says to keep this line until the arch owner decides the conflict with architecture.md line 513.
| mut target: Option<RuleTarget<'_>>, | ||
| ) -> anyhow::Result<()> { | ||
| refuse_set_args(args)?; | ||
| let rule = requested_rule(args)?; |
There was a problem hiding this comment.
BEP-079 · Here set turns its flags into a [secret-store-rules] rule and writes it. Line 513 of the design keeps registration out of host-store set. The ordering is correct: the deny set check, then the value, then the store, then the restore. The open question is only whether set may write the rule at all.
There was a problem hiding this comment.
Disputed — not addressed: No change this round. BEP-079, which this task covers, requires set to write the [secret-store-rules] rule. The thread agrees the ordering is correct and leaves only the design conflict with line 513 for the arch owner to decide.
The merge from main added an entry field to StoreRuleRefusal::MinimalInfrastructure. Name the entry when the upstream is a name under it.
| let snapshot = match &mut write { | ||
| None => None, | ||
| Some((path, rule, line, notice)) => { | ||
| if let Some(line) = line { | ||
| writeln!(notice, "{line}")?; | ||
| } | ||
| let snapshot = | ||
| crate::config::write_store_rule(path, &args.id, rule).with_context(|| { | ||
| format!( | ||
| "min secret set stored nothing: it did not write the rule for {} to {}", | ||
| args.id, | ||
| path.display() | ||
| ) | ||
| })?; | ||
| tracing::info!( | ||
| id = %args.id, | ||
| upstream = %rule.upstream.join(", "), | ||
| file = %path.display(), | ||
| "secret-store rule written" | ||
| ); | ||
| Some((*path, snapshot)) | ||
| } | ||
| }; | ||
| if let Err(e) = store.set(&args.id, &value, proxy) { |
There was a problem hiding this comment.
LOW · security · confidence 0.50 · in run_set_with_rule
The new rule is written to config.toml before store.set replaces the item. If the process is killed or interrupted between the two steps, the rule is not restored. The old keychain value then stays bound to the new upstream. The restore only runs when store.set returns an error. The old value can then reach an upstream it was never meant for. Write the item first and the rule second, or document and test this window.
What the reviewer checked
secret.rs:652 write_store_rule(...) runs, then secret.rs:675
if let Err(e) = store.set(...); restore_config is called only inside that Err branch.
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/secret.rs
Lines: 652-675
Category: security
Severity: low (reviewer confidence 0.50)
Finding:
The new rule is written to config.toml before `store.set` replaces the item. If the process is killed or interrupted between the two steps, the rule is not restored. The old keychain value then stays bound to the new upstream. The restore only runs when `store.set` returns an error. The old value can then reach an upstream it was never meant for. Write the item first and the rule second, or document and test this window.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in 06a638915864: The window is real, and the run_set_with_rule doc comment now describes it. The order stays rule first, item second. SecretStore cannot read a value back, so an item replaced first cannot be restored when the rule write fails. A kill between the two steps cannot run any restore code, and no unit test can cover it.
There was a problem hiding this comment.
arch-review: CONFIRM · the full ruling
Spec 24 BEP-079 makes min secret set take --upstream, --header, --prefix, --basic-auth and --preset for a host store, and write a [secret-store-rules] rule. architecture.md line 513 says the opposite: for a host store, set takes no upstream and registers nothing, and the deposit flags are refused for a host store. The code follows the spec, and it does that carefully. But only the design owner can settle the conflict between the spec and the design. A change to the code cannot settle it. This head changes only one refusal message, so the ruling stays CONFIRM, as on the four earlier heads. An escalation asks the owner to amend line 513 or to remove BEP-079.
Ruled at 55a132c against gominimal/arch@109541a48c31 by claude-opus-5-5.
| conflicts_with = "preset", | ||
| requires = "form" | ||
| )] | ||
| pub upstream: Vec<String>, |
There was a problem hiding this comment.
BEP-079 · This flag lets a host-store min secret set take an upstream. architecture.md line 513 says: "for a host store, set takes no upstream and registers nothing". It also refuses --upstream and --inject for a host store. Spec 24 BEP-079 requires this flag, so the spec and the design disagree. The escalation asks the owner to decide.
There was a problem hiding this comment.
Disputed — not addressed: Spec 24 BEP-079 requires --upstream on min secret set, and this task covers BEP-079. The disagreement with architecture.md line 513 is with the owner as an escalation. This line stays as it is until the owner decides. If the design wins, the change goes in the spec and architecture.md, outside this task's layers.
|
Round 3 of 10 on a failed check suite, pushed as
Verify Review threads the coder judged:
Notes from the agent: The failing checks had one cause. The merge from main (T55) added an |
…store-rule-from-min-secret-set-with-fi # Conflicts: # crates/minimal/src/cmd/secret.rs
The rule is written before the item because the store cannot read a value back, so only the rule file can be restored. A kill between the two steps leaves the old item under the new rule. Review finding 4374026712.
|
/revise Round 3 of #2577, on a merge conflict at 55a132c. No round is in flight. #2581 (T62) landed on main and moved
Generated by Claude Code |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
There was a problem hiding this comment.
arch-review: CONFIRM · the full ruling
This change does what spec BEP-079 asks. That spec line conflicts with the design of record. architecture.md line 513 says a host-store set takes no upstream and registers nothing. It refuses --upstream and --inject for a host store (owner ruling gominimal/arch#70). This change adds those flags and --preset to a host-store set, and writes the rule. A code change cannot settle this, so the ruling stays CONFIRM and the question goes to an arch issue. The last compare (a main merge and a doc comment) does not change the question.
Ruled at 06a6389 against gominimal/arch@109541a48c31 by claude-opus-5-5.
| conflicts_with = "preset", | ||
| requires = "form" | ||
| )] | ||
| pub upstream: Vec<String>, |
There was a problem hiding this comment.
BEP-079 · This flag gives a host-store min secret set an upstream. architecture.md line 513 says a host-store set takes no upstream and registers nothing. It refuses --upstream for a host store (gominimal/arch#70). BEP-079 asks for this flag, so the conflict is escalated for an owner decision.
There was a problem hiding this comment.
Disputed — not addressed: Same finding as the earlier threads on this line. BEP-079, the requirement this task covers, asks for --upstream on min secret set. The conflict with architecture.md line 513 is with the arch owner (gominimal/arch#70). This line stays as it is until the owner decides.
| /// Review finding 4374026712: this leaves one window. If the process is | ||
| /// killed after the rule write and before `store.set` returns, no restore | ||
| /// runs. The old item then stays under the new rule until the next `set` | ||
| /// or `rm`. The window is the duration of one store call. The command |
There was a problem hiding this comment.
LOW · security · confidence 0.50 · in run_set_with_rule
The rule is written before store.set. If the process dies between the two, the old secret stays in the store under the new rule. The new rule can name a different upstream, so the old secret can go to a host the user no longer expects. The doc comment admits this window. Think about a restore on the next run, or a marker that blocks use of the item until set finishes.
What the reviewer checked
run_set_with_rule doc: 'If the process is killed after the rule write and before
store.setreturns, no restore runs. The old item then stays under the new rule'
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/secret.rs
Lines: 543-546
Category: security
Severity: low (reviewer confidence 0.50)
Finding:
The rule is written before `store.set`. If the process dies between the two, the old secret stays in the store under the new rule. The new rule can name a different upstream, so the old secret can go to a host the user no longer expects. The doc comment admits this window. Think about a restore on the next run, or a marker that blocks use of the item until `set` finishes.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Disputed — not addressed: The order is deliberate, and the doc comment at secret.rs:539-547 records it. SecretStore cannot read a value back, so the rule is the only one of the two writes that can be put back. A recovery marker needs a store-side state in bep, and that is outside this task's layers. This round's directive also forbids behaviour changes. The window is one store call, and the command exits without printing an identifier.
|
A merge of main before round 4, not counted against the cap (1 of 3), pushed as Resolved conflicts in:
Verify Review threads the coder judged:
Notes from the agent: Conflict round. The only conflict was the |
norrietaylor
left a comment
There was a problem hiding this comment.
Own review at 06a6389: the new head is a merge of main, which takes main's resolver imports after #2581, plus a doc comment on the rule-then-item order and its interrupt window. Behaviour is unchanged since 55a132c. The arch CONFIRM is the question the owner ruled in gominimal/arch#145 (spec wins).
Generated by Claude Code
|
Round 4 of 10 on a /revise note: the coder changed nothing. every commit this round put on the branch above 06a6389 is a merge of the base branch, so it carries no work of its own Review threads the coder judged:
|
T39 — Write the store rule from min secret set, with fixed-token presets
slice: S3
kind: task
covers: BEP-079
size: L
est: 280 code, 600 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: an unknown preset prints "There is no preset named . Known presets: anthropic, anthropic-api-key, cloudflare, linear, sentry." on stderr, pinned by secret_set_unknown_preset_lists_known_ones
observability: one info log line per rule written naming the identifier and upstream, never the value
layers:
- cli:
- crates/minimal/src/cli.rs:
--upstream,--header,--prefix,--basic-auth,--presetand--yesonmin secret set- crates/minimal/src/cmd/secret.rs: presets, the rule check before the value is read, the change prompt, the partial-failure restore
- crates/minimal/src/config.rs: writes one
[secret-store-rules]rule to the user-levelconfig.tomltest: cargo nextest run -p minimal secret_set_writes_user_level_store_rule
test: cargo nextest run -p minimal secret_set_writes_no_project_or_org_config
test: cargo nextest run -p minimal secret_set_presets_resolve_to_their_rules
test: cargo nextest run -p minimal secret_set_unknown_preset_lists_known_ones
test: cargo nextest run -p minimal secret_set_refuses_deny_set_rule_before_reading_value
test: cargo nextest run -p minimal secret_set_shows_rule_change_and_asks
test: cargo nextest run -p minimal secret_set_rule_change_without_tty_needs_yes
test: cargo nextest run -p minimal secret_set_yes_replaces_rule_without_asking
test: cargo nextest run -p minimal secret_set_partial_failure_restores_both
test: cargo nextest run -p minimal secret_set_without_rule_flags_leaves_rule_unchanged
produces: none
consumes: none
proof:
min secret set claude --preset anthropicstores the key and writes its rule to the user-level configuration.depends on:
- blocked by #2280
- blocked by #2287
Proof
min secret set claude --preset anthropicstores the key in the keychain and writes [secret-store-rules.claude] with upstream api.anthropic.com, header Authorization and prefix "Bearer " to the user-level config.toml. Other lines of the file stay as they are. --upstream with --header/--prefix or --basic-auth writes a custom rule in the same way.Notes from the agent: The ten test: lines ran as one nextest invocation with all ten filters, and all ten passed. The existing secret and config tests also pass (32 passed). Design: the rule is written first and the item second. When the store refuses the item, config.toml is put back byte for byte, or removed when it did not exist before. With this order, the old keychain value never needs to be read back. When the rule write fails, the item is not touched. A 'terminal attached' means the value source is a terminal. A piped value or --no-input with a different rule therefore needs --yes. As BEP-079 says, the written rule has no consent action. So replacing a rule with a hand-set action = "ask" or "deny" drops that action. The change prompt shows 'consent: ask' becoming 'consent: none', but --yes drops it without a prompt. A reviewer can decide whether to keep a hand-set action. write_store_rule refuses a config.toml that sets secret-store-rules as an inline table, and the partial-failure test uses that refusal. The file is replaced through a temp file and a rename, so a config.toml that is a symbolic link becomes a regular file. The unknown-preset message is copied from the task. It states the situation and lists the names, but it gives no command to run. I did not run just clippy-strict or the whole crate's suite.
Tests
cargo nextest run -p minimal secret_set_writes_user_level_store_rulecargo nextest run -p minimal secret_set_writes_no_project_or_org_configcargo nextest run -p minimal secret_set_presets_resolve_to_their_rulescargo nextest run -p minimal secret_set_unknown_preset_lists_known_onescargo nextest run -p minimal secret_set_refuses_deny_set_rule_before_reading_valuecargo nextest run -p minimal secret_set_shows_rule_change_and_askscargo nextest run -p minimal secret_set_rule_change_without_tty_needs_yescargo nextest run -p minimal secret_set_yes_replaces_rule_without_askingcargo nextest run -p minimal secret_set_partial_failure_restores_bothcargo nextest run -p minimal secret_set_without_rule_flags_leaves_rule_unchangedVerify
min task run agent-verifyexited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Closes #2325