fix(remote): answer a repeated script delivery from the publication record

Merged
TH
8d ago
+695-1031

Summary

A repeated or late-duplicate script delivery (revision ≤ the committed revision) is answered from the client's publication record. It reports the stored absolute destination as savedScript, and adds a warning to the existing warnings array. The warning says the version was already saved, or that it is superseded and names the revision the record last confirmed. It also discloses an interrupted newer save, says the file is not checked again, and gives the recovery: the next recorded action, or after close reusing the original open command with --save-script=<path> --force. The repeat path never downloads, reads, hashes, or re-walks the destination.

Removed: the per-version digest, the bounded verified read, CommittedVersionUnverified, the script_entry_changed and script_entry_unverified causes, the repeat judgement, and host-kit's judgeScriptDestination (isWindowsShareUnavailable is now module-private). Old records that carry a digest or an entry still parse, and those fields are dropped.

Kept: first commits and interrupted-commit settlement, under one locked operation that reads the record, decides repeat or stage, prepares the destination, and allocates staging. A failed fetch or a re-offer of an interrupted version settles under the lock first. A failed fetch stays script_download_failed unless that settlement answers with a published path. A new commit still requires a verified staged file: regular, ≤ 8 MiB, and unchanged through one verified read. Nothing is stored. A failing cleanup after a failed artifact download is reported as a warning instead of an unhandled rejection. The close recovery hint names the file: reuse the original open command with --save-script=<path> --force.

16 files, +695/āˆ’1031. Docs: replay-e2e.md and ADR 0016. The wire-compat ledger acknowledges publishScriptVersion and PublishOutcome (local shape only). There are no wire changes and no protocol bump.

Security: the daemon and other local users are untrusted. The change writes nowhere new, and no path comes from the daemon. A committed repeat does no filesystem work. Settling an interrupted version does one confirmation walk and one lstat, the same steps a first commit takes.

Terminal-safe CLI output for every command, including the paths this change reports, is handled separately in #4778.

Validation

At 81fbe880c4 (on main after #4745 and #4747): the remote, host-kit, command-output, wire-compat and eager-closure suites passed. Typecheck, lint, fallow audit --base origin/main, and check:production-exports are clean. Each new test fails under a targeted mutation. CI validates the head.

šŸ¤– Generated with Claude Code


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