feat(core): add No Silent Apply and ledger rollback - #241
Merged
Conversation
Selfware §6.3 states the ceremony as explain / summarize / accept-reject-defer / apply-only-on-accept, with a rollback point taken first (§7). This makes it a reusable module rather than a prompt each caller hand-rolls, so ledger rollback, plugin installs, and contract changes cannot drift apart. The load-bearing decision is in the signature: `confirm` is required. There is no assume-yes path and no default, so a caller that cannot ask a human cannot apply. That makes "no silent apply" a property of the type rather than a convention people remember. If the rollback point cannot be created, nothing is applied. The user accepted an operation described as reversible; doing it irreversibly is a different operation than the one they agreed to. `deepcode ledger rollback <id>` uses it. Conflicts are surfaced before the decision, not resolved silently: later edits to the same file that would be discarded, modification outside DeepCode since the last snapshot, and Bash checkpoints restoring every tracked file the command touched. A `post-` capture of the same call is excluded — otherwise every single-edit rollback would warn about itself and the warning would stop meaning anything. The rollback is itself recorded on the governance timeline. An audit trail with an unlogged undo is not an audit trail. Missing hint, missing session, aged-out snapshot return a reason rather than throwing. Snapshots and ledger records expire on different schedules, so a record outliving its checkpoint is an expected state of an audit log. In the CLI prompt, anything other than an explicit yes is a no: a mistyped answer must not overwrite files. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 4 of
docs/FLOATBOAT_ADOPTION_PLAN.md§2.F + §2.B. Makes the ledger from #240 actionable, and gives every future high-impact application one shared ceremony instead of four hand-rolled prompts that drift.confirmis required — that's the whole designSelfware §6.3 is a four-step ritual: explain the update logic, show a summary, ask accept/reject/defer, apply only on accept — with a rollback point taken first (§7).
The load-bearing choice here is in the type signature:
applyWithCeremony(plan, confirm)takesconfirmas a required argument. There is no assume-yes path and no default. A caller that cannot ask a human cannot apply. That makes "no silent apply" a property the compiler enforces rather than a convention reviewers have to remember.If the rollback point can't be created, nothing is applied. The user accepted an operation described as reversible; performing it irreversibly is a different operation than the one they agreed to.
rejectanddeferare ordinary outcomes, not errors — §6.3 requires the current version keep working after a reject.Conflicts are surfaced, not silently resolved
Undoing an old change is not the same operation as undoing the last one. The plan carries the cost before the user decides:
Bashgit checkpointA
post-capture of the same call is explicitly not counted as a later edit — otherwise every single-edit rollback would warn about itself and the warning would stop meaning anything. There's a test pinning that.The rollback is itself recorded
On the governance timeline. An audit trail with an unlogged undo is not an audit trail.
Failure states return reasons, not stack traces
Snapshots and ledger records age out on different schedules, so a record can outlive the checkpoint it points at. Missing hint, missing session, and pruned snapshot each return
{ status: 'unavailable', reason }— these are expected states of an audit log.In the CLI prompt, anything other than an explicit yes is a no. A mistyped answer must not overwrite files.
Test plan
pnpm test— 1337 passed, 16 skipped (+20: 903 core, 232 cli)pnpm typecheck·pnpm lint·pnpm format:check·pnpm build·node scripts/check-docs.mjspost-capture of the same call does not; outside-DeepCode modification warnsDocumentation
docs/change-ledger.md— new Rolling back section: the four steps, the conflict list with thepost-exclusion, and what happens when rollback isn't possibleRelease notes label
release-notes:featureRelated
Plan §2.F / §2.B (PR 4). Builds on #240. Research:
docs/research/floatboat.md§4.4(4).🤖 Generated with Claude Code