Skip to content

[SUPERSEDED / UNMERGED] Targeted session durability carried into #177 - #178

Closed
mark-e-deyoung wants to merge 4 commits into
integration/mvp-formal-handover-20261121from
fix/mvp-durable-session-commit-20261121
Closed

mark-e-deyoung wants to merge 4 commits into
integration/mvp-formal-handover-20261121from
fix/mvp-durable-session-commit-20261121

Conversation

@mark-e-deyoung

Copy link
Copy Markdown
Collaborator

Bounded critical-path durability correction

Stacked on independently checked formal/control + recovery combined draft #175, which in turn is based on qualified MVP #158. The core api/utils/files.py::_atomic_write_text already fsynced temporary file contents and atomically replaced the name, but did not sync the parent directory. A hard crash could lose the pointer/state rename despite successful API return.

Adds opt-in durable_directory=True to the existing primitive and uses it only for authoritative write_session_dir pointer and write_session_state commits (not high-frequency ordinary writes). Propagates directory fsync errors instead of reporting a false commit. The sequence is: temp write -> file fsync -> atomic rename -> parent-directory fsync -> acknowledge. Does not claim atomicity spanning two separate state files, broker or Wine.

Three synthetic unit regressions verify both authoritative writer call paths perform file + directory fsync, a failed os.replace preserves old state and cleans temporary files, and a failed directory fsync is surfaced without a false success claim. Explicitly added to scripts/ci/test.sh mandatory unit manifest. Updated formal workflow path filter for the new source/test.

Admission

Public-free-tier exact-head lint/unit, frozen external conformance, smoke and full TLC blue + adversarial counterexample gates; no private runner, sovereign hardware, real user data, source declassification, merge or release. Preserve parent #175 qualification and PR #158 DLE authority. Target is Linux/POSIX durable directory semantics; actual host-filesystem guarantees still need environment-specific qualification.

Copy link
Copy Markdown
Collaborator Author

2026-11-21 05:20 CET — durable atomic-state design comparison and consolidation

Concurrent source variants compared against qualified MVP: #177's api/utils/files.py::_atomic_write_text performs file fsync, atomic rename, always parent-directory fsync for all six metadata writer call paths (SESSION_FILE, session state/mode/control policy, instance state/control policy), and propagates durability errors. #178 independently proposed opt-in directory fsync for only the session pointer/state, with separate unit tests. Exact api/utils/files.py source call-site inventory confirmed only low-frequency control/session metadata, no high-volume telemetry/event trace writer. The universal sync approach in #177 is therefore both simpler and more complete for authoritative metadata, without compelling evidence of significant hot-path overhead.

Action: retained DRAFT #177 as sole durability candidate, now exact head 1ad26d6ea66c44cc109baf99fed8ad2971c15eb9. Extended the existing mandatory tests/test_invariants.py unit suite with (1) authoritative write_session_dir file-then-parent sync capture and pointer bytes; (2) interrupted os.replace preserving previous session state and cleaning temporary files. Complements earlier file/state ordering and directory fsync-error propagation tests. No duplicate test runner manifest and no production code changes relative #177's chosen implementation. No native process effects.

DRAFT #178 remains a historical opt-in alternative with its tests, now superseded by #177; close without merge to avoid two competing atomic writer contracts. Need exact-head full public GHA of #177 1ad26d6e before release or any merger, and explicit source integration with canonical combined #176. Any merged source must trigger formal check for changed session persistence even if no TLA+ sources changed; add api/utils/files.py to #176 TLC workflow filters when integrating durability. Fsync of parent metadata cannot by itself make the multi-file, multi-process or host/guest transaction atomic; recovery and fencing still required.

@mark-e-deyoung mark-e-deyoung changed the title [DRAFT] Persist session pointer/state directory entries across crash windows [SUPERSEDED / UNMERGED] Targeted session durability carried into #177 Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant