Skip to content

fix(#62): complete styled-components v6 migration - #65

Merged
shairevivo merged 2 commits into
mainfrom
agent/62-styled-components-v6-migration
Nov 10, 2026
Merged

shairevivo merged 2 commits into
mainfrom
agent/62-styled-components-v6-migration

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

This finishes the styled-components v6 migration that PR #53 started. That PR changed only package.json and package-lock.json, so the source still uses v5-only APIs.

Changes

  • Macro imports: the ten component style.ts files now import from styled-components instead of styled-components/macro, which v6 no longer ships. babel-plugin-macros.config.js is deleted because it only configured the styled-components macro.
  • Theme typing: src/commons/style/index.d.ts now adds StyleClosetTheme to DefaultTheme via module augmentation. This replaces the v5 ThemedStyledComponentsModule cast and the old createGlobalStyle declarations. src/commons/style/styled-components.ts now re-exports styled, css, createGlobalStyle, keyframes and ThemeProvider directly.
  • Transient props: isOpen → $isOpen and large → $large (Cart), sku → $sku (Product). v6 no longer forwards these styling-only props to the DOM.
  • Dependencies: removed the outdated @types/styled-components (v6 ships its own types). The lockfile change only removes that package and two transitive packages nothing else uses.
  • Snapshots: updated 10 Jest snapshots. Only generated class names changed (e.g. Loader__Container-sc-5z440p-0 → sc-bdnzMm), and no prop attributes appear in the DOM.

Testing

  • grep -r "styled-components/macro" src finds nothing.
  • npx eslint ./src is clean.
  • tsc --noEmit passes and all tests pass (19 suites, 39 tests). The test run shows no styled-components or React unknown-prop warnings.

Caveats

🤖 Generated with Claude Code


Closes #62

Post-script verification

  • Branch is not main/master (agent/62-styled-components-v6-migration)
  • Secret scan passed (gitleaks — b43a8796bb612bb0e9a5b3ad100109761b01a1c6..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

PR #53 bumped styled-components to v6 without updating code still
using v5-only APIs, leaving main unable to resolve modules.

- Import from 'styled-components' instead of the removed
  'styled-components/macro' in the ten component style.ts files,
  and delete babel-plugin-macros.config.js (it only configured the
  styled-components macro).
- Replace the v5 ThemedStyledComponentsModule cast with a
  DefaultTheme module augmentation in src/commons/style/index.d.ts
  and re-export css/createGlobalStyle/keyframes/ThemeProvider
  directly.
- Use transient props ($isOpen, $large, $sku) in Cart and Product so
  styling-only props are not forwarded to the DOM in v6.
- Drop the stale @types/styled-components devDependency (v6 ships its
  own types) and update Jest snapshots; only generated class names
  changed.

Verified with TypeScript 4.9.5 swapped into node_modules, because
the TypeScript 7 on main breaks tsc and react-scripts (#60): tsc
--noEmit passes, all 39 tests pass, and eslint is clean. The lockfile
was updated with --legacy-peer-deps because of the same TS 7 peer
conflict.

Closes #62

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Nov 10, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:08 AM UTC · Completed 10:22 AM UTC

Commit: b3715a1 · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $4.99

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

<!-- fullsend:risk-assessment -->
Risk Assessment: moderate (2/5)

Details

Bot-authored, well-scoped migration completing issue #62 with full acceptance criteria coverage and no protected or security-sensitive paths; composite score of 2 is held at the prior assessment level, with the large blast radius (28 files, mostly auto-generated snapshots) and two dependency file changes offset by low git churn, single-author history on source files, and clear issue-to-PR traceability.

Previous run

<!-- fullsend:risk-assessment -->
Risk Assessment: moderate (2/5)

Details

Bot-authored migration scoped to issue #62 with no protected or security-sensitive paths. Two signals raise the score: the large blast radius (27 files) and the two dependency files changed. Source files show low churn and no author contention.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [test-inadequate] src/components/Cart/Cart.test.tsx:41 — The new transient-prop test's console.error assertion cannot reliably catch a regression from $isOpen back to isOpen. React DOM's dev-mode unknown-prop warning is deduplicated per prop name per module instance. The earlier snapshot test (should render correctly, line 17) renders the closed cart in the same module registry without a spy, and S.Container always receives the open/closed prop. So an isOpen leak would warn there and not again inside this test's spy. The innerHTML check (line 37) can't catch it either, because React drops boolean-valued unknown props from the DOM. Only the $large path, which renders only when the cart is open, is reliably covered.
    Remediation: Make the check order-independent. Either install the spy in beforeEach/afterEach for the whole describe block and assert after both renders, or use jest.isolateModules/jest.resetModules so React's warning dedupe starts fresh inside this test.
  • [uxd-evaluate-code-heuristics] src/components/Cart/Cart.tsx:29 — The cart toggle button's accessible name is the literal "X" when the cart is open (the new test at Cart.test.tsx:33 queries { name: 'X' }). When the cart is closed, the name comes from the child title "Products in cart quantity". Neither describes the button's action. This code predates the PR and is unchanged by it.
    Remediation: Add a state-aware aria-label to S.CartButton (e.g. isOpen ? 'Close cart' : 'Open cart') and mark the visible "X" aria-hidden.
  • [uxd-evaluate-code-heuristics] src/components/Products/Product/Product.tsx:58 — <S.Image alt={title} /> renders a styled div (Product/style.ts:22) that shows the product picture as a CSS background image. alt has no meaning on a div, so the image has no accessible name. This code predates the PR and is unchanged by it.
    Remediation: Render a real <img alt={title}>, or give the div role="img" and aria-label={title}.
  • [uxd-evaluate-code-heuristics] src/components/Products/Product/Product.tsx:68 — S.BuyButton has tabIndex={-1}, which removes "Add to cart" from the tab order. Keyboard users have to go through the outer S.Container (line 56) instead: a div with a positive tabIndex={1} and an onKeyUp handler, but no semantic role. This code predates the PR and is unchanged by it.
    Remediation: Remove tabIndex={-1} from the button (or set it to 0). Change the container's tabIndex={1} to 0, or move the Enter handler to the button.

Earlier findings

  • src/components/Cart/style.ts:45 — logic-error — resolved by change: line 44 now uses theme.colors.primary instead of the undefined theme.colors.black.
  • src/components/Cart/Cart.test.tsx — missing-test — resolved by change: lines 22–45 add a test that opens the cart and checks that isOpen and large don't reach the DOM. A narrower test-robustness gap remains (see the Low finding above).
Previous run

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImxvZ2ljLWVycm9yIiwiZmlsZSI6InNyYy9jb21wb25lbnRzL0NhcnQvc3R5bGUudHMiLCJpZCI6ImZfMjQ0YjMyM2YzMGE2OWIyOCIsImxpbmUiOjQ1LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJjb3JyZWN0bmVzcyJ9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6Im1pc3NpbmctdGVzdCIsImZpbGUiOiJzcmMvY29tcG9uZW50cy9DYXJ0L0NhcnQudGVzdC50c3giLCJpZCI6ImZfN2FiYTJjOWFiNDNmZTU0NSIsImFjdGlvbmFibGUiOnRydWUsImRpbWVuc2lvbiI6ImNvcnJlY3RuZXNzIn0seyJzZXZlcml0eSI6ImxvdyIsImNhdGVnb3J5IjoidXhkLWV2YWx1YXRlLWNvZGUtaGV1cmlzdGljcyIsImZpbGUiOiJzcmMvY29tcG9uZW50cy9Qcm9kdWN0cy9Qcm9kdWN0L1Byb2R1Y3QudHN4IiwiaWQiOiJmXzIyNmQxYWM2MjRjNTczNzAiLCJsaW5lIjo1OCwiYWN0aW9uYWJsZSI6ZmFsc2UsImRpbWVuc2lvbiI6InVzZXItZXhwZXJpZW5jZSJ9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6InV4ZC1ldmFsdWF0ZS1jb2RlLWhldXJpc3RpY3MiLCJmaWxlIjoic3JjL2NvbXBvbmVudHMvQ2FydC9DYXJ0LnRzeCIsImlkIjoiZl85N2MxZjU5YjkwNTNiNGJkIiwibGluZSI6MjksImFjdGlvbmFibGUiOmZhbHNlLCJkaW1lbnNpb24iOiJ1c2VyLWV4cGVyaWVuY2UifV19 -->

Review

Findings

Medium

  • [logic-error] src/components/Cart/style.ts:45: The new DefaultTheme augmentation in src/commons/style/index.d.ts types theme as StyleClosetTheme, so theme.colors is now { primary: string; secondary: string }.

    Remediation: Either restore black: '#000000' in colors in src/commons/style/theme.ts, or replace theme.colors.black with a defined theme color. Then confirm with npx tsc --noEmit using a react-scripts-compatible TypeScript.

Low

  • [missing-test] src/components/Cart/Cart.test.tsx: The transient-prop rename (isOpen→$isOpen, large→$large, sku→$sku) is covered only by snapshots.

    • The Cart snapshot renders only the closed state, so the $isOpen=true and $large paths never render.
    • Snapshots don't capture CSS, so a styling regression from a prop mismatch would go unnoticed.

    Remediation: Add a Cart test that renders the open cart and asserts no isOpen/large attributes reach the DOM. Optionally, use jest-styled-components' toHaveStyleRule to check the open/closed right values.

  • [uxd-evaluate-code-heuristics] src/components/Products/Product/Product.tsx:58: Pre-existing, not introduced by this PR. S.Image is a styled.div, so alt={title} has no effect, and the background-image is not exposed to assistive technology. The visible S.Title still identifies the product (WCAG 1.1.1).
    Remediation: In a follow-up, use styled.img with src, or add role="img" and aria-label={title}.

  • [uxd-evaluate-code-heuristics] src/components/Cart/Cart.tsx:29: Pre-existing, not introduced by this PR. S.CartButton has no aria-label, so its accessible name is just the quantity or "X" (WCAG 4.1.2).
    Remediation: In a follow-up, add aria-label={isOpen ? 'Close cart' : 'Open cart'}.


Labels: Fixes a broken styled-components dependency upgrade on main by updating JavaScript dependencies and the code that uses them.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added bug Something isn't working dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Nov 10, 2026
@fullsend-ai-coder

fullsend-ai-coder Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 10:23 AM UTC · Completed 10:30 AM UTC

Commit: b3715a1 · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $1.14

…rops

Address review feedback on PR #65:

- Cart/style.ts: the open-cart button background read theme.colors.black,
  a key that was removed from the theme long ago. The interpolation
  resolved to undefined, so the declaration was dropped and the button
  fell back to its own theme.colors.primary background. Use
  theme.colors.primary directly; rendered output is unchanged and the
  style no longer references an undefined theme key.
- Cart.test.tsx: add a test that opens the cart (exercising the
  $isOpen=true and $large paths) and asserts that neither isOpen nor
  large reaches the DOM, either as an attribute or as a React
  unknown-prop warning. Verified that reverting $large to large makes
  the test fail.

Not changed (pre-existing, out of scope for this migration): the
Product image alt text and the cart button accessible name; both are
better handled in a follow-up.

Verification: tests (19 suites, 40 tests), eslint ./src, and
tsc --noEmit (with TypeScript 4.9.5 swapped into node_modules, as the
TS 7 on main cannot load react-scripts; see #60) all pass. No
pre-commit config exists in the repo.

Addresses #65

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (bot-triggered)

Fixed the medium finding by replacing the undefined theme.colors.black with theme.colors.primary in Cart/style.ts (rendered output unchanged). Fixed the low missing-test finding with a Cart test that opens the cart and checks that no transient props reach the DOM; a mutation check confirmed the test catches a regression. Deferred the two pre-existing accessibility findings to a follow-up, as the review recommends. Tests (19 suites, 40 tests), eslint, and tsc --noEmit pass, using TypeScript 4.9.5 swapped into node_modules without saving it, because the TS 7 on main cannot run react-scripts (#60). With TS 4.9.5, the TS2339 error the review predicted does not occur.

Fixed (3):

  1. Forge mergeability check (conflict reconciliation): GitHub reports the PR as MERGEABLE, so no merge or rebase was performed (outcome: skipped).
  2. [logic-error] src/components/Cart/style.ts:45 reads theme.colors.black, which is not defined in the theme (src/components/Cart/style.ts): Replaced the open/closed ternary with theme.colors.primary. The undefined value meant the declaration was dropped and the button already fell back to its own primary background, so rendered output is unchanged and the style no longer references a missing theme key. Note: with TypeScript 4.9.5 (the react-scripts-compatible version), tsc --noEmit passed both before and after this change. A probe showed DefaultTheme is correctly augmented, but theme inside styled-components template interpolations is not strictly checked under TS 4.9, so the predicted TS2339 build failure did not reproduce. The undefined-key bug was still real, so it is fixed.
  3. [missing-test] src/components/Cart/Cart.test.tsx covers the transient-prop rename only via a closed-state snapshot (src/components/Cart/Cart.test.tsx): Added a test that opens the cart (exercising the $isOpen=true and $large paths) and asserts that isOpen/large reach the DOM neither as attributes nor as React unknown-prop warnings (console.error spy). React silently drops unknown boolean props and only warns, so an attribute check alone would not catch a regression. Confirmed that reverting $large to large makes the test fail. jest-styled-components is not a dependency, so toHaveStyleRule (optional in the review) was not added.

Disagreed (2):

  1. [uxd-evaluate-code-heuristics] src/components/Products/Product/Product.tsx:58 S.Image is a div, so alt has no effect: The review marks this as pre-existing and not actionable for this PR, and suggests a follow-up. Changing the image markup is outside the scope of the styled-components v6 migration, so it is left for a separate change.
  2. [uxd-evaluate-code-heuristics] src/components/Cart/Cart.tsx:29 S.CartButton has no aria-label: The review marks this as pre-existing and not actionable for this PR, and suggests a follow-up. Adding an accessible name is outside the scope of the styled-components v6 migration, so it is left for a separate change.

Tests: passed

CI inspections (3):

  1. security / Production dependency audit (passing, success): Passed on the PR head.
  2. security / Secret scan (gitleaks) (passing, success): Passed on the PR head.
  3. merge agent PRs on clean review / merge-on-clean-review (passing, skipped): Skipped; the review requested changes.

Conflict update: skipped; strategy none; forge MERGEABLE; target main@b1a33f8d72f19c87c00e462908e51d638fb8b772

Decision points
  • How to resolve the undefined theme.colors.black reference (alternatives: Restore black: '#000000' to the theme colors, Use an existing theme color that matches current rendering; rationale: The missing key has made the open-cart button render with the primary color since the key was removed. Using theme.colors.primary keeps the rendered output identical, so this migration PR does not change visuals. Restoring black would be a visual change outside the PR's scope.)
  • How to detect transient-prop leakage in the new Cart test (alternatives: Assert absence of DOM attributes only, Also assert that React logs no unknown-prop warnings; rationale: A mutation test showed React drops boolean unknown props from the DOM and only logs a warning, so attribute checks alone miss the regression.)

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:31 AM UTC · Completed 10:45 AM UTC

Commit: 29194a1 · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $4.88

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review November 10, 2026 10:45

Superseded by updated review

@fullsend-ai-review fullsend-ai-review 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.

Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:

  • src/components/Products/Product/Product.tsx (file-level): Line 68 ·
    [low] uxd-evaluate-code-heuristics

S.BuyButton has tabIndex={-1}, removing 'Add to cart' from the tab order; keyboard users must use the outer S.Container (line 56), a div with positive tabIndex={1} and an onKeyUp handler but no semantic role. Pre-existing; unchanged by this PR.

Suggested fix: Remove tabIndex={-1} from the button (or set 0); change the container's tabIndex={1} to 0 or move the Enter handler to the button.

Comment thread src/components/Cart/Cart.test.tsx Resolved
Comment thread src/components/Cart/Cart.tsx Resolved
@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Nov 10, 2026
@shairevivo
shairevivo merged commit dc3d611 into main Nov 10, 2026
43 of 44 checks passed
@shairevivo
shairevivo deleted the agent/62-styled-components-v6-migration branch November 10, 2026 12:10
@fullsend-ai-retro

fullsend-ai-retro Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 12:11 PM UTC · Completed 12:36 PM UTC

Commit: 29194a1 · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $4.28

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #65 (styled-components v6 migration, issue #62)

Timeline: triage (3.5m, $0.49) → code (6.7m, $1.16) → review #1 request-changes (14m, $4.99) → fix (8m, $1.14) → review #2 approve (15m, $4.88) → repo merge-on-clean-review refused (PR touched package.json/lockfile/babel config) → owner merged manually ~85 min after approval. ~$12.66 total; no human review comments.

What went well: the migration was complete (no v5 leftovers, transient props applied consistently); the fix agent verified its own test with mutation checks; review #2 correctly spotted that the new console.error-spy test only reliably guards $large, not $isOpen (React warns once per prop per file). Keeping a human merge gate on dependency-file changes looks right given this repo's history of dependabot majors breaking main.

Main finding (1 proposal): the only rework round was avoidable. The code agent rewrote the exact line containing the undefined theme.colors.black, noticed it, and left it as a PR-body caveat because agents/code.md only says "don't improve things the issue doesn't authorize". The review agent has no notion of pre-existing/disclosed defects and blocked on it as a medium functional bug. One-line fix, ~23 min and ~$6 of rework.

Evidence for existing issues (not re-filed):

Minor, not filed: the PR's new test merged with the low-severity order-dependence finding open. The pre-existing accessibility findings (alt on div, missing aria-label, tabIndex order) were posted again on re-review, deferred as out of scope, and have no follow-up issue, because follow-up creation is disabled (fullsend-ai/fullsend#1352).

Proposals filed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Complete the styled-components v6 migration on main (macro imports, theme typing, transient props)

1 participant