Skip to content

Fix knip duplicate-export failure breaking lint on main - #4718

Merged
justin808 merged 1 commit into
mainfrom
fix/knip-duplicate-source-map-export
Jul 18, 2026
Merged

Fix knip duplicate-export failure breaking lint on main#4718
justin808 merged 1 commit into
mainfrom
fix/knip-duplicate-source-map-export

Conversation

@justin808

@justin808 justin808 commented Jul 17, 2026

Copy link
Copy Markdown
Member

Why

Main is red: the Lint JS and Ruby workflow fails on pnpm exec knip since #4711 merged (failing run). knip's duplicate-exports rule flags MAX_EXTERNAL_SOURCE_MAP_BYTES = MAX_INLINE_SOURCE_MAP_BYTES in vmSourceMapSupport.ts as one value exported under two names. A red lint gate on main fails every PR branch, so this blocks the whole open-PR queue.

What

Route both source-map size caps through a private shared constant (MAX_SOURCE_MAP_BYTES) so the two exports stay distinct symbols with the same value. No behavior change; the intentional unit difference (string length vs bytes-on-disk) documented in the surrounding comments is preserved.

Test plan

  • pnpm exec knip → exit 0 (was exit 1 with Duplicate exports (1))
  • pnpm exec knip --production → exit 0
  • pnpm exec jest tests/vmSourceMapSupport.test.ts in packages/react-on-rails-pro-node-renderer → 57 passed
  • Prettier + ESLint clean on the changed file

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Standardized the maximum supported size for inline and external source maps.
    • Preserved separate limits for each source map type while ensuring they use the same size ceiling.

knip's duplicate-exports rule flags MAX_EXTERNAL_SOURCE_MAP_BYTES
re-exporting the MAX_INLINE_SOURCE_MAP_BYTES binding. Route both caps
through a private shared constant so they stay distinct exported symbols
with the same value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@justin808

Copy link
Copy Markdown
Member Author

+ci-run-hosted

@github-actions github-actions Bot added the ready-for-hosted-ci Run optimized hosted GitHub CI for this PR label Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hosted CI Requested

Triggered 9 workflow(s) for cca1822b9d7b.
Mode: optimized hosted CI (path-selected by script/ci-changes-detector).
Added ready-for-hosted-ci, so future commits will keep running optimized hosted CI until +ci-stop-hosted is used.

View progress in the Actions tab.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab17ecb4-1c8a-4d96-bd1f-ecca12f6a563

📥 Commits

Reviewing files that changed from the base of the PR and between 95d5575 and cca1822.

📒 Files selected for processing (1)
  • packages/react-on-rails-pro-node-renderer/src/worker/vmSourceMapSupport.ts

Walkthrough

The source-map support module introduces a shared private 50 MB byte ceiling and updates both inline and external source-map limit exports to reference it directly.

Changes

Source-map limit centralization

Layer / File(s) Summary
Shared source-map ceiling
packages/react-on-rails-pro-node-renderer/src/worker/vmSourceMapSupport.ts
Adds a shared byte-size constant and uses it for both inline and external source-map limits.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: abanoubghadban

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 Knip’s duplicate-export lint failure on main.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/knip-duplicate-source-map-export

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.

@claude

claude Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review

Overview: Fixes a red main lint gate — knip's duplicate-exports rule flagged MAX_EXTERNAL_SOURCE_MAP_BYTES = MAX_INLINE_SOURCE_MAP_BYTES in vmSourceMapSupport.ts as one value re-exported under two names. The fix introduces a private, non-exported MAX_SOURCE_MAP_BYTES constant and has both public constants reference it independently, so they remain distinct symbols to knip while keeping the same runtime value (50 * 1024 * 1024).

Correctness

  • ✅ Verified: both MAX_INLINE_SOURCE_MAP_BYTES and MAX_EXTERNAL_SOURCE_MAP_BYTES still resolve to the same numeric value at runtime, so no behavior change.
  • ✅ The comment block correctly documents that despite sharing a value, the two constants compare against different units (string length vs. bytes-on-disk) — this nuance is preserved, not lost, by the refactor.
  • ✅ Minimal, single-file, single-purpose diff (+6/-2) — appropriately scoped to just unblocking the lint gate.

Code quality

  • The new inline comment on MAX_SOURCE_MAP_BYTES clearly explains why the private indirection exists (to appease knip's duplicate-export check), which is exactly the kind of non-obvious rationale worth documenting.
  • Naming is consistent with the existing MAX_*_BYTES convention in the file.

Test coverage

  • No test changes needed/made — existing tests import the public constants (MAX_EXTERNAL_SOURCE_MAP_BYTES, MAX_INLINE_SOURCE_MAP_BYTES) and exercise the size-gate behavior; since those exports keep their same values, all existing assertions remain valid. PR description confirms the full suite passes (57 tests) plus knip now exits 0 in both default and --production modes.

Risk: Very low. This is a pure refactor to satisfy a static-analysis tool; no logic paths changed. No security implications.

No blocking issues found — this looks ready to merge as an unblock for the open-PR queue.

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown

Greptile Summary

This PR preserves both source-map size limits while separating their exports for knip.

  • Adds a private shared 50 MiB constant.
  • Initializes the inline and external exported limits from that constant.
  • Keeps the existing export names and runtime values unchanged.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/react-on-rails-pro-node-renderer/src/worker/vmSourceMapSupport.ts Adds a private shared size constant while preserving both exported limits and their behavior.

Reviews (1): Last reviewed commit: "Fix knip duplicate-export failure on mai..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react-on-rails/client bundled (gzip) 63.54 KB (0%)
react-on-rails/client bundled (gzip) (time) 63.54 KB (0%)
react-on-rails/client bundled (brotli) 54.55 KB (0%)
react-on-rails/client bundled (brotli) (time) 54.55 KB (0%)
react-on-rails-pro/client bundled (gzip) 64.92 KB (0%)
react-on-rails-pro/client bundled (gzip) (time) 64.92 KB (0%)
react-on-rails-pro/client bundled (brotli) 55.82 KB (0%)
react-on-rails-pro/client bundled (brotli) (time) 55.82 KB (0%)
registerServerComponent/client bundled (gzip) 135.42 KB (0%)
registerServerComponent/client bundled (gzip) (time) 135.42 KB (0%)
registerServerComponent/client bundled (brotli) 81.72 KB (0%)
registerServerComponent/client bundled (brotli) (time) 81.72 KB (0%)
wrapServerComponentRenderer/client bundled (gzip) 127.87 KB (+0.01% 🔺)
wrapServerComponentRenderer/client bundled (gzip) (time) 127.87 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) 74.88 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) (time) 74.88 KB (0%)

@justin808
justin808 added this pull request to the merge queue Jul 18, 2026
Merged via the queue into main with commit ffb506e Jul 18, 2026
72 checks passed
@justin808
justin808 deleted the fix/knip-duplicate-source-map-export branch July 18, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-hosted-ci Run optimized hosted GitHub CI for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant