Skip to content

Name SCC-merged shared modules after their largest member — short + stable (#35)#44

Merged
jagguji merged 1 commit into
mainfrom
35-stable-module-names
Jun 11, 2026
Merged

Name SCC-merged shared modules after their largest member — short + stable (#35)#44
jagguji merged 1 commit into
mainfrom
35-stable-module-names

Conversation

@jagguji

@jagguji jagguji commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

What

Closes #35 (probe I-9). A cyclic shared-type group was named by concatenating every member home-domain — ComponentsMenubarRootStoreToastTypes (40+ chars) — which was unreadable AND unstable: any SCC edge change reshuffled the name, breaking consumers' qualified references (Module.foo) across regenerations. Critical for the blend-rescript sync, where generated module paths are referenced from juspay-portal.

Change

planSharedModules names a merged SCC after its largest member (most types; alphabetical tie-break) + SharedTypes:

Before (40-char concat) After
ComponentsMenubarRootStoreToastTypes RootSharedTypes
PositionerTabUtilsTypes PositionerSharedTypes
CjsClassesDateFnsLocaleTypesTypes (day-picker) LocaleSharedTypes
ChartsV2HighchartsOptionsTypes (blend) HighchartsSharedTypes

Why it's stable

The name tracks the largest member, so adding or removing a small domain from the cycle doesn't change which member is largest → the module name holds → consumers' PositionerSharedTypes.foo references survive a regeneration. (A perturbation that changes the largest member does rename it — that's allowed by the acceptance criteria.)

Verified

  • base-ui merged modules: PositionerSharedTypes (21 chars), RootSharedTypes (15) — both ≤25, the 40-char monster gone
  • Names identical across two consecutive runs (stability check)
  • 265 files compile; goldens unaffected (none has a cross-domain SCC); bench 8/8 PASS
  • The large baseline diff (272 files) is purely mechanical qualified-ref renames — review for stability, not content (per the acceptance note)

The optional --shared-module-name single-sink flag is left as a follow-up (not needed for the acceptance criteria).

Closes #35 (probe I-9). A cyclic shared-type group was named by concatenating
every member home-domain -> 'ComponentsMenubarRootStoreToastTypes' (40+ chars),
which also RESHUFFLED whenever an SCC edge changed, breaking consumers'
qualified references (Module.foo) across regenerations.

planSharedModules now names a merged SCC after its LARGEST member (most types;
alphabetical tie-break) + 'SharedTypes' -> 'PositionerSharedTypes' (21 chars),
'RootSharedTypes' (15). Short, readable, and stable: adding/removing a small
domain to the cycle doesn't change which member is largest, so the name holds.

Verified: base-ui merged modules are PositionerSharedTypes / RootSharedTypes
(both <=25 chars, the 40-char monster gone); names identical across two runs;
265 files compile; goldens unaffected (none has a cross-domain SCC); bench 8/8.
TYPE_MAPPING + CHANGELOG. The optional --shared-module-name sink flag is left
as a follow-up (not needed for the acceptance criteria).
@github-actions

Copy link
Copy Markdown

Benchmark: ✅ PASS

Package Compile Diff vs baseline usable review broken Verdict
@juspay/blend-design-system@0.0.36 identical 94 0 0 ✅ PASS
react-day-picker@10.0.1 identical 27 0 0 ✅ PASS
react-tooltip@6.0.7 identical 0 1 0 ✅ PASS
react-markdown@10.1.0 identical 0 2 0 ✅ PASS
@smastrom/react-rating@1.5.0 identical 0 1 0 ✅ PASS
clsx@2.1.1 identical 0 0 0 ✅ PASS
hono@4.12.25 identical 0 0 0 ✅ PASS
@base-ui-components/react@1.0.0-rc.0 identical 182 13 0 ✅ PASS

@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@juspay/rescript-bindgen@44

commit: 95f8c6a

@jagguji jagguji merged commit 75590cd into main Jun 11, 2026
8 checks passed
@jagguji jagguji deleted the 35-stable-module-names branch June 11, 2026 12:32
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.

Stable, readable names for SCC-merged shared modules (probe I-9)

1 participant