Skip to content

test: remove remaining non-null assertions from subgraph normalization tests - #16810

Closed
christian-byrne wants to merge 1 commit into
mainfrom
christian/fe-16546-drjkl-followup
Closed

christian-byrne wants to merge 1 commit into
mainfrom
christian/fe-16546-drjkl-followup

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor

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

  1. 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 in e0ea806e8; the behavioural window-scroll test remains in the file at main. No further change needed; verified at this PR's base.

  2. Thread 2 — recursive fixture type escapes in subgraphDeduplication.test.ts — DrJKL: "The new tests use repeated assertions to manufacture a recursive fixture shape, including as unknown as later in this case and several non-null assertions... make the fixture builder return the recursive test type and narrow find() results through assertions or a helper so these cases prove the shape without bypassing the compiler." Already resolved on the merged PR in 7e540e16a — no as unknown as remains in the file at main. The residual non-null assertions are addressed by this PR.

  3. 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 established expect(...).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 passed
  • pnpm typecheck (vue-tsc --noEmit) — clean
  • pnpm lint (stylelint + oxlint + eslint) — 0 errors (188 pre-existing repo-wide deprecation warnings, unchanged)
  • husky pre-commit (lint-staged) and pre-push (knip) hooks green; no hook bypass used
  • Head: 3045e26672e62143c26eaf1fa368ced1e039ebd9, based on main at 606fb5eedf

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.
@christian-byrne
christian-byrne requested a review from a team September 3, 2026 18:19
@christian-byrne christian-byrne self-assigned this Sep 3, 2026
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 27 seconds.

Check out review usage here.

View limit details

Limit 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.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: e0eec73a-e496-4b05-8ee7-5db7105e906d

📥 Commits

Reviewing files that changed from the base of the PR and between e804eb4 and 3045e26.

📒 Files selected for processing (1)
  • src/lib/litegraph/src/subgraph/subgraphDeduplication.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/03/2026, 06:21:43 PM UTC

Links

🎭 Playwright: ✅ 1914 passed, 0 failed · 1 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1893 / ❌ 0 / ⚠️ 1 / ⏭️ 4)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

📦 Bundle: 9.68 MB gzip ⚪ 0 B

Details

Summary

  • Raw size: 41.1 MB baseline 41.1 MB — ⚪ 0 B
  • Gzip: 9.68 MB baseline 9.68 MB — ⚪ 0 B
  • Brotli: 6.81 MB baseline 6.81 MB — ⚪ 0 B
  • Bundles: 448 current • 448 baseline

Category Glance
Vendor & Third-Party ⚪ 0 B (18.1 MB) · Other ⚪ 0 B (16.4 MB) · Data & Services ⚪ 0 B (3.6 MB) · Graph Workspace ⚪ 0 B (1.43 MB) · Panels & Settings ⚪ 0 B (621 kB) · Utilities & Hooks ⚪ 0 B (558 kB) · + 5 more

App Entry Points — 3.73 kB (baseline 3.73 kB) • ⚪ 0 B

Main entry bundles and manifests

Status: 1 unchanged

Graph Workspace — 1.43 MB (baseline 1.43 MB) • ⚪ 0 B

Graph editor runtime, canvas, workflow orchestration

Status: 3 unchanged

Views & Navigation — 124 kB (baseline 124 kB) • ⚪ 0 B

Top-level views, pages, and routed surfaces

Status: 17 unchanged

Panels & Settings — 621 kB (baseline 621 kB) • ⚪ 0 B

Configuration panels, inspectors, and settings screens

Status: 27 unchanged

User & Accounts — 27.8 kB (baseline 27.8 kB) • ⚪ 0 B

Authentication, profile, and account management bundles

Status: 11 unchanged

Editors & Dialogs — 126 kB (baseline 126 kB) • ⚪ 0 B

Modals, dialogs, drawers, and in-app editors

Status: 8 unchanged

UI Components — 117 kB (baseline 117 kB) • ⚪ 0 B

Reusable component library chunks

Status: 15 unchanged

Data & Services — 3.6 MB (baseline 3.6 MB) • ⚪ 0 B

Stores, services, APIs, and repositories

Status: 16 unchanged

Utilities & Hooks — 558 kB (baseline 558 kB) • ⚪ 0 B

Helpers, composables, and utility bundles

Status: 35 unchanged

Vendor & Third-Party — 18.1 MB (baseline 18.1 MB) • ⚪ 0 B

External libraries and shared vendor chunks

Status: 18 unchanged

Other — 16.4 MB (baseline 16.4 MB) • ⚪ 0 B

Bundles that do not match a named category

Status: 297 unchanged

⚡ Performance

⏳ Performance tests in progress…

@christian-byrne

Copy link
Copy Markdown
Contributor Author

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 65f39ddc9), so #16811 now carries the complete fix — closing this one per the dedupe rule. All verification evidence in the #16811 thread.

@github-actions github-actions Bot added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

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     
Flag Coverage Δ
unit 77.10% <ø> (ø)
website-unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.
see 418 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:xhigh PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant