fix: gate built assets and guard generators against silent drift - #176
Conversation
Closes the "green CI, stale artifact" gaps found in the codebase audit: - ci: fail the PR when the committed admin-app / editor-app bundles (assets/admin-app, integrations/bricks/assets/editor-app) don't match a fresh build. These are committed, runtime-loaded artifacts that CI built but never diffed, so a source change without a rebuild shipped silently. - ci(release): rebuild editor-app in the release job (only admin-app was rebuilt), so releases can't ship a stale editor bundle. - fix(gen-class-hints): refuse to overwrite classes-hints.json when the framework CSS source is absent, instead of silently writing a truncated (manual/override-only) map over the committed file. - test(color-math): golden OKLCH<->hex + round-trip PHPUnit coverage so the PHP swatch math can't drift from its JS counterpart unnoticed. - test(dupes): assert the two byte-identical color-model.js copies stay identical, and that PHP BUILTIN_DEFAULTS mirrors JS ELEMENT_TYPE_LABEL_MAP. - docs/comments: correct the stale .syncignore description in sync-core.mjs and the classes-hints.json filename in CLAUDE.md; add .nvmrc (node 22). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SRP2W4xhP46TZg5Pbnwxob
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds CI/release workflow guards that fail builds when committed editor-app or admin-app bundles are stale, pins Node.js to version 22 via .nvmrc, adds a safeguard against generating truncated classes-hints.json, and introduces PHPUnit and Node tests for color-math conversions and PHP/JS mirror consistency, alongside minor doc updates. ChangesBuild drift guards and mirror tests
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoGate committed bundles and prevent silent drift in CI/generators
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
8 rules 1.
|
…int sources Addresses two bugs found in review of #176: - release.yml called `npm run build:editor-app`, but that root script only built the subpackage — it never installed its deps, and the repo isn't an npm workspace so root `npm ci` doesn't reach it, so the release build could fail on a missing Vite/Svelte toolchain. Make `build:editor-app` self-install (`cd … && npm ci && npm run build`), mirroring `build:admin-app`, so both apps behave identically in release and local full builds. - gen-class-hints write guard used `SOURCE_FILES.some(...)`, so a partial or mispointed framework checkout (only some CSS sources present) still passed and could overwrite classes-hints.json with a truncated map. Require EVERY source to resolve and list the missing files, matching gen-bricks-inventory's fail-on-any-missing stance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SRP2W4xhP46TZg5Pbnwxob
Summary
Closes the "green CI, stale/incorrect artifact" gaps found in a full-tree audit. The theme is silent drift: places where a source change (or a missing input) produced a wrong committed artifact without anything failing.
ci.yml):assets/admin-app/andintegrations/bricks/assets/editor-app/are committed, runtime-loaded bundles. CI built them but never diffed against the committed copies, so editing app source (or a framework sync) without a rebuild shipped stale JS silently. Both build jobs now fail viagit status --porcelainon the artifact dirs (.mapfiles are gitignored, so no false positives).release.yml): the release job rebuilt only admin-app, so a release could ship a stale editor bundle. Added theBuild editor-appstep.scripts/gen-class-hints.js): running the writer without a framework checkout silently overwroteclasses-hints.jsonwith a truncated (manual/override-only) map. It now exits non-zero instead of clobbering. (--checkmode is unchanged — it still reports drift loudly.)tests-php/ColorMathTest.php): the PHP OKLCH↔hex math (swatch previews) had no test and could drift from its JS counterpart. Added goldenoklch_to_hex/parse_oklch/hex_to_oklchvalues plus hex→oklch→hex round-trips.tests/color-model-copies-identical.test.jsasserts the two intentionally-identicalcolor-model.jscopies stay byte-identical (onlyclassifyVarbehaviour was previously guarded);tests/element-types-mirror.test.jsasserts PHPBUILTIN_DEFAULTSmirrors JSELEMENT_TYPE_LABEL_MAP..syncignoredescription insync-core.mjsand theclasses-hints.jsonfilename inCLAUDE.md; added.nvmrc(node 22, matching CI).Type
Checklist
npm testpasses (144/144, incl. 3 new guard tests)npm run lint:phppasses (php -l, 34 files)npm run verifypassesNotes
ColorMathTest.phpcouldn't be executed here (composer installcan't reach github.com through the sandbox proxy) — it will run under the CIqualityjob'scomposer phpunit. Golden values and round-trips were validated with a standalone PHP harness against the currentSlashed_Color_Math.phpcs.xml.distignore_warnings_on_exit=1 → 0. That would very likely turn CI red on pre-existing WPCS warnings, andphpcs/phpstancan't be run in this environment to see/fix them first. Best done in a follow-up where the tooling runs.🤖 Generated with Claude Code
https://claude.ai/code/session_01SRP2W4xhP46TZg5Pbnwxob
Generated by Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores