Skip to content

timeline: pin that a widened directory-fsync tolerance and a swallowed file fsync still fail the write - #3314

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-timeline-sync-controls
Nov 23, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-timeline-sync-controls

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3311

Bot: FlyBot Dev-3
Owner: Dev-3
Written-by: Dev-3

What this adds

Three cases in plugins/timeline/test/store.test.js, in the same style the merged #3304 cases use: fs.fsyncSync is replaced for the duration of the case through syncBuiltinESMExports, refusing only the handles that case needs. No product file changes — the behaviour main ships is #3300's tolerance.

  • file EIO: a file fsync that fails still fails the write — flush() === false, stats().failing === true, exactly one warning carrying EIO, and the segment is not published;
  • directory EACCES: a directory fsync refused for a reason beyond the platform refusals (EPERM/EINVAL) still fails the write;
  • deferred lock: a retryLock trace adopts the lock once the live writer closes, writes its records once with the directory fsync refused, and a reopen reads them back (#3298 measured that hand-over never settling).

Red first (mutation)

At the tip, node --test plugins/timeline/test/store.test.js → 22/22. Each case is red under the mutation it exists for, and only that case:

mutation to plugins/timeline/src/store.js reading
the file fsyncSync wrapped in the same swallowing try 21/22 — not ok 20, a file fsync that fails with EIO still fails the write
noDirectoryFlush widened to ['EPERM', 'EINVAL', 'EACCES'] 21/22 — not ok 21, a directory fsync refused with EACCES is still a failed write
noDirectoryFlush emptied (the pre-#3300 shape) 18/22 — not ok 17, 18, 19, 22; the deferred case fails at false !== true, the adopted lock plus a refused directory sync still saves

The deferred case also has its red on the record from our #3304 branch: on 848bc314 (store.js with the directory fsync and no tolerance) the same assertion reads false !== true. Reproduced here by running this test file against that commit's store.js — red at plugins/timeline/test/store.test.js:407.

Verification at the tip

  • tip 5bb1486aa8cf8349692a8f4b7912f6c2ba2e29f3, tree ca25f53c437d5323cedd90330fe0c334d22d136f, base 9a48f5aa4bd49c8cae0d80fb4da3a74d02af0f99
  • node --test plugins/timeline/test/store.test.js → 22/22, rc 0
  • npm --prefix plugins/timeline test (with DSH_HARNESS at the DSH install) → 178/178, 0 fail, rc 0
  • node .github/scripts/changelog.mjs check → 0 fragments
  • ARCH_DOCS_BASE=9a48f5aa node scripts/check-arch-docs.mjs → OK (1 changed file(s))
  • Not run: plugin lint — oxlint is not installed on this box; CI runs it.

Docs-not-needed: tests only under plugins/timeline/test; no behaviour and no architecture change — the tolerance main ships is #3300's.

Checkpoint

{
  "pr": 3314,
  "claim": "Dev-3",
  "issue": 3311,
  "summary": "Adds the three cases our #3304 branch carried that the merged rewrite dropped: a file fsync that fails with EIO, a directory fsync refused with EACCES, and a deferred retryLock writer saving once after the live writer leaves with the directory fsync refused. Each is red under the product mutation it exists for. Tests only; no product file changes.",
  "files": ["plugins/timeline/test/store.test.js"],
  "checks": { "ran": "node --test plugins/timeline/test/store.test.js", "result": "green", "at": "5bb1486aa8cf8349692a8f4b7912f6c2ba2e29f3" },
  "next": "draft pending the FlyBot Test advisory at this tip; then ready and the verdict"
}

…wed file fsync trips

The merged ThinkFlowLab#3304 cases pin that a directory fsync refused with EPERM or EINVAL is
tolerated. Nothing pins the other side: a tolerance widened to every directory error,
or a file fsync read as the same refusal, would leave the suite green while a write
that never reached the disk is reported as saved.

Add three cases in the same monkey-patch style, each red under the one mutation it
exists for: a file fsync failing with EIO still fails the write; a directory fsync
refused with EACCES still fails the write; and a deferred retryLock trace adopts the
lock once the live writer closes, saves once with the directory fsync refused, and
reads its records back on reopen.

Fixes ThinkFlowLab#3311
Owner: Dev-3
Written-by: Dev-3
Bot: Dev-3
Docs-not-needed: tests only under plugins/timeline/test; no behaviour or architecture change (the tolerance main ships is ThinkFlowLab#3300's)
@HugoXK

HugoXK commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy — review request for this tip: 5bb1486aa8cf8349692a8f4b7912f6c2ba2e29f3.

T1 (tests only: plugins/timeline/test/store.test.js, 1 file +83/−0, plugins/timeline/src/store.js untouched), no UI face. The PR is draft on purpose — it goes ready once the QA advisory on this same tip lands. Checks at this tip: 14 success + 2 skipped (window check, live · ubuntu · Node 24 · real model) + 1 cancelled (agent-audience) + 1 failure (enqueue-guard — no Verifier report names 5bb1486a, which is what this request is for).

What it adds: the three controls that #3304 merged without — a file fsync failing with EIO still fails the write, a directory fsync failing with EACCES still fails it (so a widened noDirectoryFlush is caught), and a deferred retryLock trace adopts the lock and saves once while the directory fsync is refused. Same mechanism as the merged cases: fs.fsyncSync replaced for the duration of the case through syncBuiltinESMExports, refusing only the handle the case needs.

A Verdict: PASS or FAIL naming 5bb1486aa8cf8349692a8f4b7912f6c2ba2e29f3 is all I need.

@github-actions github-actions Bot added the risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff label Nov 23, 2026
@Birfy

Birfy commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Verdict: PASS at 5bb1486
Written-by: Reviewer
Attestation: 5bb1486 role=Reviewer

Judged tip: 5bb1486aa8cf8349692a8f4b7912f6c2ba2e29f3 (branch dev/3-timeline-sync-controls, base merge-base 9a48f5aa4bd4c8cae0d80fb4da3a74d02af0f99). The brief tip and the live head.sha agree, so this is the tip judged. Draft state left as the author set it; no label, draft/ready, merge or enqueue action taken.

Ran at this tip:

$ node --test plugins/timeline/test/store.test.js
# tests 22  # pass 22  # fail 0
$ npm --prefix plugins/timeline test
# tests 178  # pass 178  # fail 0
$ cmp base/plugins/timeline/src/store.js tip/plugins/timeline/src/store.js
# identical (0 differences)
$ diff -u base/plugins/timeline/test/store.test.js tip/plugins/timeline/test/store.test.js
# @@ -347,3 +347,86 @@ — 83 added, 0 removed

Scope: GET /pulls/3314/files returns exactly one file, plugins/timeline/test/store.test.js (+83/−0). plugins/timeline/src/store.js is byte-identical to the base blob (cmp above), and no file under patches/ds-bot/** is in the diff, so the mirror is untouched. No .github/**, policy/** or scripts/self-test-catalog.mjs file is touched, so no Policy-sign: is required and I did not write one. The diff is a pure append at the end of the file: nothing existing was relaxed, renamed or skipped (grep -c '\.skip|\.todo|only(' → 0), so the pre-existing 19 cases run unmodified.

Behaviour, not implementation — the three new cases:

  1. a file fsync that fails with EIO still fails the write (test/store.test.js:371) asserts flush() === false, stats().failing === true, exactly one warning matching /EIO/, the segment trace-000001.json absent, and the record still readable in memory. It patches only file handles (directory handles fall through to the real fsyncSync), restores the binding and calls syncBuiltinESMExports() in t.after.
  2. a directory fsync refused with EACCES is still a failed write (test/store.test.js:388) refuses directory handles with EACCES through the existing refuseDirectorySync helper, which also restores the binding in t.after; assertions are on flush(), stats().failing, the one warning carrying EACCES, and the in-memory records.
  3. a deferred writer takes the lock and saves once when the directory fsync is refused (test/store.test.js:407) asserts on the public surface only: stats().deferred before and after the live writer closes, flush() === false while the lock is held with the not writable yet warning, then flush() === true after adoption, exactly one file sync for the deferred records, stats().persist === true, no rewrite on the next flush, and a reopen reading [9000] back.

Red first — each mutation applied to a scratch copy of the tip, node --test plugins/timeline/test/store.test.js in each:

mutation to src/store.js (scratch copy) result cases red
file fsyncSync moved under the swallowing tolerance (temp-file sync error no longer reaches the caller) 21/22 only not ok 20 — the file-EIO case
noDirectoryFlush widened to ['EPERM','EINVAL','EACCES','EIO'] 21/22 only not ok 21 — the EACCES case
deferred trace stops re-asking for the lock (if (deferred && dirty) with no adopt()) 21/22 only not ok 22 — the deferred case
noDirectoryFlush emptied (pre-#3300 shape) 18/22 not ok 17, 18, 19, 22 — the three tolerance cases plus the deferred one, as expected for a mutation that removes the tolerance itself

One honesty note on the wording of mutation 1: I first spliced the file sync into the same try but kept if (!noDirectoryFlush.has(error?.code)) throw error, and that stayed 22/22 — correctly so, because that splice still rethrows EIO and changes no behaviour. The case only turns red when the file-sync error is actually swallowed as a tolerated refusal, which is the defect the case names; that shape gives not ok 20 alone (row 1). The assertions are on flush()/stats()/warning/segment presence, so they do not pin the try structure.

CI at this tip (GET /commits/5bb1486…/check-runs), read at start of this pass: 18 runs, all terminal. tests-ok success, merge-gate success, policy-sign success, risk tier (report only) success, plugins (tree), plugins (social), plugins (workflow), plugins (timeline) all success, package, judge, ubuntu-latest · Node 24 and mock success. The single failure is enqueue-guard (run 137421344369), which is the "no Verdict on this tip yet" gate and is expected to flip on this PASS. live · ubuntu · Node 24 · real model and window check are skipped (no live-model and no window/UI change here — not a cascade of a failure), and one agent-audience is cancelled next to an agent-audience success in the same run group, i.e. a superseded first attempt, not a lost signal.

Risk tier: T1 by the diff itself — one test file, no product code, no UI face, no gate file. That matches the author's claim.

Changelog: no fragment is required. AGENTS.md line 29 requires one only for a user-visible change; this is test-only and changes no shipped behaviour. policy/gates.json has no changelog key, and node .github/scripts/changelog.mjs check reporting 0 fragments is therefore fine here.

Not run: plugin lint (oxlint is not installed on this box) — CI covers it and is green at this tip.

@github-actions github-actions Bot added the pass label Nov 23, 2026
@Birfy
Birfy marked this pull request as ready for review November 23, 2026 06:38
@Birfy
Birfy added this pull request to the merge queue Nov 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 23, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 23, 2026
Merged via the queue into ThinkFlowLab:main with commit 99cd358 Nov 23, 2026
19 of 20 checks passed
@Birfy
Birfy deleted the dev/3-timeline-sync-controls branch November 23, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pass risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

timeline: pin that a widened directory-fsync tolerance and a swallowed file fsync still fail the write

2 participants