Repository navigation
Conversation
|
✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged. |
🎨 Storybook: 🚧 Building...🎭 Playwright: ⏳ Running... |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
I have read and agree to the Contributor License Agreement |
Co-authored-by: vansh-nagar <vansh.nagar.dev@gmail.com>
|
The consolidation with #18825 is now complete in c109520. This carrier now has the shared guard’s unit test and both use sites, including |
|
This is the active carrier for the record-guard consolidation after #18825 was folded into it, but it cannot land as it stands: it conflicts with The surviving two call sites plus the shared guard and its unit test are re-authored on current Nothing is needed from you here. Leaving this open rather than closing it, in case you would rather land your own branch: if you rebase it, #21995 can be dropped instead. |
…omfy-Org#21995) ## Summary The agent follower browser fixtures each hand-rolled the same `typeof x === 'object' && x !== null` check before reading a parsed `doc_*` frame. This replaces the two remaining copies with one guard under `browser_tests/fixtures/utils/`, plus a unit test for it. This carries the surviving part of [Comfy-Org#18816](Comfy-Org#18816) (the same consolidation, by @chiliec, which also absorbed Comfy-Org#18825). That PR is conflicting against `main` on a fork branch and has been open since September, so this is the same change re-authored on current `main` where it can land. Two non-obvious differences, both deliberate: **The guard excludes arrays.** `value is Record<string, unknown>` is false for an array, so admitting one lets a caller index it by string key with no complaint from the compiler, and three sibling guards in `browser_tests/fixtures/customNode/` already exclude them. A shared helper under `fixtures/utils/` is the one future callers will import, so it should not mean the opposite of its neighbours. Both call sites already reject an array one line later, because `type` and `op` read as `undefined`, so no valid frame changes outcome. The only behaviour difference is that an array `data` now returns `null` instead of being handed back typed as a record. **`agentGraphOpLostOnDisconnect.spec.ts` is untouched.** Comfy-Org#18816 also removed a local copy of the guard from that spec. That copy went away upstream along with the `subscriptionFrameOf` helper that used it, so there is no longer a duplicate there to remove. ## Verification - `pnpm vitest run browser_tests/fixtures/utils/isRecord.test.ts` passes, and the array cases fail against the array-accepting version, so the tightening is actually covered rather than assumed. - `pnpm typecheck` and `pnpm typecheck:browser` are clean, which is what covers the two fixture call sites narrowing correctly. - `oxfmt --check` and `oxlint` clean on the four files. - Not run locally: the agent Playwright specs that consume these fixtures. They need a cloud-distribution dev server, and the change is behaviour-preserving for every valid frame, so CI is the right place for that leg.
|
Closing as superseded by #21995 (merged 2026-10-29, |
Summary
Replace the two
ascasts indocFrameEnvelopewith a sharedisRecordtype guard, so the compiler checks the narrowing instead of taking it on trust.Changes
browser_tests/fixtures/utils/isRecord.ts(next tojsonRoute.ts), plus a small vitest.agentFollowerHostSocket.ts:docFrameEnvelopenarrowsframeanddatawithisRecord, and both assertions are gone. Runtime behavior is unchanged.agentGraphOpLostOnDisconnect.spec.ts: drop its inline copy of the same guard and import the shared one. That makes two callers, the bar the issue sets for a module. The other privateisRecords underbrowser_tests/fixtures/customNode/are left alone, following the issue's "adopt as they come up, not in a sweep".Review Focus
Test-only, with no production code touched.
Validation:
pnpm exec vitest run browser_tests/fixtures/utils/isRecord.test.ts: 2/2 pass.oxfmt --check,oxlintandeslinton the 4 touched files: clean.vue-tsc --project browser_tests/tsconfig.jsongets OOM-killed there, so I rantscagainst a narrowed project (same compiler options, just the touched files plus the global.d.tsincludes). The error set before and after the change is identical: only pre-existing.vuemodule resolutions that plaintsccan't follow, with nothing inbrowser_tests/. As a sanity check, loosening the guard's return type tobooleanmakes tsc reject both callers (TS2339 / TS18046), so the narrowing really is compiler-checked now. CI'stypecheck:browseris the authoritative run.Fixes #18805