Skip to content

Add comprehensive unit and integration test coverage - #568

Merged
jackgranatowski merged 3 commits into
mainfrom
claude/repo-test-coverage-audit-5tkese
Jul 8, 2026
Merged

jackgranatowski merged 3 commits into
mainfrom
claude/repo-test-coverage-audit-5tkese

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds extensive test coverage across the codebase, closing critical gaps in unit testing for pure functions, build scripts, and UI components. The changes introduce 11 new test files covering color math, version synchronization, token registry validation, form styling, motion behavior, power knobs, theme persistence, domain routing, and variable scales.

Key Changes

New Test Files

Configurator unit tests:

  • configurator/tests/colorUtils.test.ts — 7 pure color conversion functions (oklchToRgb, rgbToHex, luminance, contrast ratio, WCAG rating, OKLch parsing/stringification) with zero prior coverage. These functions power every color picker, WCAG panel, and exported palette; a silent regression would corrupt all resolved colors.
  • configurator/tests/powerKnobs.test.ts — Validates knob structure (min/default/max ranges, step size, encode/decode round-trips). Ensures sliders are resettable and emit valid CSS.
  • configurator/tests/theme.test.ts — Tests the studio light/dark theme store (persistence, toggle, root class binding). Covers 8 components' shared theme state.
  • configurator/tests/domains.test.ts — Validates token-to-panel routing (domainOf). Ensures knobs land in the correct UI panel and that the runtime classifier agrees with CI's check-curation.
  • configurator/tests/variableScales.test.ts — Tests sibling-scale option lists for variable pickers (SPACE_SCALE, RADIUS_SCALE, etc.). Verifies exact var(--sf-…) wire format and step completeness.

Build script tests:

  • tests/version-sync.test.js — Positive tests for the version propagator script. Confirms the writer actually syncs all downstream artifacts (roadmap.md, configurator/package.json, package-lock.json) from the source of truth. Validates idempotency and pre-release suffix preservation.
  • tests/check-token-registry.test.js — Negative tests for token registry validation. Asserts the gate catches duplicate ids, nextId violations, uint16 ceiling breaches, and missing catalogue registrations.
  • tests/check-llm-guide.test.js — Negative tests for LLM guide sync. Confirms the gate detects stale token references and missing guide files.
  • tests/check-macro-catalog.test.js — Negative tests for macro class documentation. Validates detection of undocumented CSS classes and phantom documented classes.

Behavioral/integration tests:

  • tests/forms.spec.js — Playwright tests for optional/forms.css. Covers text input, textarea, select styling; disabled state; --sf-field-border-color indirection; placeholder color; and width stretching in both light and dark themes.
  • tests/motion.spec.js — Playwright tests for core/motion.css. Validates prefers-reduced-motion gating, --sf-motion-scale linear scaling, entrance animations, and keyframe binding.

Script Modifications

  • scripts/check-token-registry.js, scripts/version-sync.js, scripts/check-llm-guide.js, scripts/check-macro-catalog.js — Added SLASHED_ROOT environment variable support to allow tests to run these scripts against fixture directories instead of the real repo root.

Notable Implementation Details

  • Color math tests use exact byte-range assertions and hue sweeps to catch gamut clamping regressions.
  • Version sync tests build throwaway fixture trees and verify both the writer's output and that the checker agrees with it (writer ↔ checker contract).
  • Knob tests verify that defaults are reachable in whole steps (float tolerance) so "reset to default" never lands off-grid.
  • Codec tests round-trip encode/decode across the full range to catch non-invertible transformations.
  • Motion tests run with and without prefers-reduced-motion to validate both the media query gating and the --sf-motion-scale scaling formula.
  • Form tests load the optimal bundle in both themes and assert computed style contracts (display, appearance

https://claude.ai/code/session_01SETyJ7R12Bxeuux7yF6y7F

Summary by CodeRabbit

  • Tests

    • Added broader automated coverage for color utilities, theme switching, motion, forms, token registry, macro catalog, domain mapping, variable scales, and version sync behavior.
    • Added negative and regression checks to catch stale references, invalid data, missing files, and accessibility-related style issues.
  • Chores

    • Improved support for running repository checks against alternate roots in test and fixture environments.
    • Made version-sync checks more robust and idempotent.

…n CSS

Close the highest-value coverage gaps found in the repo-wide test audit.

New unit tests (configurator/vitest):
- colorUtils: OKLCH→sRGB, luminance, contrast ratio/rating, oklch parse/round-trip
- variableScales: shape + exact var(--sf-*) wire format of every sibling scale
- powerKnobs: range invariants (min≤default≤max, on-grid) + encode/decode round-trip
- theme.svelte: persistence, toggle, forceTheme (no-persist), dark-class binding
- domains: domainOf routing + misc fallback (locks the check:curation contract)

New negative/writer tests (node --test) — prove the CI gates actually bite:
- version-sync (writer): propagates version to every artifact; checker agrees; idempotent
- check-llm-guide / check-macro-catalog / check-token-registry: each fails on its
  own drift class instead of silently going green

New behavioural specs (Playwright):
- forms.spec: input/textarea/select/:disabled + --sf-field-border-color indirection
- motion.spec: prefers-reduced-motion gating + --sf-motion-scale duration scaling

Enabling fix: version-sync.js and the three check-*.js gates now honour SLASHED_ROOT
(mirroring check-version-sync.js) so they can run against throwaway fixture trees.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SETyJ7R12Bxeuux7yF6y7F
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jackgranatowski, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb28b1d7-2385-4a2c-a225-bf83a6915fa4

📥 Commits

Reviewing files that changed from the base of the PR and between 8c174da and 7971e48.

📒 Files selected for processing (6)
  • scripts/check-llm-guide.js
  • scripts/check-macro-catalog.js
  • scripts/check-token-registry.js
  • scripts/check-version-sync.js
  • scripts/version-sync.js
  • tests/check-macro-catalog.test.js
📝 Walkthrough

Walkthrough

This PR adds new Vitest unit tests for configurator library modules (colorUtils, domains, powerKnobs, theme, variableScales), introduces a SLASHED_ROOT environment variable override for path resolution in five CI gate/writer scripts, adds corresponding Node test suites exercising fixture-based failure scenarios for those scripts, and adds Playwright specs for forms.css and motion.css behavior.

Changes

Configurator library unit tests

Layer / File(s) Summary
Color utility tests
configurator/tests/colorUtils.test.ts
Tests oklchToRgb, rgbToHex, getRelativeLuminance, getContrastRatio, getContrastRating, and parseOklch/stringifyOklch.
Domain classification tests
configurator/tests/domains.test.ts
Tests domainOf mapping, misc fallback, and pattern precedence.
Power knob contract tests
configurator/tests/powerKnobs.test.ts
Tests KNOBS_BY_DOMAIN naming/labels, range invariants, and encode/decode round-tripping.
Theme store tests
configurator/tests/theme.test.ts
Tests setTheme, toggleTheme, bindThemeRoot DOM sync, and forceTheme.
Variable scale tests
configurator/tests/variableScales.test.ts
Tests scale option labels, value formatting, and uniqueness.

SLASHED_ROOT override and gate/writer test coverage

Layer / File(s) Summary
SLASHED_ROOT path resolution
scripts/check-llm-guide.js, scripts/check-macro-catalog.js, scripts/check-token-registry.js, scripts/check-version-sync.js, scripts/version-sync.js
Adds conditional ROOT resolution honoring a trimmed SLASHED_ROOT env var, falling back to the default repo-relative path.
check-llm-guide gate tests
tests/check-llm-guide.test.js
Fixture builder, gate runner, and pass/fail assertions for stale tokens, missing guide, and bare-prefix handling.
check-macro-catalog gate tests
tests/check-macro-catalog.test.js
Fixture builder, gate runner, and assertions for drift, SLASHED_ROOT fallback, and missing files.
check-token-registry gate tests
tests/check-token-registry.test.js
Fixture builder, gate runner, and assertions for duplicate IDs, ID bounds, overflow, and registry/catalogue validation.
version-sync writer tests
tests/version-sync.test.js
Fixture-based tests for downstream artifact updates, pre-release handling, checker agreement, and idempotency.
Forms CSS Playwright spec
tests/forms.spec.js
Validates optional/forms.css styling across light/dark themes.
Motion CSS Playwright spec
tests/motion.spec.js
Validates core/motion.css transition durations and reduced-motion gating.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#29: Adds motion/keyframe utility classes and prefers-reduced-motion behavior in core/motion.css that the new Playwright motion spec directly tests.
  • codeslash-dev/SLASHED#240: Modifies the same scripts/version-sync.js ROOT/path resolution logic extended here with SLASHED_ROOT.
  • codeslash-dev/SLASHED#303: Rewrites domainOf/domain logic in src/lib/domains that the new domains test suite exercises.

Suggested labels: codex

🚥 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 accurately summarizes the PR’s main change: adding broad unit and integration test coverage.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/repo-test-coverage-audit-5tkese

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add unit/integration tests for configurator libs, CI gates, and CSS bundles

🧪 Tests ✨ Enhancement 🕐 40+ Minutes

Grey Divider

AI Description

• Add Vitest unit coverage for configurator color math, domains, knobs, theme, and variable scales.
• Add Node.js gate tests ensuring registry/guide/macro checks and version writer fail/pass
 correctly.
• Add Playwright specs locking styling/motion contracts for forms.css and motion.css.
Diagram

graph TD
  U["Vitest unit tests"] --> L["Configurator lib modules"]
  N["node:test gate tests"] --> S["CI gate scripts"] --> F["Fixture roots (SLASHED_ROOT)"]
  P["Playwright specs"] --> C["CSS bundles (core/optional)"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Refactor gate scripts into importable functions
  • ➕ Avoid spawnSync overhead and improve stack traces on failures
  • ➕ Enable direct unit tests of parsing/validation logic with finer-grained assertions
  • ➖ Requires changing the scripts’ public shape and potentially their CLI behavior
  • ➖ More up-front refactor risk than the current minimal SLASHED_ROOT hook
2. Add property-based tests for color conversions
  • ➕ Better coverage of edge cases (gamut boundaries, rounding) than discrete examples
  • ➕ Can detect regressions across broad input ranges automatically
  • ➖ Can be slower/flakier without careful constraints and seeding
  • ➖ Harder to interpret failures without additional shrinking/diagnostics

Recommendation: The current approach (contract-style unit tests + fixture-driven script tests + targeted Playwright computed-style checks) is a strong, low-risk way to lock behavior without refactoring production code. Consider the “importable functions” refactor only if script logic grows further or spawn-based tests become a bottleneck.

Files changed (15) +944 / -4

Enhancement (4) +10 / -4
check-llm-guide.jsAllow check-llm-guide to run against fixture roots via SLASHED_ROOT +2/-1

Allow check-llm-guide to run against fixture roots via SLASHED_ROOT

• Changes root resolution to prefer process.env.SLASHED_ROOT, enabling isolated negative tests to run the guide gate against temporary directories instead of the real repo root.

scripts/check-llm-guide.js

check-macro-catalog.jsAdd SLASHED_ROOT override for macro catalog gate script +2/-1

Add SLASHED_ROOT override for macro catalog gate script

• Updates root resolution to use SLASHED_ROOT when provided, supporting fixture-based gate testing for docs/CSS drift detection.

scripts/check-macro-catalog.js

check-token-registry.jsAdd SLASHED_ROOT override for token registry gate script +3/-1

Add SLASHED_ROOT override for token registry gate script

• Allows the registry gate to operate on a fixture tree via SLASHED_ROOT, with commentary noting which invariants are skipped without a git baseline. Enables deterministic tests for duplicate/ceiling/nextId/catalog checks.

scripts/check-token-registry.js

version-sync.jsAdd SLASHED_ROOT override for version-sync writer script +3/-1

Add SLASHED_ROOT override for version-sync writer script

• Makes the version propagation script honor SLASHED_ROOT so it can be exercised against throwaway fixture trees. Mirrors the behavior of the existing check-version-sync script for consistent testing.

scripts/version-sync.js

Tests (11) +934 / -0
colorUtils.test.tsAdd Vitest coverage for OKLCH conversion and WCAG contrast helpers +135/-0

Add Vitest coverage for OKLCH conversion and WCAG contrast helpers

• Introduces unit tests for pure color math helpers: OKLCH→sRGB clamping, RGB→hex formatting, luminance and contrast ratio computations, WCAG threshold ratings, and OKLCH parse/stringify round-trips. Uses hue sweeps and boundary checks to catch gamut/rounding regressions.

configurator/tests/colorUtils.test.ts

domains.test.tsTest token-to-domain routing contract (domainOf) +50/-0

Test token-to-domain routing contract (domainOf)

• Adds direct tests for domainOf classifications across known token prefixes plus misc fallbacks. Guards precedence rules and ensures domainOf never returns a key outside DOMAIN_PATTERNS.

configurator/tests/domains.test.ts

powerKnobs.test.tsValidate power knob ranges and codec round-trips +69/-0

Validate power knob ranges and codec round-trips

• Adds contract tests ensuring each knob has unique --sf-* target names, required label/help fields, and valid range invariants (min/default/max/step). Also verifies encode/decode round-trips across each knob’s range and defensive NaN behavior for unparseable values.

configurator/tests/powerKnobs.test.ts

theme.test.tsAdd unit tests for theme store persistence and root class binding +66/-0

Add unit tests for theme store persistence and root class binding

• Covers setTheme/toggleTheme/forceTheme behavior, including localStorage persistence rules and no-persist forcing. Verifies bindThemeRoot applies/removes the dark class as themeState changes.

configurator/tests/theme.test.ts

variableScales.test.tsLock variable scale option lists and var(--sf-*) wire format +46/-0

Lock variable scale option lists and var(--sf-*) wire format

• Adds tests ensuring each sibling scale has the expected ordered labels/steps and that values are well-formed var(--sf-<prefix>-<step>) references. Also asserts option label uniqueness to prevent dropdown collisions.

configurator/tests/variableScales.test.ts

check-llm-guide.test.jsAdd node:test negative coverage for check-llm-guide gate +88/-0

Add node:test negative coverage for check-llm-guide gate

• Builds temporary fixture roots and spawns the gate script to assert pass/fail behavior. Verifies stale token references and missing guide files fail, while prose-like bare prefixes are not treated as references.

tests/check-llm-guide.test.js

check-macro-catalog.test.jsAdd node:test negative coverage for check-macro-catalog drift detection +77/-0

Add node:test negative coverage for check-macro-catalog drift detection

• Creates a minimal macros/css + docs fixture and asserts the gate passes when in sync. Introduces undocumented classes, phantom documented classes, and missing source file scenarios and asserts non-zero exit with expected diagnostics.

tests/check-macro-catalog.test.js

check-token-registry.test.jsAdd node:test negative coverage for check-token-registry invariants +116/-0

Add node:test negative coverage for check-token-registry invariants

• Runs the gate script against fixture registries to prove it fails on duplicate IDs, invalid nextId, uint16 ceiling breaches, and missing/removed catalogue registrations. Includes a well-formed pass case to validate the baseline fixture.

tests/check-token-registry.test.js

forms.spec.jsAdd Playwright computed-style contract tests for optional/forms.css +95/-0

Add Playwright computed-style contract tests for optional/forms.css

• Adds behavioral checks for input/textarea/select styling across light and dark themes, including width stretching, disabled state, placeholder color, and --sf-field-border-color indirection. Uses bundle rendering helpers and reads computed styles for stable assertions.

tests/forms.spec.js

motion.spec.jsAdd Playwright specs for reduced-motion gating and motion scaling +73/-0

Add Playwright specs for reduced-motion gating and motion scaling

• Validates core/motion.css behavior under prefers-reduced-motion no-preference vs reduce. Asserts interactive transition duration matches scaled --sf-duration-fast, scale=0 disables motion, and entrance classes bind/omit keyframe animations correctly.

tests/motion.spec.js

version-sync.test.jsAdd node:test positive coverage for version-sync writer behavior +119/-0

Add node:test positive coverage for version-sync writer behavior

• Builds fixture trees where downstream artifacts are intentionally out of date, runs the writer, and asserts roadmap/configurator package/lock are rewritten to match root package.json. Also verifies writer↔checker agreement, pre-release suffix preservation, and idempotent second runs.

tests/version-sync.test.js

@qodo-code-review

qodo-code-review Bot commented Jul 8, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 12 rules

Grey Divider


Remediation recommended

1. SLASHED_ROOT path not normalized ✓ Resolved 🐞 Bug ☼ Reliability
Description
The modified scripts assign ROOT from process.env.SLASHED_ROOT using ??, so an empty string or
relative path is accepted and then used for reads/writes, potentially targeting the current working
directory (or another unintended tree) instead of the repo/fixture root. This contradicts the helper
contract that root is an absolute repo root and can cause version syncing or CI gates to
read/write the wrong files.
Code

scripts/version-sync.js[R18-23]

+// SLASHED_ROOT lets tests point the writer at a throwaway fixture tree; falls
+// back to the repo root in normal use. Mirrors scripts/check-version-sync.js.
+const ROOT = process.env.SLASHED_ROOT ?? path.resolve(import.meta.dirname, '..');

function readFile(rel) {
  return readFileLib(rel, ROOT);
Relevance

⭐⭐⭐ High

Team often hardens env/config inputs; accepted URL validation and fixture-root correctness fixes in
PRs #562/#444.

PR-#562
PR-#444
PR-#196

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ROOT is taken directly from SLASHED_ROOT via nullish coalescing, which accepts ''/relative
paths unchanged, and downstream helpers explicitly expect an absolute root when joining paths.
This combination can make file operations run against the wrong directory if SLASHED_ROOT is set
incorrectly.

scripts/version-sync.js[18-28]
scripts/check-llm-guide.js[29-33]
scripts/check-token-registry.js[26-31]
scripts/check-macro-catalog.js[19-22]
scripts/lib/parse.js[74-84]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Several scripts now support overriding the repo root via `SLASHED_ROOT`, but they use `process.env.SLASHED_ROOT ?? ...`. Because `??` does not treat `''` as missing and because the value is not normalized, `ROOT` can become an empty string or a relative path. This can make `path.join(ROOT, ...)` resolve relative to the process CWD and can cause the scripts (especially `version-sync.js`, which writes files) to operate on the wrong directory.

## Issue Context
- `scripts/lib/parse.js` documents that `readFile(rel, root)` expects `root` to be an **absolute repo root**.
- The PR adds the same `SLASHED_ROOT ?? ...` pattern in multiple scripts.

## Fix Focus Areas
- scripts/version-sync.js[18-24]
- scripts/check-token-registry.js[26-31]
- scripts/check-llm-guide.js[29-33]
- scripts/check-macro-catalog.js[19-21]

### Suggested implementation
In each script, replace the ROOT assignment with something that:
1) treats empty/whitespace as “unset”,
2) normalizes overrides with `path.resolve`, and
3) optionally validates that the directory exists.

Example:
```js
const raw = process.env.SLASHED_ROOT;
const ROOT = raw && raw.trim()
 ? path.resolve(raw)
 : path.resolve(import.meta.dirname, '..');
```
Optionally:
```js
if (raw && raw.trim() && !fs.existsSync(ROOT)) {
 console.error(`SLASHED_ROOT does not exist: ${ROOT}`);
 process.exit(1);
}
```

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread scripts/version-sync.js
Address Qodo review on #568: `process.env.SLASHED_ROOT ?? …` accepted an
empty string or a relative path, which path.join would resolve against the
process CWD instead of an absolute root (parse.js requires an absolute root).

Treat empty/whitespace as unset and resolve any override to absolute in
version-sync.js and the check-{llm-guide,macro-catalog,token-registry,version-sync}.js
gates. Add a guard test asserting an empty SLASHED_ROOT falls back to the repo root.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SETyJ7R12Bxeuux7yF6y7F
@coderabbitai coderabbitai Bot added the codex label Jul 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
scripts/version-sync.js (1)

22-23: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Same trim/resolve mismatch — apply the fix here too.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/version-sync.js` around lines 22 - 23, The ROOT initialization in
version-sync.js has the same trim/resolve mismatch, so make the resolved path
use the trimmed environment value consistently. Update the ROOT assignment near
the top of the script to pass the trimmed SLASHED_ROOT value into path.resolve,
matching the intended behavior used elsewhere and keeping the handling of ROOT
consistent.
scripts/check-version-sync.js (1)

22-23: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Same trim/resolve mismatch as check-macro-catalog.js.

The trimmed value is used for the truthiness check but the untrimmed value is passed to path.resolve. Apply the same fix here and in the other scripts that share this pattern (check-llm-guide.js, check-token-registry.js, version-sync.js).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/check-version-sync.js` around lines 22 - 23, The ROOT environment
parsing in check-version-sync.js has the same trim/resolve mismatch as the other
validation scripts, where the trimmed value is only used for the truthiness
check but the original untrimmed value is still passed into path.resolve. Update
the ROOT assignment to resolve the already trimmed value, and apply the same
pattern consistently in check-macro-catalog.js, check-llm-guide.js,
check-token-registry.js, and version-sync.js so all scripts use the same
sanitized SLASHED_ROOT handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/check-macro-catalog.js`:
- Around line 22-23: The ROOT initialization in check-macro-catalog.js is using
a trimmed truthiness check but still passes the untrimmed SLASHED_ROOT into
path.resolve, so make the value used by path.resolve be the trimmed env var
instead. Update the ROOT assignment so it consistently derives from the same
trimmed string, keeping the check and resolved path aligned and avoiding
whitespace-sensitive directory targeting.

---

Duplicate comments:
In `@scripts/check-version-sync.js`:
- Around line 22-23: The ROOT environment parsing in check-version-sync.js has
the same trim/resolve mismatch as the other validation scripts, where the
trimmed value is only used for the truthiness check but the original untrimmed
value is still passed into path.resolve. Update the ROOT assignment to resolve
the already trimmed value, and apply the same pattern consistently in
check-macro-catalog.js, check-llm-guide.js, check-token-registry.js, and
version-sync.js so all scripts use the same sanitized SLASHED_ROOT handling.

In `@scripts/version-sync.js`:
- Around line 22-23: The ROOT initialization in version-sync.js has the same
trim/resolve mismatch, so make the resolved path use the trimmed environment
value consistently. Update the ROOT assignment near the top of the script to
pass the trimmed SLASHED_ROOT value into path.resolve, matching the intended
behavior used elsewhere and keeping the handling of ROOT consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ba5a8d9-910b-4084-99c8-8b2f284edc8b

📥 Commits

Reviewing files that changed from the base of the PR and between 4a09f62 and 8c174da.

📒 Files selected for processing (16)
  • configurator/tests/colorUtils.test.ts
  • configurator/tests/domains.test.ts
  • configurator/tests/powerKnobs.test.ts
  • configurator/tests/theme.test.ts
  • configurator/tests/variableScales.test.ts
  • scripts/check-llm-guide.js
  • scripts/check-macro-catalog.js
  • scripts/check-token-registry.js
  • scripts/check-version-sync.js
  • scripts/version-sync.js
  • tests/check-llm-guide.test.js
  • tests/check-macro-catalog.test.js
  • tests/check-token-registry.test.js
  • tests/forms.spec.js
  • tests/motion.spec.js
  • tests/version-sync.test.js

Comment thread scripts/check-macro-catalog.js Outdated
Address CodeRabbit review on #568: the hardening checked
process.env.SLASHED_ROOT?.trim() for truthiness but passed the *untrimmed*
value to path.resolve, so a whitespace-padded override (e.g. "  /tmp/x  ")
would resolve to a padded, wrong path. Capture the trimmed value once and
resolve that, across all five root-resolving scripts. Add a test asserting a
whitespace-padded SLASHED_ROOT resolves to the intended fixture.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SETyJ7R12Bxeuux7yF6y7F
@jackgranatowski
jackgranatowski merged commit 6c9db70 into main Jul 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants