diff --git a/tasks/new/2026-0825.01.jul.story.arch.monolith-decomposition-roadmap-1845.md b/tasks/new/2026-0825.01.jul.story.arch.monolith-decomposition-roadmap-1845.md new file mode 100644 index 0000000..e369a45 --- /dev/null +++ b/tasks/new/2026-0825.01.jul.story.arch.monolith-decomposition-roadmap-1845.md @@ -0,0 +1,73 @@ +# TASK METADATA + +- **Target Files:** `server/main.ts`, `server/main.test.ts`, `ui/components/SessionsPage.tsx`, `server/auth-session.ts`, `ui/mod.ts`, `infra/setup.ts`, `ui/utils/bip39_wordlist.ts` (and copies), `spire_ffi/Cargo.lock`, `ui/components/AdminInvitesPage.tsx`, `ui/components/AdminUserDetailsPage.tsx`, `deno.lock`, `ui/components/AdminRolesPage.tsx`, `ui/components/AdminAppsPage.tsx` +- **Core Objective:** Architect a phased, zero-regression modular decomposition plan to eliminate monoliths and enforce the Single Responsibility Principle. +- **Dependencies:** None. +- **Additional Important Notes:** Must preserve zero-dependency SDK purity (`@auth-yes/sdk`) and guarantee 100% backward compatibility with all quality gates (`deno fmt`, `deno task lint`, `deno task check`, `deno task test`). + +--- + +### 2. Architectural Considerations & Risks + +- **Risks:** + - **Circular Dependencies:** Moving components could introduce circular dependencies, especially between `auth-session.ts` and routing files. + - **Regression:** Splitting monolithic files (e.g., `main.test.ts`) might cause tests to fail or miss edge cases if not carefully separated by domain tier. + - **Client-Side Breakage:** Extracting inline JS strings from JSX (e.g., `SessionsPage.tsx`) to external vanilla JS files could break dynamic interactions if DOM elements are not correctly targeted or if loading sequence is altered. +- **Alternatives:** + - Instead of extracting completely to static files, use Deno Island architectures if supported, but given the strict instruction to use pure Hono SSR JSX (strictly no React) and vanilla JavaScript, static ES modules under `ui/public/ui/` or `ui/static/` is the optimal, native approach. + +### 3. Proposed Implementation + +The refactoring will be executed in a safe, phased approach to guarantee zero regressions: + +#### Phase 1: UI Sessions Decomposition (Frontend) +- **Target:** `ui/components/SessionsPage.tsx` +- **Actions:** + - Extract the Event Cockpit Deck logic into `ui/components/sessions/EventCockpitDeck.tsx`. + - Extract the Workshop Launch Drawer logic into `ui/components/sessions/WorkshopDrawer.tsx`. + - Extract the 1:1 Delegation Drawer logic into `ui/components/sessions/DirectPassDrawer.tsx`. + - Extract the Scope Modal logic into `ui/components/sessions/ScopeModal.tsx`. + - Move the 400+ lines of raw client-side JavaScript currently embedded in string templates (`dangerouslySetInnerHTML`) into a dedicated static vanilla JS module (e.g., `ui/public/ui/sessions.js`) and link it via a `