Skip to content

fix(lint): clear the four ratchet drifts, and give pnpm lint a known-red verdict - #172

Merged
nplez1 merged 5 commits into
nplez1/mainfrom
nplez1/issue-161
Oct 24, 2026
Merged

nplez1 merged 5 commits into
nplez1/mainfrom
nplez1/issue-161

Conversation

@nplez1

@nplez1 nplez1 commented Oct 23, 2026

Copy link
Copy Markdown
Owner

pnpm lint was red on nplez1/main. This fixes the drift, and adds the piece #161 says is worth
fixing regardless: a lint verdict that reports a known red instead of stopping at the first step.

Fixes #161.

What was wrong

The chain is one && sequence, so the first failing step hid the rest — which is why #161 lists three
ratchets and there were four.

Attribution, corrected. #161 reads the three as "code this fork did not write … arrived with a
sync". Checked against upstream/main: the ratchets and their baselines are upstream's, but every
offending call site is this fork's own code — upstream has no relocateRepoPath, no
project-folder-relocation.ts, no hidden-host section in SshTargetList.tsx and no cached-listing host
gate. That distinction is the one that decides fix-versus-allowlist, so it is recorded in
LOCAL-PATCHES.md: there was no upstream copy to wait for, and fixing here costs no sync.

  1. check:id-only-store-write-ratchet — relocateRepoPath(id, newPath) resolved the row with
    repos.find((c) => c.id === id). A repo id can be published by two execution hosts, so a
    primary-checkout relocation rewrote whichever row came first — a path that belongs to one machine.
    It now takes RepoHostTarget and resolves through findRepoRowForHostScopedWrite, the gate
    updateRepo already uses. RelocationDependencies.setRepoPath drops its now-redundant repoId.
  2. check:repo-host-read-ratchet — two raw repo.connectionId host decisions. Both are
    hardening rather than a behaviour change and the evidence says so: the catalog gate already refused
    those rows on their execution host one line later, and the relocation plan refuses a remote row
    before the branch name is used. The raw read was redundant in the first case and a wasted local
    git spawn against an unreadable path in the second; both now resolve the host first
    (isRepoOnCatalogHost, getRepoRoutingConnectionId).
  3. check:host-list-render-ratchet — the hidden-host section in Settings → Servers drew a card
    per host, and hidden hosts are exactly the ones ~/.ssh/config keeps re-importing. It now draws a
    bounded page via boundHostList, with the pane's own filter passed down as the ranking query (a
    second search box inside the section would AND with it), and computes nothing while collapsed.
  4. check:workspace-record-read-ratchet — the fourth drift, hidden behind the other three: two
    renderer readers now go through workspace-record-selectors.ts, two store slices are added to the
    baseline under its existing # store writer convention, and the row for a deleted file is pruned.

Prevention

local/gate-lint.mjs + local/lint-known-red.json give the lint chain the shape local/gate-unit.mjs
gives the unit suite: the steps are read out of package.json (never restated, so an added step runs
and a removed one turns its entries stale), each is run separately in the order pnpm lint uses, and
every failure is classified against the known-red list — recorded ones are reported with class and
owner, unrecorded ones fail the gate, and one that stops reproducing is stale and prunable. Entries can
carry a match regex so an entry names one offending file rather than the whole step; a step whose
output cannot be split into lines, or one killed by the timeout, can only be covered by a whole-step
entry. tests/tools/lint-gate.test.mjs covers the chain reader, the failure split and the
classification.

Verification

Run from a730bcda6f, clean tree:

Command Result
pnpm tc PASS — no type errors in 18,059 / 3,231 / 34 / 16,084 files
pnpm lint PASS — exit 0, full chain through check:compat-boundary-imports
node local/gate-lint.mjs PASS — 32 green, 0 failing: 0 known red, 0 new; 137.3 s
node config/scripts/check-changed-code-quality.mjs PASS — 0 new findings across 16 changed files
focused vitest PASS — 11 files, 96 tests

Focused suites: SshTargetList* (offered + 13,692-host hidden section), repo-update-host-guard,
project-folder-relocation (+ integration), runtime-repository-relocation-controller,
runtime-repository-relocation-host-routing (new), worktree-pr-comment-inline,
jira-issue-workspace-open, execution-host, tests/tools/lint-gate (new).

The full pnpm test suite was not run: it has a known runtime trap on this machine (see the repo
AGENTS.md and local/unit-known-red.json). Nothing here changes a unit-tested path beyond the files
listed above.

Review

  • Round 1 — Opus 5.5 (claude/opus), high reasoning, tool-enabled over the full diff vs
    nplez1/main
    : 0 BLOCKER, 3 SHOULD-FIX, 3 MINOR, 7 NIT. All addressed: the gate's ::error file=X::
    parsing and --only stale-step handling, the false attribution above, the evidence overstatement for
    item 2, dropped arguments on direct node steps, the duplicate search field, a test that also passed
    on the old code, and the 13k re-map while collapsed.
  • Round 2 — delta re-check on the fix round: 1 new SHOULD-FIX (the file name was dropped from
    ::error file=X:: signatures, so two files could collapse into one line and one match could cover
    both — fixed, with a test each for per-file signatures, timeout handling and ranking), 1 new MINOR
    (a host reachable only through its HostName still depended on input order — the pane filter is now
    the ranking query, with a test), 2 NITs (wording). Commit series confirmed one topic per commit.
  • A third round was not run: the two-round default in AGENTS.md, and what remains is what round 2
    asked for, verified by the tests above.

Notes

  • local/gate-lint.mjs has no per-revision cache, unlike local/gate-unit.mjs — the whole chain is
    ~100–160 s and a cached verdict would outlive the edit it was computed against.
  • SshPane now passes its filter into SshTargetList for ranking only; one search box, unchanged
    behaviour when it is empty.

A repo id can be published by two execution hosts, so looking a row up by bare
id rewrote whichever row came first — with one id registered on two hosts, a
primary-checkout relocation moved a path that belongs to one machine.

relocateRepoPath now takes RepoHostTarget and resolves the row through
findRepoRowForHostScopedWrite, the gate updateRepo already uses (it also reports
a host mismatch instead of the silent null a deleted row returns).
RelocationDependencies.setRepoPath drops its repoId argument: the plan's own row
is in scope at the only call site.

Clears the check:id-only-store-write-ratchet drift in #161.
A row may name its host only as executionHostId 'ssh:<target>', which a raw
repo.connectionId read answers as local.

The catalog gate already refused those rows a line later on the execution host,
so no listing was served from the wrong machine — the raw read was the bug
waiting to happen, excluded only by field order. It now goes through
isRepoOnCatalogHost, the same strict gate the orcad migration paths use.

The relocation plan passed the raw connectionId to getRepoDefaultBranchName, so
an ssh:-only row spawned a local git against a path this machine cannot read; the
plan refuses a remote row before the name is used, but the lookup was one
ordering change away from naming a project folder from the wrong checkout. It now
passes getRepoRoutingConnectionId(repo).

Clears the check:repo-host-read-ratchet drift in #161.
Hidden hosts are the ones ~/.ssh/config keeps re-importing, so this section grows
with the config and was the only host list on the screen drawn outside a window:
one card per host, at any count.

It now draws a bounded page through boundHostList from components/host-picker.
The hook useBoundedHostRows is not used here because this section has no query of
its own — SshPane's filter above already narrows the targets, and a second box
inside the section would AND with it — and because a bound is only computed while
the section is open.

Clears the check:host-list-render-ratchet drift in #161.
check:workspace-record-read-ratchet was red behind the three drifts #161 names,
so pnpm lint never reached it. Two readers now go through
workspace-record-selectors.ts; the two store slices that compute a next slice stay
in the baseline with their reason; the row for a deleted file is pruned.
pnpm lint is one && chain: it stops at the first failing step and reports
nothing about the rest. That is how a fourth ratchet drift stayed invisible in
#161 and why reds on the base branch have had to be hand-verified as pre-existing
in an unrelated PR.

local/gate-lint.mjs runs every step of the chain on its own, exactly as pnpm lint
would, and classifies each failure against local/lint-known-red.json — the shape
local/gate-unit.mjs gives the unit suite. A recorded failure is reported with its
class and owner; a failure outside the list fails the gate; a recorded failure
that stops reproducing is stale and prunable; and only a whole-step entry can
cover a step whose output could not be split into lines. Steps are read from
package.json rather than restated, so an added step runs and a removed one turns
its entries stale.
@nplez1
nplez1 merged commit 12d5102 into nplez1/main Oct 24, 2026
@nplez1
nplez1 deleted the nplez1/issue-161 branch October 24, 2026 03:23
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.

pnpm lint is red on nplez1/main: three upstream ratchet drifts (host-qualified write, raw connectionId reads, unbounded host list)

1 participant