Repository navigation
fix(backup): distinguish runs from wall-clock timestamps - #12052
Conversation
|
Intent: Distinguish same-process backup runs independently of equal or backwards wall clocks, and recover bounded failed-state-write records/fingerprints without acknowledging another run. Keep newly locked successful writes authoritative across process restarts. |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the Windows CI shard is green at this head — the same-second/backwards-clock paths were only exercised on Linux with a mocked clock. Suggestions
[DESIGN-REVIEWED] e7b1823 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the Windows shard on this head: the equal-clock defect is Windows-only and the author confirms no native Windows execution was run. Not justified as shipped
What this change shipsInventory (8 items) — 7 justifiedIntent: FIX — keep a completed backup upload's last-run record and restore fingerprint correct when wall clocks tie/go backwards or a local state write fails.
[FIRST-PRINCIPLES-REVIEWED] e7b1823 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsThe single candidate is a deliberate liveness/perf tradeoff (read calls now serialize behind an in-process lock the author intentionally added — documented in the spec hunk), not a correctness defect: lock ordering is consistent ( No findings. [OPUS-REVIEWED] e7b1823 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
|
|
|
Problem / Motivation
Backup run timestamps are wall-clock observations, not unique identities or monotonic order. Equal clock readings reproduced the Windows CI failure in
TestALostRunWriteDoesNotReUploadForever::test_two_runs_in_the_same_second_are_distinguishable. More importantly, after an uploaded archive's local state write fails, timestamp comparisons can hide its newer run or acknowledge a different run, losing recovery metadata.Why it matters
A completed upload must remain visible to the nightly scheduler and retain its bounded restore fingerprint while this process recovers local persistence. Merely advancing the test clock masks this production defect.
What changed (motivation → approach → change)
src/kiro_crew/apps/builtins/aws_control/backend/backup.pyretains truthfulatvalues and adds a process namespace/local sequence. A new sidecar-locked run always replaces its kind's prior state; only pending overlay/recovery uses recency comparisons. Its existing staging-prefix expression uses equivalent string concatenation so the unversioned Fast Gate parser can read the module; hashing, byte limits and supported runtime versions are unchanged.test/test_aws_control_backup.pycovers equal/backwards clocks, prior-process/legacy records, failed reads/writes, exact acknowledgement, bounded fingerprints and barrier-synchronized recovery. Assertions that incorrectly equated timestamps with identity are replaced, not bypassed with a faster clock.docs/system-specs/modules/aws-control.mdrecords these guarantees and limits.This is separate from the CI migration: no runner, workflow, UI, translation, permissions or upload-consent changes. No full-history collection or public unknown-order envelope.
Backwards compatibility
Compatible: existing run fields and legacy records remain readable; process/sequence metadata is additive. Cross-process/legacy recovery keeps the existing wall-time fallback, not a guarantee of global newest. New locked writes remain authoritative across restarts. Restarting before recovery still loses process-only metadata. The existing unresolved state-path sentinel recovery limitation is not redesigned.
Tests
6976aeb7d241c97084d0e3e1ef9dddaee853829c. Focused independent verification of the syntax-only follow-up and three output cases: no findings one7b1823eb10d44b1633147b6e0c9120101b50237.Manual verification
Real local state files, injected persistence errors and thread barriers were exercised on Linux. Current-head CI run passed all eight Linux and eight native Windows backend shards, frontend tests, E2E, coverage and lint. Windows shard 7 ran on Windows Server 2025 / Python 3.12.10; its per-case progress artifact records all 36 identity/order/recovery/acknowledgement regressions passing with zero skips in that set. The full backup module recorded 110 passed and four existing archive-capability skips. Official readiness verification passed on
e7b1823eb10d44b1633147b6e0c9120101b50237: 86 checks, zero running or failing, fresh GPT/Opus, no unresolved threads. Native macOS was not selected by the existing workflow; no live AWS upload/restore is claimed. No frontend source or UI changed.Related Issues
Separate product fix for the backup failure exposed by PR #11880; that PR remains pure CI. Open-PR overlap scan found no backup implementation/test overlap; PR #7140 changes an unrelated section of the same specification.
Pattern harvest
Rule candidate: review-prompt
Pattern: distinguish observed wall time, operation identity, authoritative write order and exact persistence acknowledgement; a recency comparison is not a substitute for any of them.
Checklist