refactor(app): extract homepage migration effect (slice 12 of #1056)#1092
Conversation
…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.
|
Warning Review limit reached
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ 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 |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
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.
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
createEffectout ofpages/layout.tsxinto a newuseHomepageMigration({ currentDir, platform })factory inpages/layout/layout-homepage-migration.ts, mirroring the siblinguseUpdatePolling/layout-update-polling.tsinjection 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.PersistandcreateEffectstay (still used elsewhere inlayout.tsx).layout.tsx1084 → 1026 (-58).Review focus
homepageMigrationStartedguard, fire-and-forget.catch, legacy-store clear with theawaitpropagation comment).currentDir(() => stringfrom theroute().dirmemo) andplatform(fullPlatform, ascreateMigrationStorageIOrequires) — no other closure captured.homepage-migration-storage.ts(notlayout.tsx), soshell-frame-contract.test.ts's "noplatform.platform === \"desktop\"in the shell file" invariant is unaffected.Verification
bun run typecheckcleanshell-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)bun run test:unit: 1734 pass / 0 fail (no regression)/codex review: PASS, no findingsNo new unit test: the extracted unit is a pure effect wrapper with no memo / pure-helper path, and bun's
solid-jsserver build no-opscreateEffect, so the effect body is not drivable under bun (same constraint as slice 10). The migration logic it wires is already covered byhomepage-migration.test.ts.