Repository navigation
test: move input matrices from e2e to unit tests - #385
Conversation
The e2e loop ran 14 spellings of an unsafe vendor folder through init, track, sync and a sync journal. unsafeVendor decides all of them, so the spellings now live in a unit table. e2e keeps the repo root (journal only), a sibling of the repo and .git, to show each command refuses and writes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
init, track and sync each ran five kinds of nested git dir through the CLI. refuseNestedGit decides which names count, so the spellings now live in a unit table. e2e keeps a repo of its own and a linked worktree, the two a user makes with git itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three loops ran build --force and status for an output folder that git reads as .git, with the same body and the same expected message. They are now rows of one table. The same 13 cases run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every command that reads the config builds the Book through Book.fromText, which refuses an output folder git reads as .git. The 13 spellings, and 6 names that only look like .git, now run there as a unit table. e2e keeps skills/.git and .git. to show build --force and status refuse and leave the repo as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"track rejects a mount with a git segment in another case in both layouts" had the same setup and assertions as "init and track reject names git reads as .git in both layouts". Its three mounts are now rows of the latter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
track builds the new config through Book.fromText, which refuses a mount git reads as .git in both layouts. The seven mount spellings now run there as unit rows, and init's three --output-to spellings were already rows of the [output] to table. e2e keeps .git. for init and .git. and .GIT/x for track in each layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ream clone, init, sync and check each ran three spellings of a folder that macOS or Windows reads as .patchbook. refuseFoldedUpstream decides them, so seven refused and four allowed paths now run there as a unit table. e2e keeps .PATCHBOOK for each command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commit hook refuses a staged file the Book reserves, and Book.reservedOutput decides which paths those are. The three spellings the hook test looped over now run there with more rows. e2e keeps .patchbook./x.md, which runs on every file system, to show the hook refuses the commit and changes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 edit lines with a climbing, absolute, empty-segment or backslash path each ran status, status --json and build --force through the CLI. parseChange holds and refuses them, so the lines now run there as a unit table. e2e keeps an add and a copy that climb out of the repo, to show status reports them and build writes nothing inside or outside. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its config.toml rows linked .patchbook/config.toml to a missing file and checked init refuses it in each layout. "init refuses a dangling link at .patchbook/config.toml and writes nothing" does the same in both layouts and also checks the repo is unchanged. The loop keeps upstream.lock and retired.md, which link to a file that exists. The rest of the table stays in e2e: refuseDanglingLinks and the checks in cmdInit are private to cli.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…formats hook install asks the LEFTHOOK and PRE_COMMIT formats whether a config already runs patchbook, only mentions the call, or has a patchbook entry that doesn't always run. The 10 other-name configs, the 48 mention configs and the 7 limited lefthook entries now run against those formats as unit tables. e2e keeps one lefthook and one pre-commit config for the first two, and a skipped lefthook command for the third. The config builders move to helpers.ts so both files share them. LEFTHOOK_PAIRS stays in e2e: the pick of lefthook's config file is private to githook.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Out of scope for this PR, found while reviewing it. This PR doesn't change
Through the CLI at I'll open an issue for it. 🤖 Generated with Claude Code |
Part of #382
Problem
test/e2e.test.tstested several validation rules with every input spelling through the real CLI, once per command. Each spelling costs a subprocess, a throwaway repo and about 0.2 s. The rule itself lives in one function, so the spellings belong in a unit table. e2e only needs to show that each command passes the refusal to the user and changes nothing.Change
Each table's spellings now run against the function that decides them, in a new
describeintest/units.test.ts. e2e keeps one or two rows per command, chosen as the inputs a user is most likely to hit. Each table is its own commit. Two commits first merge loops that ran the same test body.18b8b43)unsafeVendors15104unsafeVendorunsafeVendor, 17 rows../sibling,.git, for init, track, sync and the sync journal. The sibling row checks nothing outside the repo is touched, and.gitchecks the git dir survives.nestedGits15373refuseNestedGitrefuseNestedGit, 7 rowsBook.fromText(checkMounts)[output] torowsskills/.gitand.git.for build --force and status.14950into14884Book.fromText(checkMounts)1488414950had the same setup as14884, so its mounts became rows there first.14884keeps.git.for init and.git.and.GIT/xfor track, in both layouts.refuseFoldedUpstreamrefuseFoldedUpstream, 7 refused and 4 allowed rows.PATCHBOOKfor clone, init, and sync with check..patchbookspellings 5800Book.reservedOutputreservedOutput, 6 refused and 4 allowed rows.patchbook./x.md. It runs on every file system, where the.PATCHBOOKrow skips on a case-insensitive one.escaping5938parseChangerefuseDanglingLinksand the "already exists" check incmdInit, private tocli.ts;Book#refuseLinkedTopforupstream.lock3266retired.mddeciders are private.upstream.lock's decider is public, but its rows are one test per layout, which is already the e2e minimum, so a unit row would remove nothing. Only theconfig.tomlrows of3266are cut. They link.patchbook/config.tomlto a missing file, which the.patchbook/config.tomlrow of3331checks in both layouts, along with an unchanged repo.LEFTHOOK_PAIRS3879configFilesingithook.ts, privateinstallHookreachesconfigFiles, and it needs a real repo and hook folder.OTHER_NAMES4322LEFTHOOKandPRE_COMMITformatsNOT_RUNNING×MENTIONS4350, 4364LEFTHOOKandPRE_COMMITformatsecho "patchbook hook run"in one lefthook YAML and one pre-commit config.NOT_ALWAYS4404LEFTHOOKformatThe hook config builders (
lefthookCommand,preCommitHookand the rest) move totest/helpers.tsso both files share them. Unit rows whose names hold U+FFFE or U+FFFF get word labels, because Bun writes those characters raw into the junit file and the XML stops parsing.Verification
bun run typecheckpasses.bun test --isolate test/units.test.ts test/paths.test.ts: 522 pass, 0 fail.0688792, the touched e2e tests, run with-tover their names: 149 pass from source, and 149 pass againstdist/patchbookafterbun run build. The binary run reports 161 because 12 matched tests skip underPATCHBOOK_CMD.unsafeVendorwithout.toLowerCase().patchbookrows)findGitmatching only.gitnamesGitwithout the NTFS rule[output] torowscheckMountswithout the.gitcheckNTFS_DOT_PATCHBOOKcase-sensitivereservedOutputusingunder(path, ".patchbook")unsafePathwithout the backslash rulecallsInignoring the lefthook limitsrunsCallaccepting any text that holds the callpbcovharness from Cut CI wall time and reshape the test suite: shard the root job, move input matrices to unit tests #382, measured on this branch rebased on0688792and compared against the main baseline at82fd7f6: 5569 of 5761 statements on both sides (96.67%). 0 statements lost, 0 gained.src/is the same on both.pbcov diffagainst the main baseline at82fd7f6. At82fd7f6e2e had 1686 tests. test(e2e): merge duplicate tests #384 then merged 3 pairs, and this PR removes 149 more. These counts leave out the 13 e2e tests that skip underPATCHBOOK_CMDor on a case-sensitive file system, so a plain run at this head reports 1547.82fd7f60688792e2e.test.tsunits.test.tspaths.test.ts82fd7f6, the 149 removed e2e tests took 27.1 test-seconds. But the 1549 tests both sides share took 472.5 s at base and 507.9 s at head, a 35 s drift from load alone, so the totals don't compare. The CI job times on this PR show the real effect. The new unit tests add 0.2 test-seconds tounits.test.ts.I couldn't check macOS. CI runs it on push.
Found while writing the tables, not changed here:
unsafeVendoraccepts.patchbook.,.patchbook /xand.patchbook:x, which Windows reads as.patchbook. The output folder check refuses those spellings throughinPatchbook. It needs its own issue, and the unit table here leaves those rows out.Written with Claude Opus 5.5 in Claude Code
🤖 Generated with Claude Code