Repository navigation
chore(ratchet): one ratchet baseline library - #27788
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to This change consolidates the ratchet baseline code into one shared module without changing which checks pass or fail. No merge-blocking risk was identified. Pre-merge checks |
|
…ary (#28054) #27756's script imported baseline helpers from check-focus-read-ratchet.mjs after #27788 had moved them into ratchet-baseline.mjs, so it crashed on start and failed every PR that merges main. Use the library's helpers, and record the two daemon-process launches from #27769 that the broken check never saw. Co-authored-by: Orca Worker <orca-worker@localhost>
…ary (#28054) #27756's script imported baseline helpers from check-focus-read-ratchet.mjs after #27788 had moved them into ratchet-baseline.mjs, so it crashed on start and failed every PR that merges main. Use the library's helpers, and record the two daemon-process launches from #27769 that the broken check never saw. Co-authored-by: Orca Worker <orca-worker@localhost>
…27875) * fix(browser): annotation card and outline follow the selected element The grab overlay keeps re-measuring the picked element after the click (scroll in any box, resize, element size changes), and the isolated viewport bridge reports that live box so the pending card follows it, including page zoom. The card's side pick uses its measured height. * fix(browser): bind annotation card to selected element * fix(browser): keep document annotation card on selection * fix(ci): point the main sync-spawn ratchet at the shared ratchet library (#28054) #27756's script imported baseline helpers from check-focus-read-ratchet.mjs after #27788 had moved them into ratchet-baseline.mjs, so it crashed on start and failed every PR that merges main. Use the library's helpers, and record the two daemon-process launches from #27769 that the broken check never saw. Co-authored-by: Orca Worker <orca-worker@localhost> * fix(browser): follow selected element outer-box size * refactor(chat): give the start-refusal resumable table its own module (#28085) #27946 and #26684 together put agent-session-failure-words.ts at 304 lines, over max-lines, which fails lint and the pre-commit hook on every merge of main. The refusal-code table is standalone with one reader, so it moves out. Co-authored-by: Orca Worker <orca-worker@localhost> --------- Co-authored-by: OrcaWin <alpha-eng@stably.ai> Co-authored-by: Orca Worker <orca-worker@localhost>
ELI5
Orca has several "ratchet" checks: each keeps a list of known exceptions (files allowed to skip a rule) and fails CI if the list grows. Five of them carried their own copy of the same list-reading, list-diffing and list-pruning code. This PR moves that code into one small library and deletes the copies. One check whose list was already empty becomes a plain "never allowed" check.
What Changed
config/scripts/ratchet-baseline.mjs: reading tracked files, entry baselines (one path per line) and count baselines (<count> <path> [# note]), diffing, pruning, and the shared--init/--prune/ check flow for entry ratchets.check-max-lines-ratchetandcheck-ts-nocheck-ratchetnow only define what they scan and what advice they print; the shared flow does the rest.check-focus-read-ratchet,check-layout-writer-ratchetsandcheck-process-host-importsuse the library's baseline code instead of their own (layout-writer no longer imports it from the focus-read script).check-runtime-electron-ratchet: its baseline file was empty and its test pinned it empty. The baseline file, its--writemode and its diff code are gone; any module reachable from the runtime that importselectronnow simply fails.getActiveRuntimeTarget,legacyRouteFromSettings,settingsForRuntimeOwner) unchanged.ratchet-baseline.test.mjs, which also covers the shared check/prune flow.Before/after for developers: same gates, same pass/fail decisions, same baseline file formats. The failure text for max-lines and ts-nocheck is shorter (no ASCII box) but still names each offending entry and the fix command.
Why
The copies had already drifted (three different
parseBaselineshapes, two different prune paths), so a fix to one ratchet silently missed the others. One library keeps the behaviour in one place. An empty "may only shrink" list carries no information, so a plain ban states the rule directly.Net lines: production −255 (including the new +170-line library), tests −35.
Linked Issue
N/A (maintainer cleanup, Phase 3.99 item 2.7).
Visual Proof
N/A — CI scripts only, no app behaviour change.
Testing
All six gates pass on this tree with the current baselines unchanged:
check:max-lines-ratchet(4),check:ts-nocheck-ratchet(159),check:runtime-electron-ratchet(0),check:focus-read-ratchet(1120 reads),check:layout-writer-ratchets(211 / 700),check:process-host-imports(127).--pruneon each count/entry ratchet leaves every baseline byte-identical.Manually seeded a stale ts-nocheck baseline entry (fails, prune removes it) and a new
@ts-nocheckfile (fails with the advice).pnpm teston the 8 ratchet test files: 105 passed.pnpm lint(all ratchets), oxlint andcheck:code-quality:changedpass.Dead-code check:
rgfor every removed export (parseBaseline,diffBaseline,parseBaselineNotes,formatBaseline,readBaseline,diffAgainstBaseline,readProcessHostBaseline,runtime-electron-baseline) across src, config, scripts, tests, mobile and packages finds no remaining caller.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Cross-platform: file listing still goes through
git ls-filesandpath.join; the CLI entry checks still usepathToFileURL. No SSH, mobile or wire impact.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)