Skip to content

Own durable file publication in AtomicFile and Platform - #2658

Merged
3 commits merged into
mainfrom
next/directory-fsync
Oct 23, 2026
Merged

3 commits merged into
mainfrom
next/directory-fsync

Conversation

@trissim

@trissim trissim commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

File publication duplicated staging, file flush, replacement and parent-directory flush across the stores, exports and installer. AtomicFile now owns that procedure; ExclusiveAtomicFile changes only publication to preserve no-overwrite exports. All _atomic_write_text callers, including historical_views, thread_management and threads, use the class and the old function is deleted.

Platform now owns directory flush and existing-file sync opening. PosixPlatform opens directories with O_DIRECTORY|O_NOFOLLOW and reads existing files; Win32Platform makes directory flush a no-op and opens existing files rb+ for the CRT flush. Every former private_path.fsync_directory consumer now calls Platform; the old helper is deleted. AtomicFile owns staging/publication, while Platform owns OS behavior.

Existing NRA AST inventory covered declarations, imports and calls in src/tools/tests with no parse omissions. File-relative updates in active_route, private_sidecar and selected_claim retain their already-open directory descriptors. JsonDocument retains rollback; SQLite syncs its existing inode. installer/backup.py overlaps old draft #2556 as explicitly requested.

Source checks:

  • git grep -n _atomic_write_text -- src tools tests: zero lines, including the three callers formerly held by Integrate accepted bus, backend, CLI, phase and birth-marker deletions #2635.
  • git grep -n fsync_parent -- src tools tests: only the deletion-check literal at held plan_phases.py:555. No caller or implementation remains.
  • O_DIRECTORY remains at active_route.py:240/448, child_process.py:497 (the POSIX owner), private_path.py:284 (pinned parent descriptor), private_registry_guard.py:329 (capability probe), private_sidecar.py:126 and selected_claim.py:195/197 (preserved fd-relative protocols/probe).
  • The initial NRA inventory parsed src/tools/tests without omissions. A later attempted expanded Platform inventory did not complete: its environment lacked tree_sitter, then the alternate interpreter could not parse Python 3.13 type-parameter defaults. It supplies no additional coverage claim. Platform declarations, inherited implementations, imports and migrated calls were read directly for the correction.

Testing belongs to the integrator under Tristan's latest stop order. The earlier two-worker touched run exited 137 with two failure markers and no completed summary; it is not a pass. No new tests, debt scans or census runs were launched after the stop order. No owned pytest/npm process remains running. Windows-only tests were not run. Added regression coverage exercises Win32Platform file publication and writable sync opening on either host; the integrator still needs to run it and tests/test_goal_attempts_windows.py on Windows.

Earlier touched batch: test_atomic_file, test_locked_store, test_goal_history, test_goal_attempts, test_exporting, test_headless_diagnostics, test_native_package, test_native_session_reopen, test_restart_queue, test_store_backup, test_acp_selected_write_plan, test_registry_revision. Additional platform consumers include fresh_private_session and selected_tool_broker.

Assumed: existing Windows directory durability policy requested by the owner (NTFS rename journaling, no POSIX directory flush); fd-relative protocols retain their existing held-descriptor behavior. No installation or live UI qualification is claimed by this source delivery.

@trissim
trissim marked this pull request as ready for review October 23, 2026 07:53
Copilot AI balanced review requested due to automatic review settings October 23, 2026 07:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

Copy link
Copy Markdown

debt-tools at f1a472d, every finding:

grew Unformatted:tools/cutover/carry_owner_requests.py +1

@github-actions

Copy link
Copy Markdown

debt-src at f1a472d, every finding:

grew LintFindings:src/agent_comms/diagnostics.py +1
grew LintFindings:src/agent_comms/historical_views.py +1
grew LintFindings:src/agent_comms/installer/backup.py +1
grew LintFindings:src/agent_comms/private_registry_guard.py +1
grew LintFindings:src/agent_comms/selected_tool_broker.py +1

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.

2 participants