Repository navigation
fix(cli)!: secret rewrap --apply without --yes in a non-interactive shell exits 1 - #38042
objectstack-fleet[bot] wants to merge 4 commits into
Conversation
…hell exits 1 A run that did not get its confirmation opens and writes nothing and exits 1, naming --yes, as the os migrate family and the orphans commands do. An interactive "n" keeps exit 0; the --json face is unchanged. The orphans confirmation pin's population widens to every non-migrate command declaring a boolean --yes, with a roster row for secret rewrap. Claude-Session: https://claude.ai/code/session_01L9qibwZirQyEPMnAGdpGGW Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwZirQyEPMnAGdpGGW Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 40 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin cf1ed2590c214c19823b8faaf94aab52586e2efb && git checkout cf1ed2590c214c19823b8faaf94aab52586e2efb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8d34c4404f951410083a6caebd6ad8003ea3423d 00049e7be83628c9540f1bc3380d941a8e4c3873 && git checkout -B drift-repro 8d34c4404f951410083a6caebd6ad8003ea3423d && git merge --no-ff 00049e7be83628c9540f1bc3380d941a8e4c3873
node scripts/docs-audit/affected-docs.mjs --json 8d34c4404f951410083a6caebd6ad8003ea3423d
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head b15bd75 · 2026-11-27T20:57Z L1-a (the seat's L1 thread) runs the isolated |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Read on this head: the net diff against ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 The filled brief the record above was rendered from (L1-a, isolated Contract review brief — PR #38042 @
|
The population walk read only modules one directory below src/commands and pre-filtered on the source text, so a top-level command (os deploy) or a subcommand two levels down could gain a --yes with no pin failing. It now descends the whole tree minus migrate, as the migrate pin does, and decides membership off the loaded class's flags alone. The changeset's Unchanged clause now says a dry run keeps the exit status it had, rather than that it exits 0 unconditionally. Claude-Session: https://claude.ai/code/session_01L9qibwZirQyEPMnAGdpGGW Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1 REWORK at What holds:
Owed before ACCEPT.
Nits (not blocking).
Tier H on landing (narrowing). |
The walk records every module it loads; a case holds that list equal to an independent recursive listing of src/commands minus migrate/, so a walk that stops descending, or skips the top level, fails on its own even while the three members it does reach still equal the roster. A second case names today's census: db orphans, secret orphans, secret rewrap. Claude-Session: https://claude.ai/code/session_01L9qibwZirQyEPMnAGdpGGW Co-authored-by: Claude <noreply@anthropic.com>
Requested by Tesla · project thread
Fixes #36679
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no file under skills/** mentions
os secret rewrap(greprewrapover skills/: 0 hits); the CLI reference sectioncontent/docs/deployment/cli.mdx§os secret rewrapwas re-read and says nothing about the exit status of an unconfirmed run, so nothing it states is falsified维护者速读
Breaking
BREAKING (an exit status narrows), shipped as
patch: the change is not to the metadata protocol (Metadata-protocol: none), so the level axis gradespatch, as the precedent #36676 did for the orphans commands.os secret rewrap --applyon a database with a version-1sys_secretrow to re-wrap, without--yes, stdin not a terminal, text face: nothing opened or written,Aborted — no row was opened or written., exit0.Confirmation required. Re-run with --yes to re-wrap. No row was opened or written., exit1.nat the[y/N]prompt in a terminal still printsAborted — …and exits0;--jsonwithout--yesalready exited1withconfirmation_required;--yesre-wraps as before; a dry run, or an--applyrun with nothing to re-wrap, asks nothing and keeps the exit status it had (0when the run is not otherwise refused; a missing data key or an incomplete reference union still exits1).--yesto re-wrap; drop--applyto get only the dry-run report.ADR-0087 disposition: the changeset carries the marker
adr-0087: not-required (no-migration-prescription); no metadata, stored shape or export moves.node scripts/check-adr-0087-registration.mjs --base origin/mainat b15bd75 (the marker is unchanged at 00049e7):1 declared-breaking changeset(s), each carrying an ADR-0087 disposition([BREAKING+bang+clause-②-narrowing]).What changes
os secret rewrap --apply, run where stdin is not a terminal and without--yes, now prints a warning naming--yesand exits 1. The shape is the oneos db orphans/os secret orphanstook in #36676 (and theos migratefamily's): inside the!flags.yesgate, after the--jsonface, a non-TTY branch warns and callsthis.exit(1). Thethis.exit(1)sits inside thetrywhosecatchalready rethrows the exit signal (isExitSignal) and whosefinallyshuts the stack down. Nothing about what rewrap opens, re-seals or writes changes.The confirmation pin
packages/cli/test/orphans-confirmation-exit.pin.test.tswidens its population from "non-migrate commands declaring booleandeleteandyes" to "non-migrate commands declaring a booleanyes", whatever mode flag it confirms. Today that isdb orphans,secret orphansandsecret rewrap. The walk that feeds it now descends the whole ofsrc/commandsminusmigrate/(top-level commands such asos deployand subcommands two levels down such asos plugin trust revokeincluded), as the migrate pin's walk does, and decides membership off the loaded class's flags only: no source-text prefilter, so a quoted'yes'key or a flag from a shared flag set counts. A census case holds the list of loaded modules equal to an independent recursive listing of the same tree, so a walk that stops descending fails on its own; a second names today's three members. The next command with a--yesoutsidesrc/commands/migratefails the population case until it has a roster row. Per ruling record 6583487846 the row goes into the existing harness file, not a new one. The rewrap row runs the real reference union, planner, executor and local crypto provider (overOS_SECRET_KEY) on a fake engine holding one version-1 row its setting references; only the boot is replaced.Read first, by risk:
packages/cli/src/commands/secret/rewrap.ts— the new non-TTY branch inside the!flags.yesgate.packages/cli/test/orphans-confirmation-exit.pin.test.ts— the recursive walk and its census, the widened population, theone-shot-settingsmock now keeping the realoneShotCrypto, and the rewrap fixture.Two-minute check:
pnpm --filter @objectstack/cli exec vitest run --project unit test/orphans-confirmation-exit.pin.test.ts— expect 15 passed.Tests
Per roster member (3): text face non-TTY without
--yes(exit 1, output names--yes, nothing written, no export, no prompt);--jsonface (exit 1,confirmation_required); control--yes(exit 0, one write, export written where the mode writes one); control terminal answeredn(prompted, exit 0, nothing written). Plus three population cases: the walk census (loaded modules == a recursive listing ofsrc/commandsminusmigrate/), population == roster, and today's census. 15 tests.Premise probe on origin/main 3e8edf7 (before the fix)
A probe driving the real command (boot replaced only):
Pin run at 00049e7
Ablations at 00049e7, each through scripts/ablation-replace.mjs and restored (blob == HEAD, git diff HEAD empty)
A1, the non-TTY
this.exit(1)in rewrap.ts removed (blob 104d5a39 -> d90df941):A2, the walk stopped below one directory (pin blob 3f67d892 -> 033acfbf):
A3, a quoted
'yes'boolean planted on the top-levelos deploy(blob 953b5a1d -> b97875fa):A4, a
yesboolean planted onos plugin trust revoke, two directories down (blob a13e4d32 -> 03dc13f5): the same two cases red, 2 failed | 13 passed (15).Two earlier attempts (A1 at 824d759, A2 at 00049e7) were refused by the tool as no-ops because the replacement text contained the anchor; nothing ran on either, and each was redone with a disjoint replacement.
Acceptance notes
content/docs/deployment/cli.mdx§os secret rewrapdocuments-y, --yesas "skip the confirmation prompt" and says nothing about the unconfirmed exit status; left as is (outside the claimed surface, and nothing in it is now false). The follow-up for all three commands is reported to the seat on cli:os secret rewrap --applyin a non-interactive shell without--yesprints "Aborted" and exits 0 — the confirmation family (migrate, orphans --delete) exits 1 #36679.Verification
Local runs are listed with their head in the os-dev report on #36679; CI's check-runs on this PR are the record for every family CI runs.
Generated by Claude Code