Repository navigation
T04 P1: Windows restore-journal deletion must follow durable directory rename #73
Description
Status — blocking T04 Windows recovery correctness
Independent review of PR #70 source c3f3fd951d0d0f8f5ff6882b7271a75977f26062 identified a P1 at #70 (comment).
On Windows, syncRestoreParent() currently returns without a filesystem durability operation. During recoverLegacyRestore(), renameSync(displaced, root) can restore the original root before the code deletes the only restore journal. Power loss may persist the journal deletion without guaranteeing persistence of the preceding directory rename. T04-H47 deliberately exercises POSIX fsync and skips Windows; this does not prove Windows durability.
This problem is not the hostile same-account mutation risk deferred in Issue #72. The Product Owner deferred that different threat model only; do not silently treat Windows crash durability as approved out-of-scope.
Required engineering solution
- Establish the exact supported Windows filesystems and any Windows APIs providing a real durable same-volume directory rename and journal unlink ordering; use credible OS documentation and supported native interop if required. Microsoft documents
MoveFileExW(MOVEFILE_WRITE_THROUGH), but its published guarantee explicitly addresses copy/delete moves; do not assume this alone proves same-volume NTFS directory rename durability without further evidence. - Introduce an isolated, audited Windows helper only if it actually guarantees the required ordering. Protect path safety, ACLs, original tree, rollback witnesses and error propagation. Avoid hardcoded PowerShell assumptions, injection, unsigned executable distribution or silent fallback to
fs.renameSync. - If no verified native method is available, fail closed without deleting the recovery journal for uncertain Windows rollback/commit state, provide an evidence-preserving operator recovery process, and explicitly amend the Windows support/acceptance contract through the proper approval gate rather than faking durability.
- Add deterministic Windows-specific fault injection at each rename, flush and journal-unlink boundary; preserve original directories/journals on failure. Reconcile H25/H28/H47 and avoid skipped Windows durability fixtures.
- Run
npm run release:validateand required T04 security suites twice on Windows/Ubuntu at the same reviewed head. Request fresh independent code, architecture and security source-bound review and resolve the PR fix(v0.12 T04): crash-safe event append, process locks and restore confinement #70 P1 only after evidence.
Source references
- https://learn.microsoft.com/en-us/windows/win32/fileio/moving-directories
- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw
No permission to waive this in-scope P1, merge PR #70, advance T05 or publish v0.12.0. This issue exists to make the blocking Windows implementation concrete and independently verifiable.
Activity
eybersjp commentedon Oct 12, 2026
Candidate Windows-native correction — independent durability review still required
Native
MoveFileExW(MOVEFILE_WRITE_THROUGH)recovery helper and regression H48 have been added to PR #70. Source code uses a bundled Windows PowerShell/Win32 P/Invoke helper only when restoring a displaced original during recovery or in-process rollback; helper failure throws and retains the recovery journal. A real Windows GitHub runner executed the actual API path.Verified GitHub Actions: https://github.com/eybersjp/development-kit/actions/runs/38321401970
T04-H48PASS twice (normal focused suite +release:validate).T04-H47remains the directory-fsync ordering fixture.Durability qualification: Passing H48 proves the Windows native call is executed and recovery ordering is functional, not a controlled real-power-loss durability experiment. Microsoft documents the native flag, but its explicit copy/delete flush guarantee does not settle every same-volume NTFS namespace scenario. Existing normal-stage promotion and initial journal publication still require independent evaluation. Do not close this P1 without an approved guarantee/fail-closed design for every supported Windows transaction boundary.
The Product Owner's separate same-account attacker deferral in Issue #72 is not a waiver of this Windows crash-durability requirement.
eybersjp commentedon Oct 13, 2026
Antigravity local candidate (13 October 2026) — safe Windows fail-closed behavior pending support decision
The engineering agent reports uncommitted local T04 changes aimed at failing closed before Windows restore mutates the target project because current published OS API evidence does not establish durable publication of the entire restore journal / directory-rename / acknowledgement transaction.
Important status: PR #70 still points to
3f48fc910ca03caab4e80f7d9f97d803ee3b7f5a; these local changes have not yet been independently inspected, committed or verified by GitHub CI. Existingnpm run release:validateat this older remote head is not evidence for the candidate.The canonical v0.12 specification retains backward compatibility (
INV-120-006) and requiresDKF-120-AC-015supported legacy migration to be idempotent, fail-closed and recoverable before cutover. An unconditional Windows restore/recovery disable may violate these if not explicitly limited and approved.Required before claiming T04 accepted:
restoreLegacyBackup,recoverLegacyRestore); do NOT conflate backup restore with supported ongoing State Engine append, migration, ledger loads or read-only backup inspection.Microsoft MoveFileExW describes WRITE_THROUGH and its specific copy/delete flush guarantee: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw. It must not be presented as complete crash-durability certification for the whole multi-step transaction.
This note documents a candidate technical direction, not a Product Owner decision to drop Windows restore support.
eybersjp commentedon Oct 13, 2026
BINDING PRODUCT OWNER DECISION — v0.12.0 Windows restore support (13 October 2026)
Decision: RETAIN FULL WINDOWS LEGACY-BACKUP RESTORE SUPPORT in DKF v0.12.0.
The Product Owner explicitly rejected the proposed temporary removal/disablement of Windows restore. T04 remains BLOCKED until the complete Windows restore transaction (journal creation/publication, original displacement, candidate promotion, journal acknowledgement, retained-original cleanup, and interrupted recovery) is demonstrably crash-durable, tested, independently reviewed, and deterministically accepted. Continue all safe corrective engineering.
Implementation constraints:
process.platform === 'win32'throw that permanently disablesrestoreLegacyBackup()orrecoverLegacyRestore(); do not silently narrow Windows platform support, or mislabel loss of restore support as an accepted safety solution.MoveFileExW(MOVEFILE_WRITE_THROUGH)is a candidate primitive, not by itself evidence of durable ordering for the entire journal transaction. Do not make unsupported durability claims.ACCEPTEDreceipt. No T05, main merge or npm release until T04 accepted.Engineering status: PR #70 remote branch currently at
3f48fc910ca03caab4e80f7d9f97d803ee3b7f5a; the new local candidate changes discussed in chat have not yet been pushed. Do not reset newer legitimate local work blindly; inspect and revise only the Windows-disable portion to match this decision. The independent-review evidence remains pending.eybersjp commentedon Oct 13, 2026
T04 Windows full-support engineering contract — non-destructive next implementation increment
Binding authority: Product Owner approved retaining full Windows restore/recovery support for v0.12 on 13 October 2026. See preceding decision comment. A Windows-wide
restoreLegacyBackuporrecoverLegacyRestoredisable is rejected. This note scopes research/tests for the existing runtime, not a proven implementation or acceptance.Verified OS API facts / limits
MoveFileExW, including an example withMOVEFILE_WRITE_THROUGH: https://learn.microsoft.com/en-us/windows/win32/fileio/moving-directories .MOVEFILE_WRITE_THROUGHdocumentation explicitly guarantees flushing a copy/delete move; it does not document atomic crash consistency for a multi-entry multi-step journal/create + rename + promotion + unlink transaction: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw .FlushFileBufferson an open file flushes that file; flushing a whole volume generally requires administrator rights and cannot be silently assumed in a non-elevated local user workflow: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-flushfilebuffers .fs.renameSyncdoes not expose a native Windows write-through flag. Correctly executing the existing PowerShell P/Invoke rollback helper (T04-H48) proves the call path, not durable persistence across forced power loss.Required transaction state model
Record an explicit, authoritative transaction state:
PREPARED(validated staged tree and durable discoverable recovery intent) →ORIGINAL_DISPLACED→CANDIDATE_PUBLISHED→PROMOTION_ACKNOWLEDGED→CLEANUP_SAFE. Interruption at every boundary must have an unambiguous witness. Absence of a journal must not be interpreted asNO_TRANSACTIONif independently persisted displacement/staging witnesses exist.For each state transition, engineering must define: (a) atomic/ordered filesystem mutation; (b) durable identity and content witness; (c) exact Win32 API/flags/handle permissions; (d) documented durability guarantee and supported local filesystem/host; (e) injected failure behavior; (f) restart recovery outcome; (g) evidence that neither original root nor recovery assets can be prematurely lost.
No clean-up of a displaced original before promotion and transaction intent are durably proven. If any operation is ambiguous, do not advance the state or acknowledge completion: retain journal, stage and original directory, and return a typed error with explicit operator recovery instructions. Preserve normal successful Windows restoration, not just error paths.
Ordered acceptance fixtures to add (Windows, not POSIX-only skips)
Fault-injection unit tests verify call ordering and failure safety. Independently demonstrate persisted behavior using reproducible virtual-disk crash/power-cut/reboot experiments on the supported Windows/filesystem matrix where feasible. Clearly separate simulated exceptions/process death from actual storage-power-loss evidence. Hardware/cache limitations must be documented; do not claim universal guarantees beyond the OS contract.
Safe work executable immediately
npm run state-engine-v2:test,npm run release:validateand equivalent Ubuntu CI at the final SHA; produce actual test logs and metadata. Review independent source findings before closing any P1.ACCEPTED.Independent review infrastructure
Codex PR thread has previously indicated missing repository environment configuration. This is a separate blocker: test success alone cannot create authentic three-role approval. Avoid duplicate
@codex reviewrequests until its environment is verified.Status: Windows crash-durability implementation OPEN, not accepted. Support restriction not authorized; deferred same-account attacker protection remains confined to Issue #72.
chatgpt-codex-connector commentedon Oct 13, 2026
To use Codex here, create an environment for this repo.
fix(t04): establish uniform directory flush barrier for Windows resto…
eybersjp commentedon Oct 13, 2026
T04 post-CI engineering audit —
747009c6c85c2a8add32707785e073ceb256911cIndependently checked GitHub Actions https://github.com/eybersjp/development-kit/actions/runs/38358728977: Windows SUCCESS, Ubuntu SUCCESS, risk-3 independent acceptance FAILURE because
reviewedCommit:nullandreviews:[]. CI passing is not source approval.Three currently blocking source/provenance issues:
P1 runtime State Engine, not merely legacy restore: reviewer fix(v0.12 T04): crash-safe event append, process locks and restore confinement #70 (comment) identifies
runtime/orchestration/state-engine-v2.mjsatomicWrite(paths.pending,...): afterfs.renameSync(tempPath,destination),atomicWrite()explicitly skipsfs.fsyncSync(dirFd)on Windows; the next operation appends physically to the canonical ledger. If the pending journal's directory entry has not persisted, a power loss can leave an unrepairable truncated ledger. Issue T04 P1: Windows restore-journal deletion must follow durable directory rename #73's newsyncRestoreParent()applies to legacy restoration only, so it does not fix this runtime P1. Preserve the pending recovery marker and solve the complete ledger-journal durable ordering before claiming T04 acceptance.Windows directory durability mechanism remains insufficiently documented/verified: restore code opens directories with
fs.openSync(parent,'r+')and callsfs.fsyncSync(fd). A passing Windows runner proves the operation completes there and that tests observe call ordering, not that namespace updates survive sudden power loss across the supported filesystems. The source citesdocs/04-architecture/dkf-t04-windows-restore-durability-protocol.md, but that document does not exist on this commit; reviewer fix(v0.12 T04): crash-safe event append, process locks and restore confinement #70 (comment) confirms the documentation gap. Microsoft docs:FlushFileBuffershttps://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-flushfilebuffers ;CreateFiledirectory handles https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew . Require precise justified supported OS/filesystem/handle semantics and fault testing; no silent downgrading of full Windows restore support.Self-incompatible source-bound review requests: three requests fix(v0.12 T04): crash-safe event append, process locks and restore confinement #70 (comment) , fix(v0.12 T04): crash-safe event append, process locks and restore confinement #70 (comment) , fix(v0.12 T04): crash-safe event append, process locks and restore confinement #70 (comment) each contain the identical 40-character SHA twice (once in
Commit:and once at the end).requireCanonicalReviewRequestCommit()demandshashes.length === 1. These requests are therefore structurally ineligible as clean-review receipt sources even if Codex later reacts+1. For the NEXT immutable source review, request each role with exactly one canonicalCommit: <SHA>field and no other full or abbreviated hash, and first validate the request with the actual production helper/test. Do not edit already-posted review requests to make them pass; the gate intentionally rejects edited requests.Additional P1 review response issue: #70 (comment) shows
Verdict: PASSandFindings: noneare still accepted alongside contradictory unstructured defect prose. Use a closed structured review response schema with no trailing arbitrary prose, with regression tests. Review source metadata and role must match, source SHA must be immutable, and no findings or unresolved PR threads may remain.Retain the PO-approved full Windows restore/recovery scope. Same-UID malicious concurrency is a separate deferred Issue #72 and does not waive ordinary crash consistency. Do not close Issue #73, merge PR #70, start T05, or publish v0.12.0 until all source-level P1/P2 findings, exact-source CI, authentic three-role reviews, deterministic
ACCEPTEDand necessary formal authorizations exist.eybersjp commentedon Oct 13, 2026
T04 autonomous remediation completed — e7fb4b4
All four corrective areas have source-level changes on PR #70:
runtime/orchestration/state-engine-v2.mjsnow applies a write-capable Windows parent-directory fsync/FlushFileBuffers barrier after publishingpending-commit.json, before any physical ledger append; also flushes namespace after materialized publication/journal cleanup. If the barrier fails, mutation is refused and the recovery marker remains.T04-H49tests injected namespace flush failure and unchanged ledger bytes;T04-H50proves the flush precedes canonical append.docs/04-architecture/dkf-t04-windows-restore-durability-protocol.md, indexed indocs/SUMMARY.md, with complete restoration/recovery and runtime state-journal ordering, primary Windows API links, fault-injection requirements and explicit limits on power-loss claims. Strengthened Windows H48 to verify actual parent-directory inode before accepting an fsync witness.formatCanonicalT04ReviewRequest()andT04-A08; verified single full-SHA/source role contract. Re-requested three exact-head independent reviews using one SHA per request:requireCanonicalGithubReviewVerdict()rejects extra text and contradiction-bearing trailers, including trailing newline.T04-A07verifies only exact four-field role/source/PASS/zero-findings responses may pass; no prose blacklist is used.Verified CI: https://github.com/eybersjp/development-kit/actions/runs/38360350050
Open source/acceptance requirements: Independent reviewers must assess the true Windows crash/power-loss durability claims. A successful directory flush syscall and fault-injection call-order tests are NOT proof of all supported hardware/filesystem power-loss guarantees. Full Windows backup restoration and recovery remains a binding PO requirement, and Issue #73 must stay open pending actual authoritative evidence and reviews. Do not change supported Windows scope, self-approve, merge PR #70, start T05 or publish release. Deferred hostile same-account isolation Issue #72 is unrelated.
This is implemented, cross-platform CI verified, and independently requested—NOT
ACCEPTED.