Skip to content

ci: add circular dependency check for package entrypoints#8003

Merged
mimecuvalo merged 6 commits intomainfrom
mime/circle-circle-dot-dot
Feb 18, 2026
Merged

ci: add circular dependency check for package entrypoints#8003
mimecuvalo merged 6 commits intomainfrom
mime/circle-circle-dot-dot

Conversation

@mimecuvalo
Copy link
Copy Markdown
Member

@mimecuvalo mimecuvalo commented Feb 18, 2026

Summary

  • add vite-plugin-circular-dependency and a new yarn check-circular-deps script
  • run a Vite-based circular import check across all packages/*/src/index.ts entrypoints
  • wire the check into the main CI checks workflow to prevent regressions

Follow-up to #7935.
Related to #2458.

Change type

  • other

Test plan

  • Run yarn check-circular-deps
  • Verify CI workflow includes Check circular dependencies

Made with Cursor


Note

Medium Risk
Adds a new CI gate that may introduce flaky/slow builds or unexpected failures on certain package graphs. The code refactor is mostly import/move-only but touches core arrow geometry helpers used widely in tldraw.

Overview
CI now blocks circular imports. Adds yarn check-circular-deps and wires it into the main Checks workflow, using vite-plugin-circular-dependency to scan each packages/*/src/index.ts entrypoint (with scoped splitting for packages/tldraw to avoid large-graph crashes).

Separately, refactors arrow utilities by extracting getArrowInfo from shapes/arrow/shared.ts into a new getArrowInfo.ts module and updating all imports/exports accordingly, and tweaks editor component imports plus DefaultLoadingScreen to render its own .tl-loading wrapper instead of relying on TldrawEditor’s LoadingScreen component.

Written by Cursor Bugbot for commit 4042079. This will update automatically on new commits. Configure here.

Add a CI guard using vite-plugin-circular-dependency so circular imports in package entrypoints are caught early and we don't regress after #7935.

Co-authored-by: Cursor <[email protected]>
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples Ready Ready Preview Feb 18, 2026 3:47pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Preview Feb 18, 2026 3:47pm
tldraw-docs Ignored Ignored Preview Feb 18, 2026 3:47pm
chat-template Skipped Skipped Feb 18, 2026 3:47pm
tldraw-shader Skipped Skipped Feb 18, 2026 3:47pm
workflow-template Skipped Skipped Feb 18, 2026 3:47pm

Request Review

@huppy-bot huppy-bot bot added the other ⚙️ Changes that don't affect SDK users, e.g. internal or .com changes label Feb 18, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

},
},
})
cycleReport = JSON.parse(readFileSync(outputFilePath, 'utf8'))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unchecked file read assumes plugin creates output file

Medium Severity

The code unconditionally reads outputFilePath after the Vite build completes, assuming vite-plugin-circular-dependency always creates the file. If the plugin doesn't create the file (due to a plugin issue, file system error, or unexpected behavior), readFileSync throws an error that gets caught at line 175 and swallowed, incorrectly marking packages as failed even when they have no circular dependencies.

Fix in Cursor Fix in Web

packageEntryPath,
JSON.stringify(includePatternSets),
],
{ cwd: REPO_ROOT },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing maxBuffer could cause false check failures

Medium Severity

The execFile call lacks a maxBuffer option, defaulting to 200KB. When checking packages with verbose Vite builds or extensive circular dependency reports, output can exceed this limit, causing Node to kill the child process with a buffer overflow error. The package would be incorrectly marked as failed even if the check itself succeeded. Other scripts in this codebase use maxBuffer: 50 * 1024 * 1024.

Fix in Cursor Fix in Web

Merged via the queue into main with commit b51a70f Feb 18, 2026
21 checks passed
@mimecuvalo mimecuvalo deleted the mime/circle-circle-dot-dot branch February 18, 2026 16:14
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2026
i originally removed these but they're necessary to keep things speedy

## Summary
- document why tldraw checks use dynamic batched include sets with
`vite-plugin-circular-dependency`
- reduce tldraw scan runtime by combining safe scopes while keeping
`ui/components` and `ui/context` separate to avoid plugin `Invalid array
length` crashes
- run scoped checks with bounded concurrency to improve local and CI
performance without reducing coverage

Follow-up to #8003.
Related to #7935 and #2458.

### Change type

- [x] `other`

## Test plan
- [x] Run `yarn check-circular-deps`
- [x] Run `time yarn check-circular-deps` and verify improved runtime

Made with [Cursor](https://cursor.com)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Build-time CI script changes only; main risk is false
negatives/positives if the new include batching misses files or alters
scan boundaries.
> 
> **Overview**
> Speeds up `yarn check-circular-deps` by changing `tldraw`’s include
patterns from per-scope scans to **filesystem-discovered batches**,
scanning all non-UI scopes together while keeping `ui/components` and
`ui/context` isolated to avoid `vite-plugin-circular-dependency`
“Invalid array length” crashes.
> 
> Also runs each include-set check via a small worker queue with
**bounded concurrency** (up to 2 for `tldraw`) instead of strictly
serial execution, improving CI/local runtime without reducing coverage.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f2393ce. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

other ⚙️ Changes that don't affect SDK users, e.g. internal or .com changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant