Skip to content

fix(nodes): agree on one node id, with test, README and quality follow-ups - #170

Merged
NSchatz merged 6 commits into
mainfrom
fix/followups
Nov 30, 2026
Merged

NSchatz merged 6 commits into
mainfrom
fix/followups

Conversation

@NSchatz

@NSchatz NSchatz commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

What

One commit per item.

  1. Two starts at once agree on a node id (src/engine/nodes.ts). resolveNodeId creates .pathways/node-id with an exclusive create and then writes the id. A second start that read the file between the two found it empty and ran under an unsaved id of its own (EEXIST). An empty file is now read again, 40 times 25 ms apart, until the id is in; a file left empty for good still gives the unsaved id with EEXIST. Changeset and README bullet.
  2. Test helpers in test/_helpers/. The twenty helper modules move out of the top of test/, with every import, module path and comment that names one.
  3. README layout. The package name as title, the four badges, the sections Why this exists, Status, Install, Usage in order, and a docs.cosyte.com link after Usage. Status names the release line (**The 0.0 line.**) where it named an exact version. test/readme.test.ts runs the shared README check in pnpm test; check:readme and check:catalog scripts; the release-status test and the version step's README sync now hold and rewrite the release line. Changeset.
  4. Windows temp folders on the work disk (vitest.config.ts). On a Windows runner, TEMP and TMP point at RUNNER_TEMP.
  5. Shared workflow reference moved to workflows-2026-11-29-8c4385954cad in every caller.
  6. Quality floors. quality-floor.json holds the coverage floor (99/99/100/99, the gate as it was) and vitest.config.ts reads it. @cosyte/vitest-config 0.1.8 (barrels measured), StrykerJS 10.1.1, stryker.config.mjs, vitest.mutation.config.ts, the quality:* and mutate* scripts, run-coverage-ratchet and run-mutation on, and weekly-mutation.yml (16 shards, twice a week). The testing page and the AGENTS.md gate say so.

Why

  1. Two engines started together raced on the file and could run as two nodes.
  2. Helpers go in test/_helpers/, so test/ holds test files.
  3. A reader from npm, GitHub or the docs site finds the same page in the same order, and an exact version in prose is stale after one release.
  4. Every Windows timeout in the last 100 CI runs was an in-process test making SQLite files in its temp project (store migrations, pathways migrate, operator commands, metrics, probes), not a test that starts a process. Measured on two runs of one commit, one per disk, those tests ran 3 to 15 times faster on the work disk (opens a database made at migration 0002: 375 ms on C:, 33 ms on D:; lists messages newest first: 764 ms against 74 ms), and the whole suite's test time fell 23% (plain) and 32% (coverage). No timeout was raised.
  5. The new reference changes only the shared release workflow: it tags the version commit after the pre-publish gates. The CI, CodeQL, dash, internal-reference, title and Scorecard workflows are the same at both references, so every job runs as before.
  6. Coverage of a change's own lines and its mutants were read in review only, and nothing measured a mutation score.

Proof

Run locally on Linux, Node 26, on the head commit:

  • pnpm typecheck, pnpm lint, pnpm format:check, pnpm phi-scan, pnpm build, pnpm attw, pnpm check:no-emdash, pnpm check:no-internal-refs, pnpm check:claude-card, pnpm check:docs-reference, pnpm check:readme, pnpm check:catalog: all pass.
  • pnpm test:coverage: 151 files pass, 4 skipped; 3081 tests pass. Lines 99.87, branches 99.13, functions 100, statements 99.82.
  • pnpm quality:check --base origin/main: OK, no uncovered changed line.
  • pnpm mutate changed --base origin/main, then pnpm quality:mutation --base origin/main: OK. 14 mutants on the changed lines of src/engine/nodes.ts, none surviving. One inline exception, listed by the ratchet: src/engine/nodes.ts:96, Stryker disable next-line ConditionalExpression: text read again later gives the same id (the mutant only re-reads a file that already holds text, which gives the same answer one second later).
  • Red before green:
    • Node id: the new test is the other start's id when that start has made the file and not yet written it failed on main with { from: "unsaved", code: "EEXIST" }, the reported symptom, and passes with the fix. The race test passed 30 of 30 runs after it.
    • README: test/readme.test.ts and the release-line test fail on the old README (cosyte-readme gave 5 findings: title, badges, no Usage, Install before Status, no docs link) and pass on the new one.
  • Windows: two dispatched CI runs of main, one with the temp folder on C: and one on D:, with every test's duration printed. Both passed; the per-test numbers in Why come from them. The test probes ran on branches that are deleted.
  • pnpm test:perf and the database, Docker, SFTP and object-store workflows are left to CI.

No second review is needed: nothing here changes the PHI scan, de-identification, or a shared release workflow (item 5 moves this repository's reference to a published one).

Choices

  • Node id: a bounded re-read of an empty file (up to 1 s) rather than writing through a temp file and a hard link, which some mounted file systems refuse.
  • Windows: the fix moves the temp folder rather than raising any timeout; it applies only where RUNNER_TEMP is set on Windows.
  • README: "What the latest release ships" and "In the next release" stay as sections of their own between Status and Install, which the shared check allows.
  • Quality floor: the coverage floor is the gate as it stood, not the measured numbers, because the floor binds Windows and macOS too, where some tests skip. No mutation floor is written yet: it is written from the first full weekly run's measured score.
  • Mutation: vitest.mutation.config.ts leaves out test/docs-content.test.ts and test/examples.test.ts, which read the repository around the code (git and the real node_modules) and fail in StrykerJS's sandbox before any mutant runs. disableTypeChecks is limited to src and test, so the starter and the examples, which tests compare byte for byte, are copied as they are.

Not in this pull request:

  • Properties through the shared runner and the nightly property run: all six remaining direct property calls are async, and @cosyte/test-utils has a synchronous runner only.
  • check:docs-content in the required job: the shared docs-content check takes an example to be one file at the top of examples/ with a page example-<name>.md; ours are project folders, so its 42 findings (35 of them the seven example pages read as tutorials) need either a change to that check or new page ids for published pages.
  • Coverage hints in the -- reason form were already done on main (no colon-form hint is left in src/).

Two starts at once with no node id: the second read the id file between the first one's exclusive create and its write, found it empty, and ran under an unsaved id of its own. An empty file is now read again, for up to a second, until the id is in.
The twenty helper modules (fakes, stores held in memory, project and network helpers) sat beside the test files. They now live in test/_helpers/, so test/ holds test files, and every import, module path and comment that names one follows it.
The README takes the package name as its title, the four badges, and the sections Why this exists, Status, Install and Usage in order, with the link to docs.cosyte.com/pathways after Usage. Its Status names the release line (**The `0.0` line.**) where it named an exact version, which went stale with every release.

test/readme.test.ts holds the README to the shared skeleton check in pnpm test, and check:readme and check:catalog run the same checks from the command line. The release-status test now requires the release line package.json is on and refuses an exact version named as the one on npm, and the version step's README sync rewrites the release line where it rewrote the version.
On a GitHub Actions Windows runner the system temp folder sits on the OS disk. Measured on two runs of the same commit, one per disk, a test that builds SQLite files in its temp project ran 3 to 15 times faster on the work disk (a store migrated from step 0002: 375 ms against 33 ms), and the suite's test time fell by a quarter. Every Windows timeout in the last hundred runs was such a test, not one that starts a process. The tests' TEMP and TMP now point at RUNNER_TEMP on Windows.
…85954cad

The new reference changes the shared release workflow only: it tags the version commit after the pre-publish gates, so a gate that refuses leaves no tag on a version that never shipped. The CI, CodeQL, dash, internal-reference, title and Scorecard workflows are the same at both references, so every job runs as before.
quality-floor.json holds the coverage floor, the gate as it was, and vitest.config.ts reads it. @cosyte/vitest-config 0.1.8 measures every source file but barrels. StrykerJS runs on the shared config (stryker.config.mjs, with the suite of vitest.mutation.config.ts), with the quality and mutate scripts. CI turns on the coverage-ratchet and mutation jobs, and weekly-mutation.yml runs a full mutation run twice a week; the floor gets a mutation score from its first run. The testing page and the gate in AGENTS.md say so.
@NSchatz
NSchatz merged commit 5d69112 into main Nov 30, 2026
42 checks passed
@NSchatz
NSchatz deleted the fix/followups branch November 30, 2026 05:34
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