Skip to content

fix: resolve TypeScript strict build errors in GraphView and setupTests#69

Merged
VariableThe merged 1 commit into
mainfrom
fix/build-strict-types
Jun 27, 2026
Merged

fix: resolve TypeScript strict build errors in GraphView and setupTests#69
VariableThe merged 1 commit into
mainfrom
fix/build-strict-types

Conversation

@VariableThe

@VariableThe VariableThe commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves production build failures (npm run tauri build / tsc -b) that occurred after merging PR #68 due to strict TypeScript checks.

Changes

  1. ForceGraph3D Types (GraphView.tsx): Imported ForceGraphMethods from react-force-graph-3d and configured ForceGraphInstance to inherit from it. Properly types d3Force, strength, d3ReheatSimulation, and cameraPosition.
  2. Ref Variance (GraphView.tsx): Typecast <ForceGraph3D ref={...}> to avoid MutableRefObject invariance mismatch errors during build.
  3. Mock Contract (setupTests.ts): Added missing onUpdateReady mock function to window.electronAPI in unit test environment setup.
  4. Audit & Changelog: Updated AUDIT_LOG.md and CHANGELOG.md.

Pre-PR Checks

  • npm run lint — ✅ Passed (0 errors, 0 warnings)
  • npx vitest run — ✅ Passed (35 tests)
  • npm run build — ✅ Passed cleanly

Summary by CodeRabbit

  • Bug Fixes

    • Resolved TypeScript strict-build issues affecting the 3D graph view, improving production build reliability.
    • Fixed test environment support for an additional app update callback, reducing test setup failures.
  • Chores

    • Updated release documentation to reflect the latest fixes and build status.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@VariableThe, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 11 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38d0101f-d3fa-4d4d-bfcd-43f366c6bf2f

📥 Commits

Reviewing files that changed from the base of the PR and between c4f5412 and 332b5dd.

📒 Files selected for processing (4)
  • AUDIT_LOG.md
  • CHANGELOG.md
  • src/GraphView.tsx
  • src/setupTests.ts
📝 Walkthrough

Walkthrough

GraphView now uses ForceGraphMethods-based instance typing, a concrete graphData() return shape, and a never ref cast. Test setup adds window.electronAPI.onUpdateReady, and the fix is recorded in the audit log and changelog.

Changes

TypeScript strict build fixes

Layer / File(s) Summary
GraphView typing and test mock
src/GraphView.tsx, src/setupTests.ts, AUDIT_LOG.md, CHANGELOG.md
GraphView extends ForceGraphMethods, graphData() returns node and link arrays, the ForceGraph3D ref uses a cast, the test Electron API mock adds onUpdateReady, and the audit log and changelog record the fix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A bunny hopped through strict TypeScript light,
🐇 fixed refs and mocks till all felt right.
My ears twitched fast at onUpdateReady's call,
and GraphView now stands steady, tall.
Thump-thump! The changelog sings tonight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: fixing TypeScript strict build errors in GraphView and setupTests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/build-strict-types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/GraphView.tsx (1)

427-427: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the as never ref cast. It suppresses the ref contract at the call site and makes future type drift easy to miss; a typed callback ref or a small wrapper that forwards ForceGraphMethods would keep it intact.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/GraphView.tsx` at line 427, The `GraphView` ref wiring is bypassing the
type contract by casting `fgRef` with `as never`. Replace that cast at the
`ForceGraph`/`ForceGraphMethods` ref assignment with a properly typed solution,
such as a callback ref or a small wrapper component that forwards
`ForceGraphMethods`, so the ref type stays checked end-to-end.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/GraphView.tsx`:
- Line 427: The `GraphView` ref wiring is bypassing the type contract by casting
`fgRef` with `as never`. Replace that cast at the
`ForceGraph`/`ForceGraphMethods` ref assignment with a properly typed solution,
such as a callback ref or a small wrapper component that forwards
`ForceGraphMethods`, so the ref type stays checked end-to-end.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b524b153-3b93-4f64-b2b4-0653d9887b34

📥 Commits

Reviewing files that changed from the base of the PR and between 19fa5da and c4f5412.

📒 Files selected for processing (4)
  • AUDIT_LOG.md
  • CHANGELOG.md
  • src/GraphView.tsx
  • src/setupTests.ts

@VariableThe VariableThe force-pushed the fix/build-strict-types branch from c4f5412 to 332b5dd Compare June 27, 2026 07:28
@VariableThe VariableThe merged commit 4b86e50 into main Jun 27, 2026
4 checks passed
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.

1 participant