Apply types-resolution fix to legacy/ subpath too#30
Merged
Conversation
The 0.8.1 fix in #29 only patched the main-entry re-exports. The same file-shadowing-folder ambiguity affected src/legacy/index.ts, where 'export * from "./tokens"' was silently dropping every legacy color/ typography/spacing/chartColors symbol from `@policyengine/ui-kit/legacy`. Mirror the fix: pin the re-exports to './tokens/index' and './charts/index'. Verified with a fresh tsc --noEmit against a file:-installed build. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Sorry @MaxGhenis, only members of the PolicyEngine/core-developers team can invoke Claude Code. |
4 tasks
MaxGhenis
added a commit
that referenced
this pull request
May 9, 2026
* Restore legacy colors.blue/colors.success and add consumer-types harness Adversarial review of the merged 0.8.x line surfaced three real follow-ups: 1. The `/legacy` shim's `colors` was missing `blue` (Tailwind sky 50–900) and `success` (#22C55E) that @policyengine/design-system 0.2.0/0.3.0 shipped. The snapshot copied into src/legacy/ for 0.8.0 came from a later workspace build that had already dropped both. Two consumer migrations (PolicyEngine/cbo-baseline-tracker#3, PolicyEngine/uk-spring-statement-2026#22) had to backfill the missing values locally — the canary that the shim wasn't a true 1:1 mirror. Restored under "Semantic colors" / "Blue accent palette" with a comment noting the migration story. 2. The migration JSDoc in src/legacy/index.ts told consumers to map `colors.gray[N]` → `palette.gray[N]` and `colors.text.warning` → `rootColorsLight['--text-warning']` without flagging that both silently change visible hex values (legacy gray is Tailwind-3 #6B7280 etc.; canonical is Slate #64748B etc. — and `--text-warning` was darkened from Mantine orange.9 to Tailwind orange-700 in 0.6.0 for WCAG AA). Annotated each pair as same-hex or value-shifting so bulk sed-replace doesn't silently regress consumers. 3. The bundler-resolution drop fixed in #29 / #30 (dist/<name>.js shadowing dist/<name>/index.d.ts under moduleResolution: "bundler") was masked because nothing in this repo type-checked the package as an external consumer. Added tests/consumer-types/ with a fixture exercising the main entry, the legacy/ subpath, and per-feature subpaths, plus a tsconfig with paths to dist/ and a vitest spawn of tsc --noEmit. CI now runs `bun run build` before `bun run test` so the harness sees fresh dist/ output. Legacy color tests pin colors.blue[50/500/600/900] and colors.success exactly so a future shim regression fails locally instead of in 18+ consumers. 295 tests pass (was 293, +2 for blue/success). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address round 2 nits: colors.info value drift, skip-hint, soften JSDoc - src/legacy/index.ts: flag colors.info → semanticFills.info as a value-shifting pair (design-system 0.3.0 had Ant blue #1890FF; 0.4.0+ and this shim use PE teal-700 #2C7A7B for brand consistency). Consumers bumping from 0.3.x will see a one-time blue→teal shift on info usages. Also softened the module-level JSDoc framing from 'shim mirroring design-system' to acknowledge that some values shifted between 0.3.0 and 0.4.0 and that --text-{warning,error,success} are shim-only accessibility variants. - tests/consumer-types/typecheck.test.ts: switch from describe.skipIf to an explicit it.skip with an actionable hint ("run `bun run build`") so a dev running `bun run test` cold sees why the harness didn't fire instead of silently missing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirror the 0.8.1 fix (#29) to the
legacy/re-exports.src/legacy/index.tshadexport * from './tokens'andexport * from './charts'. Vite emitsdist/legacy/tokens.js/tokens.cjsanddist/legacy/charts.js/charts.cjssiblings to the tsc-emitteddist/legacy/tokens/index.d.tsanddist/legacy/charts/index.d.tsfolders. Same file-shadowing-folder ambiguity, same outcome: TypeScript'sbundlerresolver picked the file (no types) and silently dropped everycolors/typography/spacing/chartColorsre-export from@policyengine/ui-kit/legacy.A separate Batch B migration agent surfaced this when three repos (cbo-baseline-tracker, uk-spring-statement-2026, aspen-eitc-ctc) had to add local workarounds because
@policyengine/ui-kit/legacywasn't exposing the symbols. With this fix shipped, those workarounds can be simplified.Fix
Pin to
'./tokens/index'and'./charts/index'— same pattern as #29.Test plan
bun run typecheckcleanbun run test— 26 files, 292 tests passbun run buildcleanfile:-installed consumer withmoduleResolution: "bundler"(import { colors, typography, spacing, chartColors } from "@policyengine/ui-kit/legacy"resolves cleanly)🤖 Generated with Claude Code