Skip to content

fix(durability): synthesize strict SQL recovery and stale-owner conformance - #1395

Merged
drewstone merged 6 commits into
mainfrom
pro/sql-run-context/synthesis
Sep 25, 2026
Merged

drewstone merged 6 commits into
mainfrom
pro/sql-run-context/synthesis

Conversation

@drewstone

@drewstone drewstone commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Synthesis

  • [tool] Incumbent (feat/sql-run-context @ dd662902): main already carries its complete 24-test SQL kill/resume matrix through feat(durable): SQL-backed spawn journal, blob store, and run context #1381, its SQL stores, and the inotify measurement formalization recorded before docs(durability): final harden-vs-adopt verdict with the 119/119 evidence #1390. Retain those without duplicating or transplanting the implementation. Extend its per-worker exactly-once checks to the fenced-context harness: one original-key spawn and one done settlement per worker, plus unique root attempts and cursor sequences.
  • [tool] p1 (feat(durability): SQL run context for runGraph (tournament entrant P1) #1373 @ 74593a04, salvaged by feat(durability): salvage the fenced SQL run context from #1373 #1391): keep main's fenced SQL context, coordination log, provider harness, and SQL acknowledgement-loss cuts. Restore only the two retained-recovery guards from p1 that the salvage omitted. A persisted input with no admissions can enter initial admission using its original execution identity; existing admissions still require recovery of the original intent. This closes six never-dispatched recovery failures without adding another SQL implementation or changing main's subagent-session exports.
  • [tool] p2 ([Tournament p2] SQL run context for runGraph #1374 @ ffd6ddd0): require zero replacement-key escalation and forbid the in-doubt escape hatch in both SQL fixtures. Add the missing real-process SIGSTOP → lease takeover → SIGCONT case, asserting that the stale owner cannot publish or release its live successor. Existing live-owner rejection, same-process takeover after SIGKILL, and SQL acknowledgement-loss cuts are retained rather than duplicated. The new stopped-owner test already passes against main; it closes a coverage gap, not a newly discovered fencing defect.

Independent red/green evidence

[tool] Executed in GitHub Actions on Ubuntu 24.04.5, Node 22.23.2, pnpm 11.17.0, Vitest 4.1.11:

Full execution log

Check Observed result
Strict synthesis SQL-context tests against main's runtime implementation at 66d2caa4224c65e637da474a2a2867d785e0e319 RED: 26 passed, 6 failed; exit 1
Candidate sql-kill-resume.test.ts 24/24 passed
Candidate sql-run-context.test.ts 32/32 passed, including both process-ownership interleavings
Candidate sql-run-store.test.ts 5/5 passed
Candidate sql-context-stores.test.ts 3/3 passed
Combined SQL command 64/64 passed; 4 files passed
node scripts/run-durability-conformance.mjs 159/159 passed; 0 failed; 0 expected-fail

[tool] The six baseline failures are sql:spawned-child:after, sql:execution-input:after, sql:execution-admitted-intent:{before,after}, and sql:execution-admitted-environment:{before,after}. All return no-winner with retained work pending/unobservable on main. All are ordinary passing tests with the two guards restored; the six it.fails exemptions are removed. The conformance script also now propagates a failed test report as a nonzero shell exit.

Exact commands

pnpm install --frozen-lockfile

# Red baseline: same strict tests, replacing the only changed production file
# with its exact main version. The trap restores the candidate before green.
git show 66d2caa4224c65e637da474a2a2867d785e0e319:src/runtime/environment-provider.ts > /tmp/synthesis-main-provider.ts
cp src/runtime/environment-provider.ts /tmp/synthesis-candidate-provider.ts
trap 'cp /tmp/synthesis-candidate-provider.ts src/runtime/environment-provider.ts' EXIT
cp /tmp/synthesis-main-provider.ts src/runtime/environment-provider.ts
set +e
npx vitest run tests/durability/sql-run-context.test.ts
status=$?
set -e
echo "STRICT_MAIN_EXIT=$status"
test "$status" -eq 1
# The Actions step exits here; its trap restores the candidate.

# Subsequent Actions steps:
npx vitest run tests/durability/sql-kill-resume.test.ts tests/durability/sql-run-context.test.ts tests/durability/sql-run-store.test.ts tests/durability/sql-context-stores.test.ts
node scripts/run-durability-conformance.mjs
node -e 'const r = require("./conformance/durability/results.json"); console.log("SYNTHESIS_TOTALS=" + JSON.stringify(r.totals)); if (r.totals.failed !== 0) process.exitCode = 1'

Provenance and scope

[tool] This review found the requested synthesis branch already at 6556ebb027fe91b740bb7fddcce0381bbaf3a2d9, directly based on main 66d2caa4, with the candidate fix/tests and recorded evidence. It was reviewed and reused, not overwritten or claimed as newly authored. The independent execution above tested commit 8d97f9d8e6e11aec9b38adf8ff4e0fdeafdc118b, which adds only a temporary read-only CI workflow. Cleanup commit ce8085289099869d29ae4af6e56e8e3c41041add removes that workflow. GitHub comparison confirms the final tree has no file differences from the reviewed 6556ebb0 candidate; production code and tests are unchanged since the green run.

[tool] The file-journal path remains covered by the successful conformance run. No entrant branch was edited. Nothing was merged.

[not checked] These are independent OS-process/working-directory tests using SQLite and the retained test provider, not a deployment across separate physical hosts or an end-to-end proof against every external side-effect service. The broader repository CI is separate from the completed targeted evidence above.

@drewstone
drewstone marked this pull request as ready for review September 25, 2026 09:11
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

tangletools
tangletools previously approved these changes Sep 25, 2026

@tangletools tangletools left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Auto-approved drewstone PR — ce808528

This PR was opened by the trusted drewstone account.
No automated review runs on this PR. This approval rests on the rule above alone.

tangletools · auto-approval · reason: drewstone_author · 2026-09-25T09:16:46Z

Add the last strict assertion from tournament entrant p2's zero-replacement-key
contract: each spawned worker has exactly one settled event and it is done —
completeness alone could hide a duplicated settlement behind a Set. Verified
with the synthesis suite: 56/56 including the former known-gap windows.
tangletools
tangletools previously approved these changes Sep 25, 2026

@tangletools tangletools left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Auto-approved drewstone PR — 4dba2752

This PR was opened by the trusted drewstone account.
No automated review runs on this PR. This approval rests on the rule above alone.

tangletools · auto-approval · reason: drewstone_author · 2026-09-25T09:43:39Z

Resolved: CHANGELOG (main's 0.273.0 entries above the synthesis 0.273.1),
package.json (main's side, version 0.273.1), generated docs/fixtures/
api-surface regenerated. Re-verified post-merge: durability conformance
159/159, full suite 4,728 passed, lint/typecheck/docs gates green.

@tangletools tangletools left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Auto-approved drewstone PR — 2704a9c2

This PR was opened by the trusted drewstone account.
No automated review runs on this PR. This approval rests on the rule above alone.

tangletools · auto-approval · reason: drewstone_author · 2026-09-25T10:06:40Z

@drewstone
drewstone merged commit c03cec7 into main Sep 25, 2026
4 checks passed
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