Refactor/web app domain architecture - #12299
Conversation
Nothing in the live route tree imported these screens, barrels, or shadcn wrappers, so drop them with the radix/window deps that only they used. Co-authored-by: Cursor <cursoragent@cursor.com>
Move destinations into src/features/<domain>/{api,model,ui}, split HTTP off lib/api.ts onto a shared fetch client, and guard public-index imports so callers cannot reach deep UI files.
INV-MEM-1: memories path globs follow the new feature folder; tier behavior is unchanged.
Co-authored-by: Cursor <cursoragent@cursor.com>
After the colocate, utilities used only under src/features were omitted from styles.css, so layout classes never reached the page. Co-authored-by: Cursor <cursoragent@cursor.com>
…ores React state cannot roll back an optimistic write: peek() can. Lists, chat, search, notifications, and live session UI now follow createGoalsStore so failed mutations restore the committed value and a switched id cannot land the previous request. Co-authored-by: Cursor <cursoragent@cursor.com>
Layout already imports features, so it cannot live in shared. Toast, dialogs, and the other primitives do not, and putting them under shared matches the import guard: shared must not reach into features. Co-authored-by: Cursor <cursoragent@cursor.com>
Home's pill and the overlay panel both upload drafts the same way. One hook owns MAX_FILES, previews, and rollback so those paths cannot fork, without forcing the two composers into one visual control. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep incoming chat, home, tasks, and meeting-screenshot behavior after those files moved into src/features. Do not restore the deleted lib/api.ts barrel. Co-authored-by: Cursor <cursoragent@cursor.com>
The merge kept the old @/components/tasks import after BulkActionBar moved. Co-authored-by: Cursor <cursoragent@cursor.com>
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @Yny4ii — this is a careful piece of work. The move is verifiably faithful: the 2,685-line lib/api.ts is split into per-domain features/*/api.ts over a shared src/shared/api/client.ts kernel with the auth/token handling intact, the 37 deleted files (MobileBlockOverlay, OmiOrb wrapper, PlansSheet, FilterSheet, AppSelector, unused shadcn primitives, …) have no remaining importers on main, and the dependency diff is removal-only (unused radix packages, class-variance-authority, the react-window family). The new scripts/check-feature-imports.ts boundary guard is real, tested, and correctly wired into bun run check and the web-app-checks triggers in .github/checks-manifest.yaml, and the Tailwind content: src/** fix in tailwind.config.ts addresses exactly the failure mode you called out (with a smoke test that reads the config as text). The verification section's honesty about not walking the UI in a browser is appreciated — please do keep that visual pass before merge.
One blocking item:
- Hygiene is red because
web/app/AGENTS.mdnow exceeds theagents-md-leanbudget: 64 lines / 2,866 bytes vs 55 / 2,400. The ratchet requires detail to move one level down rather than growing the file, and you already built the right home:web/app/ARCHITECTURE.md. Please move the layout/import-rules detail and the 13-domain enumeration out ofAGENTS.mdintoARCHITECTURE.md(keepAGENTS.mdto a short pointer + the setup/testing essentials) so the file lands back under budget.
Two smaller asks:
- Please drop the two unrelated backend edits — the reformat in
backend/utils/subscription.py(a BYOK security-sensitive module) and the blank-line removal inbackend/tests/unit/test_byok_security.py. They are behavior-neutral (verified formatting-only), but they add review surface to a security-sensitive area in a web-app PR. web/app/src/features/fair-use/api.tscarries ~9 unused imports from the api.ts split (getIdToken,getWebDeviceIdHash, the@/lib/cachehelpers,fetchAuthorizedBlob,getAudioAuthHeaders); worth trimming while you're in there.
For clarity on the other red checks: the Backend unit suite failure is pyright reportUnusedImport in backend/utils/stt/streaming.py (not touched here, and already fixed on main), and the Desktop Swift failure is GlassPanelHitRegionTests legacy-sidebar assertions, also outside this PR's surface — a rebase onto current main should clear both. Hygiene is the only failure this PR owns.
Beyond the mechanical fix: the features/ + import-guard contract and the rewritten AGENTS.md/ARCHITECTURE.md guidance will steer every future change in web/app — human and AI-authored alike — so I'd like a maintainer to sign off on the convention itself (and the AGENTS.md/ARCHITECTURE.md content split) before this merges. Leaving for human maintainer review on that architecture decision.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
What changed and why
Web app product code now lives in
src/features/<domain>/{api,model,ui}plussrc/shared, instead of a flatcomponents/+lib/api.ts. Writable lists and chat session state use moonshine signal stores (peek()rollback, session ownership). After the folder move, Tailwind only scannedsrc/appandsrc/components, so feature class names vanished fromstyles.css—tailwind.config.tscontentis nowsrc/**.Product invariants affected
INV-MEM-1 (path glob
web/app/src/features/memories/**). Tier vocabulary and default access policy are unchanged; memories CRUD, IndexedDB hydrate, and chunked bulk delete keep the same behavior.How it was verified
cd web/app && bun run typecheck— clean.cd web/app && bun run test— 7 bun smoke/import-guard tests + 359 vitest tests, all pass.bun scripts/check-feature-imports.ts—ok: 323 files.Tests
features/;scripts/check-feature-imports.test.tsfor the import guard.scripts/moonshine-smoke.test.tsassertstailwind.config.tsincludessrc/**(reads the file as text sotscdoes not load the config).useActionItems,usePeople,useConversations,useRecaps,useConversation,useSearchConversations,useMemories,useKnowledgeGraph, plus existinguseChat/useGeminiLive/useGoalDetailownership tests.conversationTimeline.test.ts.notifications/__tests__/notificationRoute.test.ts(/recaps→/conversations?recap=).Failure class (fixes)
Failure-Class: none
New guards (only when adding a check or ratchet)
web/app/scripts/check-feature-imports.ts(inbun run check) would have caught a post-colocate import of@/features/foo/ui/DeepFilefrom outside that feature, orsharedimportingfeatures. It is not a repo-wide primitive: it encodes this app’s@/features/src/sharedlayout.Scoped cleanups (optional)
chore(web-app): remove unused components and leftover UI packages— dead UI and npm deps, same PR, its own commit.