Skip to content

fix(fork): cleaner dedupe and playtest round-2 follow-ups - #1026

Merged
scuttletoby merged 3 commits into
mainfrom
fix/971-cleaner-minors
Nov 22, 2026
Merged

scuttletoby merged 3 commits into
mainfrom
fix/971-cleaner-minors

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Round-2 follow-ups from #962: cleaner dedupe.writtenInPlace docs and key kind, and the playtest "read as off" warning.

What changed, per item

  • config.py labels dedupe.writtenInPlace "keeps more"; README says only two keys free more. The key is now picks in KEY_KINDS. Its patterns do keep more, but with the key missing nothing is linked, and [] turns linking on, so it also turns the rule on. The comment beside it says this. The README sentence now reads "Two keys take a refusal away" (layered, regenerable, the two loosens keys). "Free more" was ambiguous, because any picks key that turns a rule on also frees more. No test: KEY_KINDS is a table, and a test asserting one value would only copy it. The existing engine test still checks that every key is placed and that the loosens set is the same.
  • README marks writtenInPlace "required". The default column now says none. The paragraph that lists the in-place kinds now says that, while dedupe.folders names a folder and the key is missing, the rule links nothing and the run exits 1. A missing key does not make the cleaner refuse the machine file (exit 2).
  • Two adjacent README entries gave opposite install orders. They are now one "upgrading a machine" note. Install this cleaner first, then add dedupe or writtenInPlace. Until the key is added, the dedupe rule does nothing (no dedupe) or links nothing and exits 1 (no writtenInPlace), and the other rules still run. The other order stops every rule: an older cleaner refuses the unknown key, and every daily run exits 2 until the new cleaner is in.
  • A .cleaner-link part file stays while the key is missing. Fixed in the README and in the dedupe.py docstring, not in code. Removing the part on the refused path would mean walking folders the rule has just declined to read, only to drop one extra name of a file it keeps anyway. The half-way test (test_killed_between_the_link_and_the_rename_the_next_run_finishes) now pins the documented answer. With the key missing, a run exits 1 and every name, the part included, stays. With the key back, the next run removes the part and links. This assertion passes on main too, because it pins behaviour the docs now describe.
  • The playtest "read as off" warning does not name the unknown key. PlaytestSettingsFromSettingsFile now decodes to a Result and puts the schema issue in the warning, for example settings: invalid playtest settings read as off (Expected no excess property at ["claim"]["maxRuns"]); the next settings save replaces them. The test was shown failing first: expected 'settings: invalid playtest settings r…' to contain '["claim"]["maxRuns"]'. It passes with the fix. The settings guide (docs/fork/README.md, server.playtest) now says the warning names what is wrong.
  • The older dedupe test used *.mca as its example kind. It now uses *.sav, like the newer test, and still checks that matching ignores case (slot1.SAV).

Left

  • A downgrade overwrites a newer build's playtest value (deferred from round 1). Not small: fixing it needs a reviewRules-style keep mechanism across PlaytestService, the web editor and the shared patch merge. The workaround is already documented in docs/fork/README.md, server.playtest: copy the playtest value before moving back to an older build.

General vs project

  • General: everything in fork-kit/cleaner (key kind, README, docstring, tests). It names no machine, project or program, and the example kind is a generic *.sav. The playtest warning text is also general. It names whatever the schema reports.
  • Project: none. No upstream file changed, so .github/fork-seams.json is unchanged. packages/contracts/src/playtest* and docs/fork/ are fork files.

State question

What a cleaner run does in each case, as the README says:

  • Runs again: the names are one file already. Nothing new is done, and unchanged files are not read again (existing tests).
  • Stops half-way: a run killed between the link and the rename leaves the duplicate as it was, plus a .cleaner-link part that is one more name of the kept file. The next run that reads the folders removes that part (only one the cleaner wrote down that still has other names) and links again. With writtenInPlace missing, the rule reads no folder, so the part stays until the key is added. Both cases are pinned in the half-way test.
  • Old machine file: with no dedupe section, the rule does nothing. With a dedupe section but no writtenInPlace key, each folder is kept with could not read: dedupe.writtenInPlace is missing ..., nothing is linked, the run exits 1, and the other rules still run. With an empty list, [], every candidate that passes the built-in refusals is linked (test_an_older_machine_file_without_written_in_place_links_nothing).

Checks run

  • python3 -I -B fork-kit/cleaner/tests/dedupe.test.py: 84 OK. python3 -I -B fork-kit/cleaner/tests/engine.test.py: 55 OK.
  • vp test run src/playtest.test.ts in packages/contracts: 22 passed, after showing the new case red first.
  • doc_check.py --base origin/main: 2 files, 0 problems.
  • vp run check:changed: format, lint, knip, typecheck (43 packages), test all pass.

Round 1

Finding Fix Test
playtest.ts:185 warning kept the formatter's indent (three spaces) collapse every whitespace run to one space playtest.test.ts pins Expected no excess property at ["claim"]["maxRuns"] and no double space (red before the fix)
playtest.test.ts:213 nothing pinned that a bad value stays out of the warning test only a bad config with a --token=SECRETVALUE argument logs the warning without SECRETVALUE

The long-lines nit is dropped.

Fixes #971

🤖 Generated with Claude Code

- cleaner: dedupe.writtenInPlace is a 'picks' key (missing links nothing, [] turns
  linking on), not 'keeps more'; README: it has no default (missing gives exit 1, not
  a refused machine file), one upgrade note with one install order, and a part file
  stays while the key is missing (pinned in the half-way test).
- cleaner tests: the machine-file kinds example uses *.sav.
- playtest: the "read as off" warning names what is wrong, such as the unknown field.

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

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent · read at: 0da874d
verdict: safe to merge
covered: #971 (body, no comments), the PR body, the full diff: fork-kit/cleaner/README.md, config.py, dedupe.py, tests/dedupe.test.py, packages/contracts/src/playtest.ts and its test, docs/fork/README.md; read against config.py _dedupe and DEDUPE_SPEC, dedupe.py plan_dedupe, common/machine_file.py fields
checks: python3 -I -B dedupe.test.py 84 OK, engine.test.py 55 OK; vp test run playtest.test.ts 22 passed, apps/server serverSettings.forkSettings.test.ts 37 passed. Red check: playtest.ts put back to origin/main, the new case fails (expected 'settings: invalid playtest settings r…' to contain '["claim"]["maxRuns"]'), passes with the fix. The new half-way assertion and the *.sav edit change no code, so there is nothing to undo; they pass on main as the PR body says. Probed the warning with 16 bad values (relative program with a --token= argument, a number in argv, a 600-character description, a bad step name, an unknown key, a bad type at the top, a duplicate step name): every warning holds only the schema's "Expected ..." text and the key path, never a value, and every one decodes to the default (off).
state: runs again: nothing new is linked (unchanged); stops half-way: the part stays and the next run with the key removes it and links, pinned in the half-way test; old machine file without the key: plan_dedupe keeps each folder as could not read and the run exits 1, not 2 (DEDUPE_SPEC default None, the early return only when dedupe.folders is empty, so "while dedupe.folders names a folder" is exact); [] sets dedupe_in_place = () and links what passes the built-in refusals. The playtest change keeps the read-as-off rule as it was: Result.isFailure on the same strict decode replaces Option._tag === "Some", and PlaytestSettingsPatch uses the same function.
blocker: none
major: none
minor: packages/contracts/src/playtest.ts:185 replaceAll("\n", " ") keeps the formatter's indent, so the log reads Expected no excess property at ["claim"]["maxRuns"] (three spaces), not the single space the PR body shows. Small and in scope: collapse whitespace (replace(/\s*\n\s*/g, " ")); fix in this PR.
minor: packages/contracts/src/playtest.test.ts:213 the warning carries no value today only because this Effect version's formatter prints none; no test pins that. Small and in scope: one more expect that a bad argv value (say a --token= argument) is absent from the warning; fix in this PR.
nit: docs/fork/README.md:287 and fork-kit/cleaner/README.md:722 the rewrapped lines run well past the file's line width (about 150 and 120 characters). Format passes; drop unless the file is touched again.
other: the word changes match the code. KEY_KINDS picks with the comment is right, the engine test still pins the loosens set, the none default matches DEDUPE_SPEC and the other optional rows (mustKeep), exit 1 versus 2 is right, and unknown key 'dedupe' matches machine_file.fields. The left item's reason holds: a playtest save writes the default over a bad value, while reviewRules has a "kept as written" path through its decoder and web editor; the workaround is documented at docs/fork/README.md:287-288.

🤖 Generated with Claude Code

scuttletoby and others added 2 commits November 22, 2026 22:04
Collapse every whitespace run in the dropped-settings warning to one
space, and pin in the test that a bad argv value never reaches the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby
scuttletoby merged commit d7bbc95 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

Development

Successfully merging this pull request may close these issues.

Cleaner dedupe + playtest: round-2 follow-ups from #962

1 participant