Skip to content

fix(build): suppress Turbopack over-bundling warning from agentSkills generator (#6582) - #6720

Merged
diegosouzapw merged 3 commits into
release/v3.8.47from
fix/6582-turbopack-warnings
Jul 10, 2026
Merged

diegosouzapw merged 3 commits into
release/v3.8.47from
fix/6582-turbopack-warnings

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Closes #6582

Root cause

src/lib/agentSkills/generator.ts:247 builds outputBase as path.isAbsolute(outputDir) ? outputDir : path.join(process.cwd(), outputDir), where outputDir is a runtime function parameter, not a compile-time literal. Turbopack's build-time file-tracing analyzer can't statically narrow the dynamic readdirSync/rmSync/readFileSync/writeFileSync call sites a few lines below, so it falls back to a project-wide glob — once per Next.js entry point that imports the module (/api/agent-skills/generate, /api/cli-tools/pi-settings). #6366's commit message claimed to "anchor the base path with a literal" but the shipped code never did; a later "#6366 regression" fix only added an isAbsolute() guard for absolute test paths.

Fix

Since the fs access is legitimate and bounded (skills/<id>/SKILL.md, ~48 known IDs), rather than fight the analyzer, next.config.mjs's turbopack.ignoreIssue (Next.js 16.2+) now suppresses this specific, known-benign diagnostic — mirroring the existing webpack.ignoreWarnings/isNextIntlExtractorDynamicImportWarning precedent already in the same file for the webpack path.

TDD evidence

No unit-testable repro exists for a Turbopack compiler diagnostic (confirmed by prior /triage-fix-bugs analysis), so the regression guard is a config-shape assertion in tests/unit/next-config.test.ts:

  • RED (base next.config.mjs, no ignoreIssue rule):
    ✖ turbopack.ignoreIssue suppresses the agentSkills over-bundling warning (#6582)
      AssertionError: expected turbopack.ignoreIssue to be an array
    
  • GREEN (with the fix):
    ✔ turbopack.ignoreIssue suppresses the agentSkills over-bundling warning (#6582)
    

Gates run (green)

  • node --import tsx/esm --test tests/unit/next-config.test.ts — 7/7 pass
  • Sibling next.config.mjs consumers (dev-origins-config, redirects-cli-renames, mitm-stub-alias-6344, csp-lan-ws-5083, api/root-catchall-json-404) — 21/21 pass
  • node scripts/check/check-file-size.mjs — OK, no violations on touched files
  • node scripts/check/check-complexity.mjs — OK (2052 violations, baseline 2053)
  • node scripts/check/check-cognitive-complexity.mjs — OK (884 violations, baseline 884)
  • npx eslint --suppressions-location config/quality/eslint-suppressions.json next.config.mjs tests/unit/next-config.test.ts — exit 0
  • node scripts/check/check-changelog-integrity.mjs — OK
  • npm run typecheck:core — pre-existing base-red on open-sse/services/compression/engines/omniglyphAdapter.ts/stats.ts (missing omniglyph module, from feat(compression): omniglyph engine (context-as-image, Fable 5 direct) — stack + single mode #6556), unrelated to this diff (confirmed: git diff origin/release/v3.8.47 --stat touches only CHANGELOG.md, next.config.mjs, tests/unit/next-config.test.ts)

No release-freeze active at time of PR (gh issue list --label release-freeze --state open empty).

Loading
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