Close the checkpoint gaps: pinned eligibility, symlink guard, partial restore, retention (N3 WP3) #33

Merged
weichen merged 2 commits from feature/n3-checkpoint-wp3 into main 2026-10-07 15:51:22 +00:00
Owner

Why: rollback eligibility was implicit, restore followed symlinks out of the root, one failing file aborted the rewind with unreported partial state, and the log grew unboundedly with O(N) reads per record.

What: exported CheckpointedTools set + Checkpointed() predicate (pinned by test); symlink targets classify as Skipped (link and outside target untouched); Rewind reports Failed per file and continues; Log.Compact(keepAnchors) bounds the log with original seqs preserved; Seq from a cached counter.

Evidence: GOWORK=off go vet + go test -count=1 ./... green; all new tests plus pinned edges (empty ordered, identical-rewrite=Already, per-record roots); pre-existing rewind tests unchanged.

Impact: Result gains Failed (additive); rewind semantics documented in code; acceptance ② machine evidence.

Refs: Agent-System-Documents#43 (N3 plan WP3)

Why: rollback eligibility was implicit, restore followed symlinks out of the root, one failing file aborted the rewind with unreported partial state, and the log grew unboundedly with O(N) reads per record. What: exported CheckpointedTools set + Checkpointed() predicate (pinned by test); symlink targets classify as Skipped (link and outside target untouched); Rewind reports Failed per file and continues; Log.Compact(keepAnchors) bounds the log with original seqs preserved; Seq from a cached counter. Evidence: GOWORK=off go vet + go test -count=1 ./... green; all new tests plus pinned edges (empty ordered, identical-rewrite=Already, per-record roots); pre-existing rewind tests unchanged. Impact: Result gains Failed (additive); rewind semantics documented in code; acceptance ② machine evidence. Refs: Agent-System-Documents#43 (N3 plan WP3)
weichen added 1 commit 2026-10-07 15:47:41 +00:00
Close the checkpoint gaps: pinned eligibility, symlink guard, partial restore, retention (N3 WP3)
ci / vet-and-test (pull_request) Failing after 26s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
e8f4e097a7
Why: rollback eligibility was implicit (any struct with a mark field),
restore followed symlinks out of the root, a single failing file
aborted the rewind leaving unreported partial state, and the log grew
unboundedly with an O(N) read per record.
Evidence: GOWORK=off go vet + go test -count=1 ./... green;
TestCheckpointedToolSetIsPinned (eligibility is exactly
{write_file, edit_file, multi_edit}), TestRewindSkipsSymlinkTarget
(link and outside target untouched, classified Skipped),
TestRewindPartialFailureContinues (Failed reported, rest restored),
TestCompactKeepsRecentAnchors (original seqs kept, monotonic after),
plus pinned edges for empty ordered, identical-rewrite=Already, and
per-record roots; all pre-existing rewind tests pass unchanged.
Impact: Result gains Failed (additive); Rewind no longer aborts on a
single file; symlinks classify as external changes; Compact bounds the
log; Seq is computed from a cached counter instead of a full read.
Refs: Agent-System-Documents#43 (N3 plan WP3)
weichen added 1 commit 2026-10-07 15:50:05 +00:00
Make the partial-restore failure test root-proof via a test seam
ci / vet-and-test (pull_request) Successful in 53s
ci / docker-checkout-hostgateway (pull_request) Successful in 0s
f2fbefa2b9
Why: CI runs as root, where chmod-based failure injection does not
fail (root bypasses file permissions), and any filesystem state that
would fail restore is pre-detected by the classification pass. A
package-level test seam makes the injection deterministic on any uid.
Evidence: GOWORK=off go test (-race) green locally.
Impact: test-only seam, documented as never-for-production.
Refs: Agent-Native#33
weichen merged commit f04c87ac31 into main 2026-10-07 15:51:22 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-Native#33