Skip to content

EPIC-3: normalize component ownership - #13463

Open
masvelio wants to merge 20 commits into
masterfrom
codex/epic-3-normalize-components
Open

EPIC-3: normalize component ownership#13463
masvelio wants to merge 20 commits into
masterfrom
codex/epic-3-normalize-components

Conversation

@masvelio

@masvelio masvelio commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Link to Issue

Fixes: #13454
Fixes: #13455
Fixes: #13456
Fixes: #13457
Fixes: #13458
Fixes: #13459
Fixes: #13460
Fixes: #13461

Description of Changes

  • Opened the shared EPIC-3 draft PR; subsequent EPIC-3 tasks continue to land on this same branch and PR.
  • EPIC-3.1 moved useCommunityContests into features/contests/hooks/, extracted shared contest ownership into features/contests/{types,utils}, removed the hook dependency on views/components/CommunityStake/*, and repointed current consumer surfaces to the feature-owned path.
  • EPIC-3.2 moved shared notification subscription and preference hooks into features/notifications/hooks/ and repointed both NotificationSettings and discussion subscribe toggles away from views/pages/NotificationSettings/use*.
  • EPIC-3.3 split ViewThreadPage into a route/data controller plus dedicated shell modules:
    • useViewThreadData.ts
    • ViewThreadPageShell.tsx
    • ViewThreadPageBody.tsx
    • ViewThreadPageSubBody.tsx
    • ViewThreadPageComposer.tsx
    • viewThreadPageSidebars.tsx
  • EPIC-3.3 also extended viewThreadPage.contracts.ts with pure helpers for join-banner, gated-banner, and desktop sidebar visibility so the split keeps explicit render contracts.
  • EPIC-3.4 split DiscussionsPage into a route/filter controller plus dedicated shell/feed/composer modules:
    • useDiscussionsData.ts
    • DiscussionsPageShell.tsx
    • DiscussionsPageFeed.tsx
    • DiscussionsPageComposer.tsx
    • DiscussionsPagePrivateTopic.tsx
    • DiscussionsPageGridComponents.tsx
  • EPIC-3.4 also extended discussionsPage.contracts.ts with pure helpers for feed mode selection, query enabling, and archive header counts so the split keeps explicit render contracts.
  • EPIC-3.5 split ExplorePage into a route/search/data controller plus dedicated shell/content/modal modules:
    • useExploreData.ts
    • ExplorePageShell.tsx
    • ExplorePageContent.tsx
    • ExplorePageManageCommunityStakeModal.tsx
  • EPIC-3.5 also promoted prediction-market discovery to an explicit first-class branch in the section renderer instead of leaving it embedded in the page component.
  • EPIC-3.6 normalized GovernancePage into a narrow page-state shell plus dedicated governance content modules:
    • useGovernancePageData.ts
    • GovernancePageContent.tsx
  • EPIC-3.6 now consumes the governance-owned features/governance/hooks/useInitChainIfNeeded path directly and keeps the governance render tree out of the page entry component.
  • EPIC-3.7 split the first CommunityManagement wave by:
    • moving Community stake ownership into features/communityStake/{hooks,utils} with compatibility exports left in the legacy views/components paths
    • extracting topic-flow contracts into Topics/topicFlow.ts so StakeIntegration and weighted-voting steps no longer depend on the large Topics.tsx page module
    • splitting AdminContestsPage into useAdminContestsPageData.ts, AdminContestsPageContent.tsx, AdminContestsPageList.tsx, AdminContestsPageTypeSelection.tsx, and adminContestsPage.contracts.ts
    • splitting StakeIntegration into useStakeIntegrationData.ts and StakeIntegrationContent.tsx
  • EPIC-3.8 normalized home discovery ownership by:
    • extracting the shared discovery stack into HomeDiscoverySections.tsx
    • extracting duplicated stake modal wiring into HomePageManageCommunityStakeModal.tsx
    • splitting CommunityHomePage into useCommunityHomePageData.ts and CommunityHomePageContent.tsx
    • repointing both HomePage and CommunityHomePage through the same contest / prediction market / quest / trending-thread composition seam while preserving Community Home specific token and sticky-composer sections
  • Added task run notes for EPIC-3.1 through EPIC-3.8 under docs/plans/.
  • Stabilized libs/model/test/utils/community-seeder.ts so anonymous seeded community ids stay unique within the test process, which fixes the prediction-market resolution CI failure caused by duplicate Communities.id values.
  • Left thin compatibility re-exports at the old views/pages/NotificationSettings/use*.ts, views/pages/CommunityManagement/Contests/useCommunityContests.ts, and Community stake paths so the rollout stays incremental without changing route/page structure.

EPIC-3 Progress

Test Plan

  1. Ran strict ESLint on the task-owned EPIC-3.1 contest files, EPIC-3.2 notification/discussion files, EPIC-3.3 ViewThreadPage split files, EPIC-3.4 DiscussionsPage split files, EPIC-3.5 ExplorePage split files, EPIC-3.6 GovernancePage split files, EPIC-3.7 CommunityManagement / stake ownership files, and EPIC-3.8 home discovery files.
  2. Ran pnpm exec eslint --no-ignore packages/commonwealth/test/unit/epic3/adminContestsPage.contracts.spec.ts and pnpm exec eslint --no-ignore packages/commonwealth/test/component/pages/homePage.integration.spec.tsx packages/commonwealth/test/component/pages/communityHomePage.integration.spec.tsx to verify the new EPIC-3.7 and EPIC-3.8 task-owned specs directly.
  3. Ran pnpm lint-diff; it passes with the same ignored-test warnings already present on this branch.
  4. Ran pnpm -F commonwealth no-legacy-imports and pnpm -F commonwealth no-stub-imports; both pass on origin/master...HEAD after the EPIC-3.8 import-guard follow-up.
  5. Ran pnpm -F commonwealth check-types; the EPIC-3.8 task-local useCommunityHomePageData.ts typing issue was fixed, but the repo still exits non-zero because of unrelated existing errors in prediction-market/shared exports, MCP typings, WalletPage types, and the current component-test typings/tooling setup.
  6. Ran pnpm -F commonwealth bundle; it still fails on the unrelated repo-wide BinaryVaultAbi export issue in libs/evm-protocols/src/event-registry/eventRegistry.ts.
  7. Ran pnpm -F commonwealth test-select test/unit/epic3/adminContestsPage.contracts.spec.ts; the suite is blocked by the shared Vitest DB bootstrap / local Postgres trust-auth setup.
  8. Ran pnpm -F commonwealth test-component -- --allowOnly=false; the component suite is currently blocked before test execution because Vitest cannot resolve @testing-library/jest-dom/vitest from packages/commonwealth/test/component/setup.ts in this environment.
  9. Ran pnpm -F commonwealth lint-boundaries; the script resolves the commit-range file list, but the environment cannot load eslint-plugin-boundaries, so that gate is currently blocked by tooling availability rather than code findings.
  10. Ran pnpm exec eslint --no-ignore libs/model/test/utils/community-seeder.ts; it passes, while the corresponding libs/model spec remains locally blocked by the same Postgres trust-auth environment issue.

Deployment Plan

  • N/A

Other Considerations

  • Screenshots: N/A
  • This PR is intentionally a long-lived draft for the full EPIC-3 refactor.
  • Local untracked index.html was intentionally left out of the PR.
  • Rollback plan: revert EPIC-3 commits from this branch in reverse order if a later task needs to be backed out.

@masvelio
masvelio marked this pull request as ready for review March 13, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants