Repository navigation
test: remove remaining non-null assertions from subgraph normalization tests - #16810
christian-byrne wants to merge 1 commit into
Conversation
Follow-up to #16546 review feedback (DrJKL): prove node existence via the file's established toBeDefined + guard pattern instead of non-null assertions, and assert node-list length before optional access. Test-only, no behaviour change.
|
Warning Review limit reachedNext included review available in 27 seconds. View limit detailsLimit details: You’ve used all 4 included reviews currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (1)
Comment |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1914 passed, 0 failed · 1 flaky📊 Browser Reports
📦 Bundle: 9.68 MB gzip ⚪ 0 BDetailsSummary
Category Glance App Entry Points — 3.73 kB (baseline 3.73 kB) • ⚪ 0 BMain entry bundles and manifests Status: 1 unchanged Graph Workspace — 1.43 MB (baseline 1.43 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration Status: 3 unchanged Views & Navigation — 124 kB (baseline 124 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces Status: 17 unchanged Panels & Settings — 621 kB (baseline 621 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens Status: 27 unchanged User & Accounts — 27.8 kB (baseline 27.8 kB) • ⚪ 0 BAuthentication, profile, and account management bundles Status: 11 unchanged Editors & Dialogs — 126 kB (baseline 126 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors Status: 8 unchanged UI Components — 117 kB (baseline 117 kB) • ⚪ 0 BReusable component library chunks Status: 15 unchanged Data & Services — 3.6 MB (baseline 3.6 MB) • ⚪ 0 BStores, services, APIs, and repositories Status: 16 unchanged Utilities & Hooks — 558 kB (baseline 558 kB) • ⚪ 0 BHelpers, composables, and utility bundles Status: 35 unchanged Vendor & Third-Party — 18.1 MB (baseline 18.1 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 18 unchanged Other — 16.4 MB (baseline 16.4 MB) • ⚪ 0 BBundles that do not match a named category Status: 297 unchanged ⚡ Performance
|
|
Duplicate of #16811 (opened 3 seconds apart by concurrent lanes for the same review-follow-up row). Its non-null-assertion removals were cherry-picked onto #16811's branch (head |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #16810 +/- ##
==========================================
+ Coverage 81.12% 82.69% +1.56%
==========================================
Files 2459 2041 -418
Lines 126484 119006 -7478
Branches 31888 31873 -15
==========================================
- Hits 102609 98408 -4201
+ Misses 23360 20418 -2942
+ Partials 515 180 -335
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Test-only follow-up to #16546 (merged as
606fb5eedf): resolves the remaining type-safety feedback from the DrJKL review threads. No behaviour change.Review threads addressed
Thread 1 — change-detector test in
BrushCursor.test.ts— DrJKL: "This test codifies the known stale-position bug without causing an ancestor move or any observable event... Please remove it or replace it with a behavioral test that drives the real movement signal and asserts the expected cursor position." Already resolved on the merged PR: the change-detector case was removed ine0ea806e8; the behavioural window-scroll test remains in the file at main. No further change needed; verified at this PR's base.Thread 2 — recursive fixture type escapes in
subgraphDeduplication.test.ts— DrJKL: "The new tests use repeated assertions to manufacture a recursive fixture shape, includingas unknown aslater in this case and several non-null assertions... make the fixture builder return the recursive test type and narrowfind()results through assertions or a helper so these cases prove the shape without bypassing the compiler." Already resolved on the merged PR in7e540e16a— noas unknown asremains in the file at main. The residual non-null assertions are addressed by this PR.Thread 3 — remaining non-null assertion in the normalization test — DrJKL: "One non-null assertion remains in this newly added normalization test, so the type-safety finding is not fully resolved. Please prove the node exists as the later cases do, then access it without
!." Fixed by this PR: node existence is proven with the file's establishedexpect(...).toBeDefined()+ guard pattern, node-list length is asserted before optional access (result.subgraphs[1].nodes?.[0]?.type), and the remaining!uses in the normalization tests (rootNodes,links,inputs) are narrowed the same way.Evidence
pnpm exec vitest run src/lib/litegraph/src/subgraph/subgraphDeduplication.test.ts— 22/22 passedpnpm typecheck(vue-tsc --noEmit) — cleanpnpm lint(stylelint + oxlint + eslint) — 0 errors (188 pre-existing repo-wide deprecation warnings, unchanged)3045e26672e62143c26eaf1fa368ced1e039ebd9, based onmainat606fb5eedf