Skip to content

Revert "fix: exclude root package from workspace script filters to prevent recursion"#114

Closed
thewtex wants to merge 1 commit intomainfrom
recursive-build
Closed

Revert "fix: exclude root package from workspace script filters to prevent recursion"#114
thewtex wants to merge 1 commit intomainfrom
recursive-build

Conversation

@thewtex
Copy link
Contributor

@thewtex thewtex commented Mar 20, 2026

This reverts commit b852d53.

We are not getting builds of @fideus-labs/fidnii in CI.

Summary by CodeRabbit

  • Chores
    • Updated monorepo build, development, and test scripts for improved workspace package handling and execution.

…event recursion"

This reverts commit b852d53.

We are not getting builds of @fideus-labs/fidnii in CI.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 20, 2026

Deploying convert-fidnii with  Cloudflare Pages  Cloudflare Pages

Latest commit: b8d7fc2
Status: ✅  Deploy successful!
Preview URL: https://79894bbc.convert-fidnii.pages.dev
Branch Preview URL: https://recursive-build.convert-fidnii.pages.dev

View logs

Copilot AI review requested due to automatic review settings March 20, 2026 19:58
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

The pull request modifies three npm scripts in package.json to alter the Bun workspace filtering behavior. The build, dev, and test scripts now use --filter '*' instead of --filter '!./', changing which packages are selected during execution.

Changes

Cohort / File(s) Summary
Bun Workspace Filter Update
package.json
Changed build, dev, and test scripts from --filter '!./' (exclude root) to --filter '*' (include all packages).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Filters flipped from "not root" to "all,"
The workspace now answers the call,
Three scripts align with the '' command,*
Building together across the whole land!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: reverting a previous commit that excluded the root package from workspace script filters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch recursive-build

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reverts the previous change that excluded the root package from Bun workspace script filters, aiming to restore CI builds for @fideus-labs/fidnii.

Changes:

  • Updated root build, dev, and test scripts to use bun run --filter '*' ... instead of excluding the root package.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +17
"build": "bun run --filter '*' build",
"check": "biome check .",
"dev": "bun run --filter '!./' dev",
"dev": "bun run --filter '*' dev",
"format": "biome format --write .",
"lint": "biome lint .",
"prepare": "lefthook install",
"test": "bun run --filter '!./' test"
"test": "bun run --filter '*' test"
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

Using bun run --filter '*' <script> will also match the root workspace package (this package.json). Because the root build/dev/test scripts are implemented by re-invoking bun run --filter ... <script>, including the root package causes self-invocation recursion (or repeated execution) and can hang/overflow CI.

To keep building all workspaces without recursing, exclude the root package explicitly (e.g., by package name) or avoid a wildcard and instead target the known workspace globs (e.g., fidnii and examples/*) in separate invocations.

Copilot uses AI. Check for mistakes.
@greptile-apps
Copy link

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR reverts commit b852d53 ("fix: exclude root package from workspace script filters to prevent recursion"), changing the Bun workspace --filter argument back from '!./' to '*' for the build, dev, and test scripts in the root package.json. The stated motivation is that CI was not producing builds of @fideus-labs/fidnii after the original fix was applied.

Key changes and concerns:

  • The build, dev, and test workspace scripts are reverted to bun run --filter '*' <script>.
  • The reverted commit (b852d53) was added specifically because --filter '*' was observed to include the root package (@fideus-labs/fidnii-monorepo) in the script run — whose own build/dev/test scripts call bun run --filter '*' ... — creating an infinite recursive loop. This PR restores that risk.
  • The CI regression from the !./ fix is likely because --filter '!./' alone (without a positive glob) acts purely as a negation pattern, causing Bun to match zero packages. The correct fix is not a revert, but an explicit path-based filter (--filter './fidnii' --filter './examples/*') that includes all workspace members while safely excluding the root.

Confidence Score: 2/5

  • This PR may fix the immediate CI build gap but re-introduces a confirmed infinite-recursion risk in the workspace scripts.
  • The commit being reverted was authored specifically to fix an observed infinite-recursion bug. Reverting it without addressing the root cause means the recursion issue is back, and the correct fix (explicit path-based workspace filters) is straightforward and low-risk.
  • package.json — the workspace filter patterns for build, dev, and test scripts need attention.

Important Files Changed

Filename Overview
package.json Reverts workspace --filter from '!./' back to '*' for build, dev, and test scripts; re-introduces potential infinite recursion risk that the reverted commit was specifically designed to prevent.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["bun run build (workspace root)"]
    B{"--filter '*'"}
    C["@fideus-labs/fidnii-monorepo (root)\nbuild = bun run --filter '*' build"]
    D["@fideus-labs/fidnii\nbuild = tsc"]
    E["@fideus-labs/fidnii-example-convert\nbuild = tsc && vite build"]
    F["@fideus-labs/fidnii-getting-started\n(no build script – skip)"]
    G["♻️ INFINITE RECURSION"]

    A --> B
    B -->|includes root| C
    B --> D
    B --> E
    B --> F
    C -->|calls itself again| G
    D -->|tsc compiles fidnii/src| H["✅ dist/ produced"]
    E -->|tsc + vite build| I["✅ examples/convert built"]

    style G fill:#ff4444,color:#fff
    style H fill:#22aa44,color:#fff
    style I fill:#22aa44,color:#fff
Loading

Last reviewed commit: "Revert "fix: exclude..."

],
"scripts": {
"build": "bun run --filter '!./' build",
"build": "bun run --filter '*' build",
Copy link

Choose a reason for hiding this comment

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

P1 Potential infinite recursion re-introduced

The original commit b852d53 explicitly added !./ to prevent infinite recursion: when bun run build is invoked at the workspace root, --filter '*' includes the root package (@fideus-labs/fidnii-monorepo) whose build script is bun run --filter '*' build, causing an infinite recursive loop. The revert brings that risk back.

The reason the !./ fix broke CI builds of @fideus-labs/fidnii is likely that --filter '!./' in isolation acts as a negation-only pattern — it excludes root but doesn't provide a positive match set, so Bun ends up running the script in zero packages.

A more robust fix would use explicit workspace-path filters that clearly include all desired workspace members without touching the root:

"build": "bun run --filter './fidnii' --filter './examples/*' build",
"dev":   "bun run --filter './fidnii' --filter './examples/*' dev",
"test":  "bun run --filter './fidnii' --filter './examples/*' test"

This is unambiguous, avoids the recursion entirely, and will reliably build @fideus-labs/fidnii in CI.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Around line 11-17: The workspace scripts "build", "dev", and "test" currently
use bun run --filter '*' which includes the root package and causes recursive
execution; update each script ("build", "dev", "test") to use bun run --filter
'!./' (exclude the root) instead so the root package is not re-selected during
filtered runs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 313e476b-5561-4e1e-82d7-88296e7b7623

📥 Commits

Reviewing files that changed from the base of the PR and between d8b4d10 and b8d7fc2.

📒 Files selected for processing (1)
  • package.json

Comment on lines +11 to +17
"build": "bun run --filter '*' build",
"check": "biome check .",
"dev": "bun run --filter '!./' dev",
"dev": "bun run --filter '*' dev",
"format": "biome format --write .",
"lint": "biome lint .",
"prepare": "lefthook install",
"test": "bun run --filter '!./' test"
"test": "bun run --filter '*' test"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In Bun 1.x workspaces, when executed from monorepo root, does bun run --filter '' <script>include the root package itself? If yes, does that cause recursive execution when the root script is alsobun run --filter '' <script>?

💡 Result:

Yes. In Bun 1.x, the workspace “package set” that --filter operates on includes the root package.json as an addressable package (e.g. you can explicitly target it with --filter './', and Bun’s docs even show excluding it with --filter '!./'). [1]

So from the monorepo root, bun run --filter '*' <script> will match the root package too (assuming * matches its package name / path), meaning the root’s <script> will be executed alongside the workspace packages. [1][2]

And yes: if the root’s <script> is itself bun run --filter '*' <script>, that will cause recursive re-entry (the root run triggers a filtered run that includes root again, etc.) unless you explicitly exclude the root (e.g. --filter '!./') or change the root script to something non-self-referential. [1][2]

Sources: [1] Bun docs: bun --filter (root can be included/excluded via ./ / !./). [2] Bun runtime docs: bun run --filter <pattern> <script> runs a script in all matching workspace packages.


Root package recursion risk with --filter '*' in workspace scripts.

On lines 11, 13, and 17, --filter '*' matches the root package itself. When the root's build, dev, and test scripts execute bun run --filter '*' <script>, the root is re-selected, causing recursive re-entry.

Use --filter '!./' to exclude the root from filtered execution.

Proposed fix
   "scripts": {
-    "build": "bun run --filter '*' build",
+    "build": "bun run --filter '!./' build",
+    "build:fidnii": "bun run --filter './fidnii' build",
     "check": "biome check .",
-    "dev": "bun run --filter '*' dev",
+    "dev": "bun run --filter '!./' dev",
     "format": "biome format --write .",
     "lint": "biome lint .",
     "prepare": "lefthook install",
-    "test": "bun run --filter '*' test"
+    "test": "bun run --filter '!./' test"
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "bun run --filter '*' build",
"check": "biome check .",
"dev": "bun run --filter '!./' dev",
"dev": "bun run --filter '*' dev",
"format": "biome format --write .",
"lint": "biome lint .",
"prepare": "lefthook install",
"test": "bun run --filter '!./' test"
"test": "bun run --filter '*' test"
"build": "bun run --filter '!./' build",
"build:fidnii": "bun run --filter './fidnii' build",
"check": "biome check .",
"dev": "bun run --filter '!./' dev",
"format": "biome format --write .",
"lint": "biome lint .",
"prepare": "lefthook install",
"test": "bun run --filter '!./' test"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 11 - 17, The workspace scripts "build", "dev", and
"test" currently use bun run --filter '*' which includes the root package and
causes recursive execution; update each script ("build", "dev", "test") to use
bun run --filter '!./' (exclude the root) instead so the root package is not
re-selected during filtered runs.

@thewtex
Copy link
Contributor Author

thewtex commented Mar 20, 2026

Needed bun upgrade

@thewtex thewtex closed this Mar 20, 2026
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.

2 participants