Repository navigation
Conversation
|
Too many files changed for review (121 files, 100 file limit). Bypass the limit by tagging |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor consistency suggestion inline.
Reviewed changes — full read of the PR diff (121 files, commit 6caccd4), focused on the type-only rewrites, the identity-token conventions, and the three logic-touching refactors.
- Rule enabled —
anti-slop/no-object-parametersflippedoff→errorinconfig/oxlint-anti-slop.json; the 185 baselineobjectfunction-input types acrosssrc,config, andmobileare replaced with named owner types, new aliases, or identity tokens. No suppressions for the rule. - Identity tokens — three forms:
Record<string, never>for{}-minted tokens,WeakKeyfor weak-map keys, andobject & { readonly [brand]?: never }forRpcSessionIdentity,GitHubChecksContextOwner, andRendererPtyVisibilityClaimOwner. The branded aliases are structurallyobject(the brand is optional), so they pass only because the rule's matcher does not traverseTSIntersectionType. For reference-only tokens that is a reasonable, documented trade-off — just be aware the rule is not actually narrowing those three. - Logic-touching rewrites —
direct-rpc-client's probe guard,codex-session-migration-scheduler's result-shape helper, and the test-harnessgetWebContentsoverride (definePropertyinstead of a cast assignment) all preserve behaviour. relay-dial-stage.ts—RpcClient & Partial<RelayDialStageSource>narrowed by a type predicate; the only caller passes anRpcClient. Mobile is not inpnpm tc, but themobile.ymllane typechecksmobile/**on PRs, so the change is covered in CI.pane-scroll.ts— reverted to the widerTerminalScrollIntentTarget; the type-only re-export throughpane-manager-typesis erased at runtime and introduces no value cycle.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| @@ -40,6 +40,9 @@ import { | |||
| import { requestGitHubCheckDetails } from './checks-tab-request-details' | |||
| import { ChecksTabActions, ChecksTabCompactHeader } from './checks-tab-header' | |||
|
|
|||
| /** Identity token for one checks context; compared by reference so a stale refresh is dropped. */ | |||
| type ChecksContextOwner = Record<string, never> | |||
There was a problem hiding this comment.
The canonical identity-token type for this concept already lives in @/components/github-checks-tab-state (GitHubChecksContextOwner), a module this file already imports from, and the sibling pull-request-page/checks/tab.tsx uses it for the same slot. Since handleRefresh is only ever invoked with no argument, importing GitHubChecksContextOwner and dropping this local Record<string, never> avoids a second, structurally different token type for the same owner.
6caccd4 to
0671fc9
Compare
|
Rebased onto the corrected Rebase applied cleanly — no conflict. The branch's only config change is still the single one-line flip of Verified after the rebase:
|
0671fc9 to
b357957
Compare
6cf5b99 to
b9f5906
Compare
b357957 to
5884b30
Compare
b9f5906 to
70c8f73
Compare
5884b30 to
b7bf769
Compare
70c8f73 to
bfad0be
Compare
The rule rejects the broad `object` type on any function input (declarations, expressions, arrows, methods, call/construct signatures, function types), plus local aliases and unions that resolve to `object`. `object` accepts every non-primitive while exposing no properties, so it documents nothing and pushes callers into assertions at the boundary. Fixes all 185 violations across src, config, tests and mobile, and flips the rule from "off" to "error" in config/oxlint-anti-slop.json. Approach: replace each `object` input with the type its owner already has. Most sites took an existing domain type or a type-only import (36 added); 40 new aliases name shapes that had none. Where a value is genuinely only compared by reference, it gets a named identity token instead of a shape -- `Record<string, never>`, the built-in `WeakKey`, or a `unique symbol` brand, matching the branding already used in src/shared. Same treatment for WeakMap and Map key parameters. Two `as unknown as` casts became unnecessary once the parameter carried a real type and were removed; no new casts were added. Suppressions added: none. No `oxlint-disable` for this rule anywhere, and no max-lines disable or per-file bump. Three files sat exactly at their max-lines cap, so the added type imports were made line-neutral rather than suppressed: - src/main/ipc/browser.ts exports the existing guest-registration args type (renamed BrowserGuestArgs) so browser.test.ts reuses it on one line. - pane-scroll.ts takes TerminalScrollIntentTarget through the existing pane-manager-types import via a type-only re-export. - direct-rpc-client.ts drops the identity parameter entirely: the session check moved into the sendProbe callback that owns the token. Verified: anti-slop config reports zero violations over src config tests mobile; run-typecheck-projects-in-parallel exits 0; 144 affected test files pass (1749 tests); oxlint and oxfmt clean on all changed files. Mobile has no runnable test/typecheck target in this worktree (expo is not installed), so its 6 files were typechecked against a standalone config and diffed against the base branch -- error sets are byte-identical, including test files.
b7bf769 to
7a1f49a
Compare

Stacked on #20726 — base is
nwparker/2x-lint, notmain. Review that one first.What the rule rejects
anti-slop/no-object-parametersflags the broadobjecttype on any functioninput: declarations, function expressions, arrows, methods, call/construct
signatures and standalone function types. It also resolves local type aliases
and unions, so
type Owner = objectandobject | Fooare caught too.Why it matters:
objectaccepts every non-primitive but exposes no properties.It tells a reader nothing about what the function needs, lets unrelated values
through, and typically forces the callee (or a caller) to assert its way back to
a usable type. The rule's message asks for an owner-provided type, parsed at its
boundary.
Violation count
185 at baseline, all fixed. Verified by materialising the base-branch copies
of every changed file and linting them:
The rule is flipped
off→errorinconfig/oxlint-anti-slop.json.121 files changed.
Fix pattern
Each
objectinput was replaced with the type its owner already had — anexisting domain type where one existed (36 type-only imports added), a new named
alias where none did (40 added).
A meaningful subset of sites hold a value that is only ever compared by
reference — route keys, retry generations, lock owners, claim owners. Inventing
a shape for those would be a lie, so they get a named identity token instead:
Record<string, never>, the built-inWeakKey, or aunique symbolbrand,matching the branding already used in
src/shared(StablePaneId,SshProviderEpoch,ProviderRequestId, …).Two
as unknown ascasts became unnecessary once the parameter carried a realtype and were deleted. No new casts were added.
Suppressions
None. No
oxlint-disablefor this rule anywhere, nomax-linesdisable, andno per-file
max-linesbump.Three files sat exactly at their
max-linescap, where the obvious fix wouldhave needed one extra import line. Since AGENTS.md forbids bumping the cap, each
was made line-neutral instead:
src/main/ipc/browser.ts— the guest-registration args type was private andduplicated inline in the test. It is now exported (renamed
BrowserGuestRegistrationArgs→BrowserGuestArgsso the import fits) andbrowser.test.tsreuses it on one line instead of re-declaring the shape.pane-scroll.ts— takesTerminalScrollIntentTargetthrough its existing./pane-manager-typesimport, via a type-only re-export added there.direct-rpc-client.ts— drops the identity parameter entirely; thesession-identity check moved into the
sendProbecallback that owns thetoken, so
sendLivenessProbe()only checks connectedness.Please look closely at
relay-dial-stage.ts(mobile/src/transport/) — this one had a real bugmid-review. Typing the param
Partial<RelayDialStageSource>compiles inisolation but breaks the only caller: every property is optional, so
TypeScript's weak-type check rejects
RpcClient, which shares none of them(
TS2559). It is nowRpcClient & Partial<RelayDialStageSource>narrowed bya type predicate, which keeps the original reference-returning behaviour and
needs no assertion. Mobile is not covered by
pnpm tc, so this would not havebeen caught by the normal gates — see verification below.
object & { brand }aliases —RpcSessionIdentity,GitHubChecksContextOwner,RendererPtyVisibilityClaimOwner. These arestructurally still
object(the brand is optional, so any object isassignable); they satisfy the rule by being named and documented rather than
by narrowing. That is deliberate for opaque reference tokens, but it is the
weakest form of fix in this PR and worth a second opinion. The alternative —
making
RpcSessionLivenessWatchdoggeneric over the session type — is alarger refactor across 4 files that mobile's (unrunnable) tests could not
validate here, so I left it out.
pane-scroll.tskey type — I first tightened it toTerminal, whichtypechecks for every caller but one:
terminal-structural-replay-coordinatordeclares its own param as
TerminalScrollIntentTarget. Reverted to the widertype. The re-export through
pane-manager-typesis slightly inconsistent withthe 8 other modules that import this type directly from
./terminal-scroll-intent; it is done that way purely to stay under the linecap, and is type-only so it is erased at runtime.
Verification
npx oxlint --config config/oxlint-anti-slop.json src config tests mobile→ exit 0, zero violations.Sanity-checked that the rule actually fires by linting a scratch file with an
objectparam first, so "zero" is not a silently-misconfigured run.node config/scripts/run-typecheck-projects-in-parallel.mjs→ exit 0.pnpm testover the 144 affected test files (changed tests, sibling tests ofchanged sources, and tests importing the changed test-harness modules) →
144 files, 1749 passed, 1 skipped.
npx oxlintandnpx oxlint --config config/oxlint-react-doctor.jsonon allchanged files → exit 0.
npx oxfmt --writeapplied to all changed files.Mobile caveat, stated plainly:
mobile/node_modules/expois not installed inthis worktree, so
mobile's vitest andtscboth fail before running any code —including on completely untouched files and on the base branch. Mobile is also
not part of
pnpm tc. To avoid shipping its 6 changed files unverified, Itypechecked the mobile tree with a standalone tsconfig (no
expobase) on boththe base branch and this branch and diffed the results: error sets are
byte-identical, including test files. I also confirmed that probe detects the
relay-dial-stagebug above (it reportsTS2559) before the fix and not after,so the check is not blind. Mobile tests themselves have not been executed.