Skip to content

fix(fork): batch 13 server leftovers (stdin closed by Node, unknown playtest fields, neutral fork-ci names) - #962

Merged
scuttletoby merged 4 commits into
mainfrom
fork/batch13-server-leftovers
Nov 22, 2026
Merged

scuttletoby merged 4 commits into
mainfrom
fork/batch13-server-leftovers

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Small server and fork-tooling leftovers, one PR (batch 13).

Fixes #842
Part of #811
Fixes #872

#842: stdin that Node already closed

isClosedStdin matched only EPIPE. When Node has already seen the child exit it closes the child's stdin itself, and a later write fails with ERR_STREAM_DESTROYED or ERR_STREAM_PREMATURE_CLOSE. Both now count as a closed stdin.

Tests (processRunnerFork.closedStdin.test.ts), all failing on main:

  • a live test: spawn a real child, wait for its exit, then write its stdin (deterministically ERR_STREAM_PREMATURE_CLOSE here); the error counts as a closed stdin;
  • the runner with a child whose stdin fails with ERR_STREAM_DESTROYED ends with the child's exit code;
  • the code table gains both codes.

#811 item 2: unknown playtest settings fields

The settings-file read of playtest now decodes with onExcessProperty: "error" (as handoff and placement already do), so a field this build does not know, at the top or inside a step, reads as off with the existing warning, never as enabled without a newer build's limit. Two rows added to the existing "reads a bad value as off" test (failing on main). The go-live report reads the same decode, so its pinned row now expects such a value to read as off.

A save refuses such a field too: the server and project patches use a new strict PlaytestSettingsPatch (as handoff's HandoffSettingsPatch), so a newer client's limiting field is never dropped while the setting stays on. Test rows (a newer field, a typo, a newer field in a step; server and project patch) fail without it. docs/fork/README.md said such fields are dropped; it now says what happens, and warns about a downgrade (below).

Left: item 1 (the calling thread read twice per playtest call). As the issue recommends, it stays until McpToolAccess.ts (an upstream file) changes for another reason.

#872: neutral names in fork code

  • docs-scope README and tests, gradle-cache README and tests: one project's job, module, folder and file names replaced by neutral ones (core, core-module, plugins/alpha, plugins/beta, plugins/shared, RELEASE-NOTES.md, org.example:core). Renames only.
  • ci-demand README: keeps .github/fleet.json, the name the other fork-ci examples (fleet-route) use, and says the name is the project's choice.
  • Cleaner dedupe: the game's save-file kinds leave the built-in "written in place" list. A new machine-file key dedupe.writtenInPlace (name patterns without /, case-insensitive, KEY_KINDS keeps more) adds a program's own kinds. New test (failing on main) plus a red-check row for the new refusal.
  • It fails closed on upgrade: with dedupe.folders named and dedupe.writtenInPlace missing (a machine file older than this cleaner), the dedupe rule links nothing. Each folder is kept with could not read: dedupe.writtenInPlace is missing from the machine file ..., the run exits 1 (as for a missing zstd), and the other rules run. An explicit [] is the owner's word and links as before. Test (missing key: nothing linked, twice; listed kinds kept and the rest linked, then nothing new; [] links), failing on main, with two red-check rows.

Owner step, in this order: on a machine whose cleaner.dedupe section has folders, first add "writtenInPlace": [...] (the kinds a program there writes in place, for example its save files, or []), then install this cleaner. Until the new cleaner is in, the older one refuses the machine file (unknown key 'writtenInPlace'): every rule stops and every daily run exits 2, nothing is touched. The other order is safe too: the new cleaner links nothing and exits 1 until the key is added. The cleaner README's "What happens when ..." now says both.

Not in this PR: #817

packages/contracts/src/orchestratorMcp.ts and apps/server/src/mcp/OrchestratorMcpService.ts are both pending files in .github/fork-seams.json, which take no new fork line, and neither has a seat these fields could use. The seam steps in docs/fork/updates.md need a list-only PR (move the files to seam entries and announce the lines) merged first, then the change.

Review fixes (lens reports on 84616c7)

  • blocker, forkReport.test.ts pinned playtest as on for an unknown key: fixed, expects off (playtest: two small leftovers from the #809 lens (double caller read, unknown settings fields) #811).
  • major, dedupe fails open on upgrade: fixed, fails closed (above), README entries and upgrade order.
  • minor, a save drops an unknown playtest field: fixed, strict patches (above).
  • minor, after a downgrade a newer build's playtest value reads as off and the next save writes the default over it: known, deferred. Keeping it needs what reviewRules does (an unreadable copy in the setting's type, sent back by clients, checked by the server against the stored text), which touches PlaytestService, the web editor and the shared patch merge: too wide for this PR. Documented in docs/fork/README.md (copy the value before moving back).
  • minor, an "core-module" comment typo in docs-scope.test.py: fixed.

Follow-up (not in this PR)

  • Project-looking names still in fork-ci: the engine job in fleet-route/fleet-watch (README and tests) and the check names in pr-queue/testdata/lens-corpus.jsonl.
  • The dedupe test's *.mca example kind (a neutral one such as *.sav would do).
  • Playtest value kept across a downgrade (above).

Checks

  • vp run check:changed: format, lint, knip, typecheck (43 packages) pass; tests 108 of 109 pass. The one failure is forkReport.test.ts "exits 0 only when the running server says it is quiet": it serves on 127.0.0.1, which this machine blocks (unreachable). CI runs it.
  • Every test file that mentions playtest (grep): contracts playtest, forkSettings, handoff (47) and shared forkSettingsPatch (70) pass; web playtestSettings.logic, forkRowReset.logic, forkProjectOverrides (20) pass; server: 13 of 15 files pass; forkReport.test.ts passes apart from the local-socket test above (71 of 72 in the file). mcpT3ToolFilter.test.ts fails all its tests with a connect timeout to its own 127.0.0.1 server (blocked here), and ForkPanels.browser.test.tsx cannot start Chromium here (missing libnspr4.so). CI runs both. fork-kit/golive/tests/rehearse.test.py OK.
  • Cleaner: dedupe.test.py 84 OK (red check included), engine, daily, guard, install, report OK; common/tests/machine_file.test.py and agent-guards/tests/config.test.py (they load machine.example.json) OK. compress.test.py fails here because zstd is not installed, the same as on main. scratch.test.py fails 1 or 2 timing tests on some runs, on main too; this PR does not touch it.
  • docs-scope.test.py (86) OK. gradle_cache.test.py: 42 OK, 1 error in test_the_token_is_never_sent_on_a_redirect (a 127.0.0.1 server, blocked here; the test is unchanged). CI runs it.
  • processRunnerFork.closedStdin.test.ts (6) pass.

🤖 Generated with Claude Code

…k-ci names, dedupe kinds in config

- processRunner: a write to a child's stdin that Node already closed
  (ERR_STREAM_DESTROYED, ERR_STREAM_PREMATURE_CLOSE) counts as a closed
  stdin, like EPIPE; tested with a write after a real child exited.
- playtest settings: a field this build does not know (also in a step)
  reads as off when the settings file is read, so a newer build's limit
  is never dropped quietly.
- docs-scope and gradle-cache READMEs and tests use neutral names;
  ci-demand says which config name its examples use.
- cleaner dedupe: one game's save-file kinds move from the code to the
  machine file (dedupe.writtenInPlace, a "keeps more" key).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: state · reviewer: lens agent · read at: 84616c7
verdict: not safe to merge
covered: the full diff; issues #842, #811 (both items), #872 (all three points); cleaner config.py, dedupe.py, guard.matches, common/machine_file.fields, the cleaner README dedupe section; contracts playtest.ts and where its settings decode is used (forkSettings.ts, the web playtest editor); processRunnerFork.ts
checks: ran dedupe.test.py (83 OK, red check included), engine.test.py (55 OK), contracts playtest.test.ts (19 pass), processRunnerFork.closedStdin.test.ts (6 pass, 5 runs in a row). The new dedupe test fails on main's config.py and dedupe.py (older cleaner: unknown key 'writtenInPlace'). Removing onExcessProperty: "error" turns the playtest test red; removing the two new stdin codes turns 3 stdin tests red. Scratch scenario on this head (a copy of dedupe.test.py, not in the PR): a dedupe folder with world/region/r.0.0.mca and an identical backup/region/r.0.0.mca, machine file without the new key.
state: existing machine file without writtenInPlace + this cleaner: the save-file kinds are no longer refused. The scratch run linked the two .mca files (exit 0, linked ... now a hard link of ...), and a write into the world's file changed the backup. Adding the key afterwards does not undo it: the next plan names neither file, exits 0, and they stay one file. Older cleaner + the new key: machine_file.fields refuses the unknown key, so the whole cleaner section fails to load and every daily run exits 2 (fails closed, but every rule stops). Re-run and half-way stop: the link steps did not change. The cleaner never linked these kinds before, so no earlier run left links of them. Playtest: no field has left PlaytestSettings since it was added, and the web editor already saves with unknown fields refused, so no settings file a fork build wrote turns off. Only a hand-edited file with an extra key does.
blocker: none
major: dedupe fails open on upgrade (fork-kit/cleaner/lib/cleaner/dedupe.py:63, fork-kit/cleaner/lib/cleaner/config.py:248). *.mca, *.mcr and *.mcc leave the built-in refusal, and a missing writtenInPlace key defaults to (). So on any machine whose dedupe folders hold those files, installing this cleaner turns a refusal into a hard link with no warning. A later write into one copy then silently changes the others (shown above), and adding the key later neither repairs nor reports the links. The owner step exists only in the PR body: the README's "What happens when ..." (fork-kit/cleaner/README.md:726) has no entry for "the machine file is older than this cleaner". Fail closed instead. For example, make writtenInPlace required while dedupe.folders is non-empty, so an explicit [] is the owner's decision and an older dedupe section is refused with a message naming the key, or have only the dedupe rule plan nothing and say why. Add a test for an older dedupe section and a README entry for the upgrade order. A warning that recognizes these files would have to name the game again, against #872.
minor: the README's "the cleaner is older than the machine file" entry (fork-kit/cleaner/README.md:726) names only dedupe. Say that the new key, too, makes an older cleaner exit 2 on every daily run, so install first and add the key after.
minor: playtest (packages/contracts/src/playtest.ts:157): a hand-edited playtest value with any extra key now reads as off, with only a log warning. Examples: a comment key, or a misspelled timeoutSecond. The doc comment says the next settings save writes the default in its place, so the hand-written steps are then gone from the file. This fails closed as #811 asks. Consider naming the unknown key in the warning, and saying so in docs/fork/playtest.md.
minor: #842 and #811 item 2: the fix lines are proven by their tests; the live stdin test gets ERR_STREAM_PREMATURE_CLOSE on every run here. No finding.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: state · reviewer: lens agent · read at: 84616c7
verdict: not safe to merge
covered: the full diff; issues #842, #811 (both items), #872 (all three points); cleaner config.py, dedupe.py, guard.matches, common/machine_file.fields, the cleaner README dedupe section; contracts playtest.ts and where its settings decode is used (forkSettings.ts, the web playtest editor); processRunnerFork.ts
checks: ran dedupe.test.py (83 OK, red check included), engine.test.py (55 OK), contracts playtest.test.ts (19 pass), processRunnerFork.closedStdin.test.ts (6 pass, 5 runs in a row). The new dedupe test fails on main's config.py and dedupe.py (older cleaner: unknown key 'writtenInPlace'). Removing onExcessProperty: "error" turns the playtest test red; removing the two new stdin codes turns 3 stdin tests red. CI on this head: Test Server 5 fails at apps/server/src/golive/forkReport.test.ts:1085 (from the job's annotations; fork-ci-result has not run yet). Scratch scenario on this head (a copy of dedupe.test.py, not in the PR): a dedupe folder with world/region/r.0.0.mca and an identical backup/region/r.0.0.mca, machine file without the new key.
state: existing machine file without writtenInPlace + this cleaner: the save-file kinds are no longer refused. The scratch run linked the two .mca files (exit 0, linked ... now a hard link of ...), and a write into the world's file changed the backup. Adding the key afterwards does not undo it: the next plan names neither file, exits 0, and they stay one file. Older cleaner + the new key: machine_file.fields refuses the unknown key, so the whole cleaner section fails to load and every daily run exits 2 (fails closed, but every rule stops). Re-run and half-way stop: the link steps did not change. The cleaner never linked these kinds before, so no earlier run left links of them. The go-live fork report follows the same read: such a value now shows playtest off. Playtest: no field has left PlaytestSettings since it was added, and the web editor already saves with unknown fields refused, so no settings file a fork build wrote turns off. Only a hand-edited file with an extra key does.
blocker: none
major: dedupe fails open on upgrade (fork-kit/cleaner/lib/cleaner/dedupe.py:63, fork-kit/cleaner/lib/cleaner/config.py:248). *.mca, *.mcr and *.mcc leave the built-in refusal, and a missing writtenInPlace key defaults to (). So on any machine whose dedupe folders hold those files, installing this cleaner turns a refusal into a hard link with no warning. A later write into one copy then silently changes the others (shown above), and adding the key later neither repairs nor reports the links. The owner step exists only in the PR body: the README's "What happens when ..." (fork-kit/cleaner/README.md:726) has no entry for "the machine file is older than this cleaner". Fail closed instead. For example, make writtenInPlace required while dedupe.folders is non-empty, so an explicit [] is the owner's decision and an older dedupe section is refused with a message naming the key, or have only the dedupe rule plan nothing and say why. Add a test for an older dedupe section and a README entry for the upgrade order. A warning that recognizes these files would have to name the game again, against #872.
major: this head fails CI. apps/server/src/golive/forkReport.test.ts:1084-1086 pins the old behavior ("playtest with a key this build does not know stays on"): expected [] to deeply equal [ 'playtest' ] in Test Server 5. The go-live report reads the same settings decode, so after this change it reports playtest off for such a file. That matches #811, so the pinned row should now expect [] and say why. The PR body's "tests: pass" did not cover this file.
minor: the README's "the cleaner is older than the machine file" entry (fork-kit/cleaner/README.md:726) names only dedupe. Say that the new key, too, makes an older cleaner exit 2 on every daily run, so install first and add the key after.
minor: playtest (packages/contracts/src/playtest.ts:157): a hand-edited playtest value with any extra key now reads as off, with only a log warning. Examples: a comment key, or a misspelled timeoutSecond. The doc comment says the next settings save writes the default in its place, so the hand-written steps are then gone from the file. This fails closed as #811 asks. Consider naming the unknown key in the warning, and saying so in docs/fork/playtest.md.
minor: #842 and #811 item 2: the fix lines are proven by their tests; the live stdin test gets ERR_STREAM_PREMATURE_CLOSE on every run here. No finding.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: merge-path · reviewer: lens agent (Claude Code) · read at: 84616c7
verdict: safe to merge
covered: the full diff (13 files), issues #842, #811 and #872 with their comments, the PR body; .github/fork-seams.json and fork-seam-check.cjs (which files count as fork files); the isClosedStdin call site in apps/server/src/processRunner.ts; the cleaner's install and key-order docs; fork-ci/RELEASE-NOTES.md.
checks: ran docs-scope.test.py (86 OK), cleaner dedupe.test.py (83 OK, with the red check and the new mutation kinds the machine file names), engine.test.py (55 OK, KEY_KINDS shape), gradle_cache.test.py (42 OK, 1 error: test_the_token_is_never_sent_on_a_redirect times out on its local HTTP server, as the PR body says; the PR does not touch that test or gradle_cache.py), processRunnerFork.closedStdin.test.ts (6 passed), contracts/src/playtest.test.ts (19 passed). I compared the removed and added lines of both fork-ci test files: 83/83 and 68/68 lines, each pair the same apart from the renamed names. So they only rename.
state: the cleaner with an older machine file (no writtenInPlace) reads an empty list and no longer refuses *.mca/*.mcr/*.mcc in dedupe folders. An older cleaner that meets the new key exits 2 and touches nothing (fails closed). A run that stops half-way is unchanged (the refusal is checked per file before any link). A playtest value from a newer build now reads as off with a warning, and the next save writes the default.
blocker: none
major: none
minor: fork-kit/cleaner/lib/cleaner/dedupe.py:63: the built-in refusal list loses *.mca, *.mcr and *.mcc. A machine that installs a later ci-release cleaner without also adding dedupe.writtenInPlace will link those files in its dedupe folders, which it refused before. The only upgrade step is in the PR body, which says to add the key "once this cleaner is installed": until then, the daily runs link them. fork-kit has no release notes, and the README (fork-kit/cleaner/README.md:621, :726) does not say the default list got shorter. Suggest one README line in the dedupe section: since this release region files are not refused by default, so add writtenInPlace before or together with the install. An older cleaner refuses the key and touches nothing, so adding it first is the order that fails closed.
minor: packages/contracts/src/playtest.ts:157: on a downgrade, a newer build's playtest value now reads as off, as #811 asks. But the next save replaces it with the default (packages/contracts/src/playtest.ts:146), so moving back up loses the adapter settings, not only the newer field. This is the documented behaviour for a bad value. One sentence in the doc comment or the settings docs would warn a person who downgrades.
notes: the fork-ci changes are only README and test renames (docs-scope, gradle-cache), plus one README sentence in ci-demand. No action.yml or script changed. ci_demand.py has no default config name (it needs --config or --repo). So a released consumer behaves the same after the next ci/vN, and no RELEASE-NOTES.md entry is needed. The isClosedStdin change only drops the stdin error at processRunner.ts:333: the child's exit code and output still decide the result, as with EPIPE before. Seams: every changed path is a fork file (fork-ci/, fork-kit/, apps/server/src/fork/, and packages/contracts/src/playtest* in forkFiles). No upstream file and no .github workflow, gate or ruleset is touched. Nothing personal in the diff.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: merge-path · reviewer: lens agent (Claude Code) · read at: 84616c7
verdict: not safe to merge
covered: the same read as my earlier report on this head, plus the Fork tests run for this head (Test Server 5 and fork-ci-result) and apps/server/src/golive/forkReport.test.ts. This report replaces the earlier one, which missed the failing test below.
checks: reran vp test run src/golive/forkReport.test.ts -t "playtest when on" at this head: 1 failed (expected [] to deeply equal [ 'playtest' ], forkReport.test.ts:1085), as in CI. The earlier checks stand: docs-scope 86 OK; cleaner dedupe 83 OK (red check included) and engine 55 OK; gradle_cache 42 OK plus 1 local-HTTP timeout the PR does not touch; processRunnerFork.closedStdin 6 passed; contracts playtest 19 passed. The two fork-ci test files only rename names (83/83 and 68/68 lines, each pair the same apart from the names).
state: an older machine file with no writtenInPlace gets an empty list, so dedupe no longer refuses *.mca/*.mcr/*.mcc. An older cleaner that meets the key exits 2 and touches nothing. A playtest value from a newer build now reads as off with a warning, and the next save writes the default.
blocker: none
major: the head fails Fork tests. apps/server/src/golive/forkReport.test.ts:1084-1087 still pins the old behaviour (Pinned: playtest with a key this build does not know stays on, expecting ["playtest"]). The go-live report decodes settings with the load's schema, so it now says []. That agrees with the load and with #811, so the pin is stale, not the code. Flip it to [] and reword its comment. The PR body says check:changed passed, but that run did not include this test file.
minor: fork-kit/cleaner/lib/cleaner/dedupe.py:63: the built-in refusal list loses *.mca, *.mcr and *.mcc. A machine that installs a later ci-release cleaner links those files in its dedupe folders until dedupe.writtenInPlace is added. The PR body says to add the key "once this cleaner is installed", and that order leaves a window until the next daily run. fork-kit has no release notes, and fork-kit/cleaner/README.md (:621, :726) does not say the default list got shorter. Suggest one README line: add the key before or with the install. An older cleaner refuses the key and touches nothing, so adding it first fails closed.
minor: packages/contracts/src/playtest.ts:157: on a downgrade, a newer build's playtest value reads as off, as #811 asks, but the next save replaces it with the default (doc comment at :146). Moving back up then loses the adapter settings, not only the newer field. One sentence there or in the settings docs would warn a person who downgrades.
notes: the fork-ci changes are only README and test renames (docs-scope, gradle-cache), plus one README sentence in ci-demand. No action.yml or script changed, and ci_demand.py has no default config name. So a released consumer behaves the same after the next ci/vN, and no RELEASE-NOTES entry is needed. isClosedStdin only drops the stdin error at processRunner.ts:333: the child's exit code and output still decide the result. Every changed path is a fork file (fork-ci/, fork-kit/, apps/server/src/fork/, and packages/contracts/src/playtest* in forkFiles). No upstream file and no workflow, gate or ruleset is touched, and nothing personal is in the diff.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent · read at: 84616c7
verdict: not safe to merge
covered: the full diff against main (13 files); issues #842, #872 and #811 with their comments; processRunner.ts around the stdin write; the playtest settings-file and patch schemas (forkSettings.ts, handoff.ts for comparison); the cleaner's config.py, dedupe.py, guard.matches and README "What happens when"; leftover project names across fork-ci.
checks: ran the changed test files on the head: processRunnerFork.closedStdin.test.ts 6/6, contracts playtest.test.ts 19/19, cleaner dedupe.test.py 83 OK (red check included), docs-scope.test.py 86 OK, gradle_cache.test.py 42 OK + 1 error in test_the_token_is_never_sent_on_a_redirect (a 127.0.0.1 server times out in this sandbox; the same error with main's copy of the test, so not from this PR). Put main's processRunnerFork.ts back: 3 of the 6 fail (the new runner test, the live test, the code-table test). Put main's playtest.ts back: the bad-value test fails on the new top-level row; on the head the nested row (an extra field inside claim) also reads as off, so nested fields are caught. The new dedupe test fails on main (main refuses the unknown key), and the new red-check row covers the changed match line.
state: stdin: no state; the write is caught only for the three closed-pipe codes and the result still carries the child's own exit code. Playtest: a file value with a field this build does not know reads as off with the warning, and the next save writes the default in its place, as for any bad value. Cleaner: a new machine file on an older cleaner is refused (exit 2, fail closed); an old machine file on this cleaner has no writtenInPlace, so region files that the built-in list used to refuse can be linked from the first daily run after install (the major below). A second run plans from the disk again; nothing is cached across the change.
blocker: none
major: fork-kit/cleaner/lib/cleaner/dedupe.py:63 drops *.mca, *.mcr, *.mcc from IN_PLACE, so installing this cleaner takes that refusal away on every machine whose machine file has no dedupe.writtenInPlace. The step to add the key is only in the PR body, and it says to add it "once this cleaner is installed", which leaves daily runs in between. The README's "What happens when" list (fork-kit/cleaner/README.md:725-727) says nothing about it. On a hard-linking rule, a save file linked to another copy shares every later write. Fix: add a "What happens when" line, for example "the machine file is older and has no writtenInPlace: kinds the built-in list no longer has are linked like any file", with an order that leaves no gap: add the key in the same step as the install, before the next daily run, or hold the timer until it is in.
minor: #811 item 2 is closed only for reading the file. A save still drops an unknown playtest field: the server patch (packages/contracts/src/forkSettings.ts:170) and the project patch (forkSettings.ts:336) use plain PlaytestSettings, so a newer client's limiting field is removed on save and the setting stays enabled. Handoff refuses this with a strict patch (handoff.ts HandoffSettingsPatch). A follow-up should do the same for playtest.
minor: fork-ci/actions/docs-scope/docs-scope.test.py:625, comment reads an "core-module", should read a "core-module" (left over from the rename).
minor: outside #872's three files, names that look like one project's remain in fork-ci: job engine in fleet-route/README.md:200, fleet_route.test.py:209 and fleet_watch.test.py:31,215, and check names in pr-queue/testdata/lens-corpus.jsonl (skyengine, livelike, pluginplatform). The new dedupe test also uses *.mca as its example kind; a neutral one such as *.sav would do. All of these are for a follow-up, not this PR.

Checked and fine: #842 has both points (all three codes matched; a live test writes after a real child exited). Treating ERR_STREAM_DESTROYED and ERR_STREAM_PREMATURE_CLOSE as a closed stdin hides no real write error. Node only gives those codes once the child's stdin is gone: it is destroyed when the child exits, or after an earlier stream error, which surfaces first. An interrupt or timeout is not an error, so the catch does not see it. The runner still waits for the exit code and returns it. ci-demand: .github/fleet.json now matches fleet-route and fleet-watch, and the README says the name is the project's choice. The docs-scope and gradle-cache READMEs and tests: what was replaced is renames only, and no project paths are left in the new names. writtenInPlace: rejects a /, an empty value, .., a non-text entry and a value that is not a list; matching ignores case; KEY_KINDS lists it as keeps more, which is right.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent · read at: 84616c7
verdict: not safe to merge
This replaces my earlier code-lens comment on this head, which missed the blocker below; its other findings stand as written here.
covered: the full diff against main (13 files); issues #842, #872 and #811 with their comments; processRunner.ts around the stdin write; the playtest settings-file and patch schemas (forkSettings.ts, handoff.ts for comparison); the cleaner's config.py, dedupe.py, guard.matches and README "What happens when"; leftover project names across fork-ci.
checks: read the head's CI run (Test Server 5 and fork-ci-result fail, see the blocker); ran the changed test files on the head: processRunnerFork.closedStdin.test.ts 6/6, contracts playtest.test.ts 19/19, cleaner dedupe.test.py 83 OK (red check included), docs-scope.test.py 86 OK, gradle_cache.test.py 42 OK + 1 error in test_the_token_is_never_sent_on_a_redirect (a 127.0.0.1 server times out in this sandbox; the same error with main's copy of the test, so not from this PR). Put main's processRunnerFork.ts back: 3 of the 6 fail (the new runner test, the live test, the code-table test). Put main's playtest.ts back: the bad-value test fails on the new top-level row; on the head the nested row (an extra field inside claim) also reads as off, so nested fields are caught. The new dedupe test fails on main (main refuses the unknown key), and the new red-check row covers the changed match line.
state: stdin: no state; the write is caught only for the three closed-pipe codes and the result still carries the child's own exit code. Playtest: a file value with a field this build does not know reads as off with the warning, and the next save writes the default in its place, as for any bad value. Cleaner: a new machine file on an older cleaner is refused (exit 2, fail closed); an old machine file on this cleaner has no writtenInPlace, so region files that the built-in list used to refuse can be linked from the first daily run after install (the major below). A second run plans from the disk again; nothing is cached across the change.
blocker: apps/server/src/golive/forkReport.test.ts:1084-1086 still pins the old reading: a playtest value with a key this build does not know is expected to stay on. With the fail-closed decode the report now reads it as off, as the load does, so this assertion fails. Test Server 5 fails on it in CI (expected [] to deeply equal [ 'playtest' ]), and so does fork-ci-result. The PR body says check:changed passed, but this test fails on this head. Fix: flip the pin to expect off, and change its comment to say why: an unknown key is a newer build's limit, so it reads as off.
major: fork-kit/cleaner/lib/cleaner/dedupe.py:63 drops *.mca, *.mcr, *.mcc from IN_PLACE, so installing this cleaner takes that refusal away on every machine whose machine file has no dedupe.writtenInPlace. The step to add the key is only in the PR body, and it says to add it "once this cleaner is installed", which leaves daily runs in between. The README's "What happens when" list (fork-kit/cleaner/README.md:725-727) says nothing about it. On a hard-linking rule, a save file linked to another copy shares every later write. Fix: add a "What happens when" line, for example "the machine file is older and has no writtenInPlace: kinds the built-in list no longer has are linked like any file", with an order that leaves no gap: add the key in the same step as the install, before the next daily run, or hold the timer until it is in.
minor: #811 item 2 is closed only for reading the file. A save still drops an unknown playtest field: the server patch (packages/contracts/src/forkSettings.ts:170) and the project patch (forkSettings.ts:336) use plain PlaytestSettings, so a newer client's limiting field is removed on save and the setting stays enabled. Handoff refuses this with a strict patch (handoff.ts HandoffSettingsPatch). A follow-up should do the same for playtest.
minor: fork-ci/actions/docs-scope/docs-scope.test.py:625, comment reads an "core-module", should read a "core-module" (left over from the rename).
minor: outside #872's three files, names that look like one project's remain in fork-ci: job engine in fleet-route/README.md:200, fleet_route.test.py:209 and fleet_watch.test.py:31,215, and check names in pr-queue/testdata/lens-corpus.jsonl (skyengine, livelike, pluginplatform). The new dedupe test also uses *.mca as its example kind; a neutral one such as *.sav would do. All of these are for a follow-up, not this PR.

Checked and fine: #842 has both points (all three codes matched; a live test writes after a real child exited). Treating ERR_STREAM_DESTROYED and ERR_STREAM_PREMATURE_CLOSE as a closed stdin hides no real write error. Node only gives those codes once the child's stdin is gone: it is destroyed when the child exits, or after an earlier stream error, which surfaces first. An interrupt or timeout is not an error, so the catch does not see it. The runner still waits for the exit code and returns it. ci-demand: .github/fleet.json now matches fleet-route and fleet-watch, and the README says the name is the project's choice. The docs-scope and gradle-cache READMEs and tests: what was replaced is renames only, and no project paths are left in the new names. writtenInPlace: rejects a /, an empty value, .., a non-text entry and a value that is not a list; matching ignores case; KEY_KINDS lists it as keeps more, which is right.

🤖 Generated with Claude Code

scuttletoby and others added 2 commits November 22, 2026 15:40
…t saves

- cleaner dedupe: a machine file with dedupe folders but no
  `dedupe.writtenInPlace` (older than this cleaner) links nothing; each
  folder is kept with "could not read" naming the key (exit 1), the other
  rules run. An explicit [] links as before. README: the upgrade order
  and what an older cleaner does with the new key.
- playtest: the server and project save patches refuse a field this
  build does not know (as handoff's do), instead of dropping it.
- go-live report test: a playtest value with an unknown key now reads
  as off, as the load does.
- docs: playtest's unknown-field and downgrade behaviour; a typo in the
  docs-scope test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: state r2 · reviewer: lens agent · read at: 0049d6d
verdict: safe to merge
covered: the fix commit since round 1 (0049d6d, 11 files: cleaner config.py, dedupe.py, README "What happens when ...", dedupe.test.py, machine.example.json; contracts playtest.ts, forkSettings.ts, playtest.test.ts; forkReport.test.ts; docs/fork/README.md; the docs-scope typo), the round-1 lens comments and the PR body's per-finding status. The rest of the diff since 84616c7 is main merged in (the review kit, #960), not this PR's change. Also read: machine_file.fields (a missing key with a None default), every reader of cfg.dedupe_in_place (only _name_refusal, reached only through plan_dedupe and recheck of a planned item), KEY_KINDS, handoff's strict patch for comparison.
checks: cleaner dedupe.test.py 84 OK (red check included, with both new rows), engine.test.py 55 OK, daily.test.py 20 OK, common machine_file.test.py 27 OK, agent-guards config.test.py 15 OK (both load machine.example.json). Put the pre-fix config.py and dedupe.py back: the new test fails (two.sav linked, exit 0 instead of 1). contracts playtest.test.ts 22 passed. Put the pre-fix forkSettings.ts back: the 3 new save rows fail. forkReport.test.ts 71 of 72 pass, and the playtest rows pass. The one failure is __fork-report --activity > exits 0 only when the running server says it is quiet, which serves on 127.0.0.1, and loopback is blocked here, so CI has to run it. docs-scope.test.py OK. I ran no other socket test. CI on this head was still pending when I read it.
state: the missing-key path fails closed every time. A machine file with dedupe folders and no writtenInPlace plans no dedupe item, keeps each folder as could not read, saves no cache and exits 1, and the other rules still run. A re-run does the same (the test runs it twice). A half-way stop leaves nothing to redo, because the rule only plans and keeps. Links an older cleaner made stay as they are, and the new code never touches them. An older cleaner refused *.mca/.mcr/.mcc itself, so it left no links of those kinds. An explicit [] links as before, and an explicit null is refused by the type check. Adding the key later links only the kinds it does not list, and a second run finds nothing new (tested). Both upgrade orders in the README are right. Older cleaner plus the new key: main's DEDUPE_SPEC has only folders, so machine_file.fields refuses writtenInPlace, every rule stops and the run exits 2, touching nothing. New cleaner without the key: it links nothing and exits 1. No other kit reads the cleaner section. Playtest: a save with an unknown field, at the top or in a step, is now refused for the server and the project patch, never dropped. The settings-file read and the go-live report both read such a value as off, and the pinned row now says so.
round 1, fixed: forkReport.test.ts expected playtest on for an unknown key; it now expects off, and the full file passes here apart from the loopback test.
round 1, fixed: dedupe failed open on upgrade without the key; it fails closed now, the test fails without the fix, and two red-check rows cover the dedupe.py and config.py lines.
round 1, fixed: a save dropped an unknown playtest field; strict PlaytestSettingsPatch (same shape as handoff's), and the test fails without it.
round 1, fixed: the README did not say an older cleaner exits 2 on the new key; the upgrade entry says it now.
round 1, deferred and documented: after a downgrade, the next save writes the default over a newer build's playtest value (docs/fork/README.md:269).
blocker: none
major: none
minor: follow-up: fork-kit/cleaner/lib/cleaner/config.py:283 still files dedupe.writtenInPlace as keeps more, and the module docstring says "no key takes a refusal away". A missing key is now a refusal, and adding [] lifts it, so the key also picks, like dedupe.folders. Only the documentation and the engine test read KEY_KINDS, so nothing acts on it wrongly.
minor: follow-up: with the key missing, a .cleaner-link part that a half-way stop of an earlier run left stays until the key is added. The README's "it stops half-way" entry says the next run removes it. This is harmless: the part is only another name of the kept file, and the duplicate is untouched. One clause in that entry would cover it.
minor: follow-up: packages/contracts/src/playtest.ts:179, the read-as-off warning does not name the unknown key (round 1 suggested it). A person who mistypes a field sees playtest off with no pointer to the field.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: merge-path r2 · reviewer: lens agent (Claude Code) · read at: 0049d6d
verdict: safe to merge
covered: the diff since 84616c7 (the fix commit 0049d6d; the merge of main d87671d brings only main's review-kit change, not in the PR diff), the full PR diff against main, the round-1 lens reports and the PR body's per-finding status. Read: cleaner/config.py (DEDUPE_SPEC, KEY_KINDS), cleaner/dedupe.py (plan_dedupe, the part handling, _name_refusal at plan and apply time), common/machine_file.fields, main's DEDUPE_SPEC (no writtenInPlace), the cleaner README "What happens when ...", contracts/playtest.ts and forkSettings.ts (both patch fields), docs/fork/README.md. Only the cleaner reads cleaner.dedupe (grep across fork-kit).
checks: ran dedupe.test.py (84 OK, red check included, with the 2 new mutations), and the cleaner's engine, guard, report, daily, install and common/machine_file tests (all OK); docs-scope.test.py OK; contracts playtest.test.ts (22 pass); server forkReport.test.ts with processRunnerFork.closedStdin.test.ts: 77 of 78 pass, the failure is "exits 0 only when the running server says it is quiet", which serves on 127.0.0.1 (blocked on this machine; CI runs it). Not run here for the same reason: gradle_cache.test.py's redirect test (unchanged by the PR). Tests fail without the fix: the new dedupe test on 84616c7's config.py and dedupe.py (3 failures: it links, exit 0); the 3 new playtest save rows with the patch fields set back to plain PlaytestSettings (3 failed); the forkReport pin passes only with the strict read. The branch is 2 commits behind main (#965, #966) and merges without a conflict.
state: an older machine file (folders named, no writtenInPlace) with this cleaner: plan_dedupe returns before the walk, every folder is kept with could not read: dedupe.writtenInPlace is missing ..., the run exits 1, the other rules run; a second run says the same and links nothing (tested twice). Files an older cleaner already linked stay as they were (it never linked the region kinds, which it refused); nothing is unlinked or changed. A run an older cleaner stopped half-way may leave a .cleaner-link part: with the key missing it stays as one more name of the same bytes until the key is added, then the next run handles it as before. An explicit [] links as before; listed kinds stay, the rest is linked once, then nothing new. Upgrade order in the README (fork-kit/cleaner/README.md:735) is right: the released cleaner's DEDUPE_SPEC has only folders, so with the key added first machine_file.fields refuses unknown key 'writtenInPlace', exit 2, nothing touched; the other order exits 1 and links nothing. Playtest: a save with a field this build does not know, at the top or in a step, is refused for the server and project patch (packages/contracts/src/playtest.ts:148), so it is never dropped while the setting stays on; the file read is the same strict check. Nothing new found in the fix: no workflow, gate, ruleset or upstream file is touched, no token or personal detail is in the diff.
blocker: none
major: none
round 1, fixed: forkReport.test.ts pinned playtest as on for an unknown key; it now expects off and passes.
round 1, fixed: dedupe failed open on upgrade; it now fails closed with the key missing, with a test that fails without the fix and two red-check rows.
round 1, fixed: a save dropped an unknown playtest field; the strict patch refuses it, tested for both patches.
round 1, fixed: the an "core-module" typo.
round 1, deferred and documented: a newer build's playtest value is overwritten by an older build's next save (docs/fork/README.md:265-270).
follow-up (minor): fork-kit/cleaner/lib/cleaner/config.py:283 still files dedupe.writtenInPlace as keeps more, and the README (fork-kit/cleaner/README.md:825) says only two keys free more. Adding the key where it was missing now turns linking on, so the comment there could say so ("picks" for its presence, "keeps more" for its entries).
follow-up (minor): fork-kit/cleaner/README.md:622 marks the key required; it is needed only while dedupe.folders is non-empty, and a missing key keeps the folders (exit 1) rather than refusing the machine file (exit 2). One word ("required with folders") would match the code.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code r2 · reviewer: lens agent (Claude Code) · read at: 0049d6d
verdict: safe to merge
covered: the round-1 lens reports on 84616c7 (code, state, merge-path), the PR body's review fixes, and the fix commit since 84616c7 without the merge of main (11 files): forkReport.test.ts, playtest.ts and forkSettings.ts (the strict save patch), playtest.test.ts, cleaner config.py and dedupe.py (the missing-key path), dedupe.test.py with its red-check rows, the cleaner README ("What happens when ...", the dedupe table), docs/fork/README.md, machine.example.json, the docs-scope comment fix. Also every reader of cfg.dedupe_in_place and cfg.dedupe_folders (dedupe.py, report.py) and machine_file.fields.
checks: cleaner dedupe.test.py 84 OK (red check included: both new rows, "an older machine file links nothing" and "a missing writtenInPlace is not []", turn the new test red), engine 55, report 35, daily 20, install 10 OK; common machine_file.test.py OK. Contracts playtest.test.ts and forkSettings.test.ts 29 pass, shared forkSettingsPatch.test.ts 70 pass, web playtestSettings.logic, forkRowReset.logic and forkProjectOverrides 20 pass. Put the plain PlaytestSettings back in the server and project patches: the 3 new save tests fail (the field from a newer build, the typo, the newer field in a step). Put the lenient settings-file decode back: the flipped forkReport.test.ts pin fails. forkReport.test.ts on this head: 71 of 72 pass; the one failure is "exits 0 only when the running server says it is quiet", a 127.0.0.1 socket test that cannot run here (loopback blocked); CI runs it. Not run here, also socket tests: mcpT3ToolFilter.test.ts, and the 127.0.0.1 redirect test in gradle_cache.test.py. docs-scope.test.py: 86 OK in 8 of 9 runs; one run reported 1 failure that I could not reproduce or name (this round changes only a comment in that file). CI on this head was still running when I posted.
state: playtest: a settings-file value with a field this build does not know reads as off with the warning, and a save with such a field, at the top or inside a step, is refused, so the field is never dropped while the setting stays on. A valid save decodes to the same value as before (the existing save tests pass). Cleaner, machine file with dedupe.folders and no writtenInPlace: the rule plans nothing and keeps each folder with could not read: dedupe.writtenInPlace is missing ..., exit 1, the other rules run (the test runs it twice: still nothing linked, still exit 1). Run again: the same, every run, until the key is there; then the listed kinds stay, the rest is linked once, and the next run links nothing. Stopped half-way by an older cleaner: a leftover part file stays until the key is added, because the rule returns before it walks the folders. That part is only another name of the file kept, so nothing is lost. Files an older cleaner already linked: it refused the game kinds itself, so none of those are linked, and the new cleaner unlinks nothing. An empty or missing dedupe section loads as before (no folders, the rule does nothing). Older cleaner with the new key: machine_file.fields refuses the unknown key, exit 2, nothing touched. So either upgrade order fails closed, as the README now says.
round 1, fixed: forkReport.test.ts pinned playtest as on for an unknown key; it now expects off, and the test fails with the old lenient decode.
round 1, fixed: dedupe linked game save files on upgrade when dedupe.writtenInPlace was missing; a missing key now links nothing (config.py:251, dedupe.py:468), with a test that fails without the fix and two red-check rows.
round 1, fixed: a save dropped an unknown playtest field; the server and project patches now use the strict PlaytestSettingsPatch (playtest.ts:148, forkSettings.ts:170 and :336), tested for both patches.
round 1, fixed: the docs-scope.test.py typo.
round 1, deferred and documented: after a downgrade, the older build's next save replaces a newer build's playtest value (docs/fork/README.md:269).
blocker: none
major: none
minor: follow-up: the dedupe table says dedupe.writtenInPlace is required (fork-kit/cleaner/README.md:622), but it is required only when dedupe.folders names a folder: without folders a missing key loads and the rule does nothing. Say "required with folders".
minor: follow-up: two "What happens when ..." entries next to each other give opposite orders (fork-kit/cleaner/README.md:733 "install this cleaner first, then add the key" for dedupe; :735 "add the key first, then install" for writtenInPlace). Each is right for its key, but a reader may take one for the other. Name the key in the first entry's last sentence.
minor: follow-up, as in the PR body: the older dedupe test still uses *.mca as its example kind (fork-kit/cleaner/tests/dedupe.test.py:725); the new one uses *.sav.

🤖 Generated with Claude Code

@scuttletoby
scuttletoby merged commit c7076af into main Nov 22, 2026
40 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

1 participant