Skip to content

refactor(app): extract homepage migration effect (slice 12 of #1056)#1092

Merged
Astro-Han merged 1 commit into
devfrom
claude/homepage-migration-extract
Jun 3, 2026
Merged

refactor(app): extract homepage migration effect (slice 12 of #1056)#1092
Astro-Han merged 1 commit into
devfrom
claude/homepage-migration-extract

Conversation

@Astro-Han
Copy link
Copy Markdown
Owner

Summary

Slice 12 of the #1056 layout governance line — pure extraction, no behaviour / DOM / aria / copy / storage-key change.

Moves the fire-and-forget v7 homepage-draft migration createEffect out of pages/layout.tsx into a new useHomepageMigration({ currentDir, platform }) factory in pages/layout/layout-homepage-migration.ts, mirroring the sibling useUpdatePolling / layout-update-polling.ts injection pattern. The effect registers in the parent reactive root exactly as before (call-sited where the effect previously lived), so owner and registration order are unchanged.

Five now-unused imports drop from layout.tsx (runHomepageMigration, HOMEPAGE_MIGRATION_SENTINEL_KEY, LegacyHomepagePromptStore, usePortableDraft, createMigrationStorageIO); the new file imports them directly. Persist and createEffect stay (still used elsewhere in layout.tsx).

layout.tsx 1084 → 1026 (-58).

Review focus

  • Verbatim equivalence of the moved effect (sentinel read/write, idempotent homepageMigrationStarted guard, fire-and-forget .catch, legacy-store clear with the await propagation comment).
  • Injection correctness: currentDir (() => string from the route().dir memo) and platform (full Platform, as createMigrationStorageIO requires) — no other closure captured.
  • Owner / registration: factory called in the provider body at the original effect's position, so the effect runs under the same reactive owner.
  • The desktop-vs-web storage branch already lived in homepage-migration-storage.ts (not layout.tsx), so shell-frame-contract.test.ts's "no platform.platform === \"desktop\" in the shell file" invariant is unaffected.

Verification

  • bun run typecheck clean
  • Source-guard tests (shell-frame-contract, update-install-flow-source) + homepage-migration logic tests: 27 pass (guards make only negative assertions unrelated to migration → nothing needed to move with the code)
  • Full bun run test:unit: 1734 pass / 0 fail (no regression)
  • /codex review: PASS, no findings

No new unit test: the extracted unit is a pure effect wrapper with no memo / pure-helper path, and bun's solid-js server build no-ops createEffect, so the effect body is not drivable under bun (same constraint as slice 10). The migration logic it wires is already covered by homepage-migration.test.ts.

…igration.ts

Slice 12 of #1056 layout governance line — pure extraction.

Moves the fire-and-forget v7 homepage-draft migration createEffect out of
pages/layout.tsx into a new useHomepageMigration({ currentDir, platform })
factory, mirroring the sibling useUpdatePolling / layout-update-polling.ts
injection pattern. The effect registers in the parent reactive root exactly
as before (call sited where the effect previously lived), so owner and
registration order are unchanged.

Five now-unused imports drop from layout.tsx (runHomepageMigration,
HOMEPAGE_MIGRATION_SENTINEL_KEY, LegacyHomepagePromptStore, usePortableDraft,
createMigrationStorageIO); the new file imports them directly. Persist and
createEffect stay in layout.tsx (still used elsewhere).

No behaviour / DOM / aria / copy / storage-key change — the effect body,
sentinel handling, idempotent guard, and the desktop-vs-web storage branch
(which already lived in homepage-migration-storage.ts, not layout.tsx) are
byte-for-byte identical.

layout.tsx 1084 -> 1026 (-58).

## Verification

- bun run typecheck clean
- Source-guard tests (shell-frame-contract, update-install-flow-source) +
  homepage-migration logic tests: 27 pass (the guards make only negative
  assertions unrelated to migration, so none needed to move)
- Full bun run test:unit: 1734 pass / 0 fail (no regression)

No new unit test: the extracted unit is a pure effect wrapper with no memo /
pure-helper paths, and bun's solid-js server build no-ops createEffect so the
effect body is not drivable under bun (same constraint as slice 10). The
migration logic it wires is already covered by homepage-migration.test.ts;
equivalence of the move is verified by codex review.
@Astro-Han Astro-Han added P2 Medium priority app Application behavior and product flows task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work tech-debt Supplemental cleanup, maintainability, architecture, test, or quality debt context labels Jun 3, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Warning

Review limit reached

@Astro-Han, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 57 minutes and 37 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c47761fc-3e41-4b5b-8730-5dc780dc4df4

📥 Commits

Reviewing files that changed from the base of the PR and between ab54578 and e848b8a.

📒 Files selected for processing (2)
  • packages/app/src/pages/layout.tsx
  • packages/app/src/pages/layout/layout-homepage-migration.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/homepage-migration-extract

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 and usage tips.

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions Bot added the ui Design system and user interface label Jun 3, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Suggested priority: P2 (includes user-path files (packages/app/src/pages/layout.tsx, packages/app/src/pages/layout/layout-homepage-migration.ts)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@Astro-Han Astro-Han merged commit 1cd6561 into dev Jun 3, 2026
36 of 37 checks passed
@Astro-Han Astro-Han deleted the claude/homepage-migration-extract branch June 3, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows P2 Medium priority task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work tech-debt Supplemental cleanup, maintainability, architecture, test, or quality debt context ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant