Skip to content

refactor: restructure app components by platform and feature - #9085

Draft
ivan-jukic wants to merge 1 commit into
masterfrom
refactor/frontend-feature-structure
Draft

refactor: restructure app components by platform and feature#9085
ivan-jukic wants to merge 1 commit into
masterfrom
refactor/frontend-feature-structure

Conversation

@ivan-jukic

Copy link
Copy Markdown
Contributor

What

Replaces frontend/app/src/{components,components_mobile,components_shared} with:

src/
  desktop/   features/ + shared/ + shell/ + ui/
  mobile/    features/ + shared/ + shell/ + ui/
  ui/        cross-platform primitives (see STRAGGLERS.md)

Features: chats/ umbrella (core = kind-agnostic message engine, thread, pinned, group, community, members), plus chatlist, bots, profile, wallet, access, proposals, onboard, landing, etc. Same taxonomy in both platform trees.

  • 979 files moved, 3413 imports rewritten in 782 files
  • 33 dead files deleted (zero importers; one had imports of files that don't exist)
  • @shared_components alias removed (vite + tsconfig)
  • new eslint rule local/structure-boundaries:
    • error: desktop/mobile/ (either direction), src/ui ↛ platform trees
    • warn: cross-feature imports — allowed only via a feature's exports/ (e.g. bots/exports/BotBadge.svelte) or features/chats/core/**; 149 pre-existing violations are the baseline to burn down, then flip to error

How placements were decided

Computed from the import graph, not by hand: a component lives with the only feature that imports it; multi-feature consumers → platform shared/; consumers in both trees → src/ui + entry in ui/STRAGGLERS.md; no importers → deleted. Human input was a 33-entry seed map (panel roots and Home-mounted modals whose only importer is the shell) and the folder→feature mapping.

Verification

  • svelte-check: 4716 files, 0 errors
  • eslint: 0 errors (152 warnings: 149 boundary baseline + 3 pre-existing)
  • vitest: 372/372
  • rollup production build succeeds; frontend build manually tested
  • git log --follow traces history through the renames

Follow-ups (not this PR)

  • Review the 12 components in ui/STRAGGLERS.md — promote or fork per platform
  • Burn down the 149 cross-feature warnings, then set the rule to error
  • Pre-existing smells surfaced by parsing svelte in eslint (silenced per-rule here): duplicate case label desktop/shell/Home.svelte:450, case fallthrough chats/core/PreviewFooter.svelte:103, async promise executor profile/ViewUserProfileModal.svelte:69

🤖 Generated with Claude Code

https://claude.ai/code/session_01MvT4UYdWURffYxsCHowXFy

Replace components/, components_mobile/ and components_shared/ with
desktop/, mobile/ and ui/ trees, each split into features/ (chats,
chatlist, bots, profile, wallet, ...), shared/ and shell/. Placement
was computed from the import graph: a component lives with its only
consumer feature, in shared/ when consumed by several, in src/ui when
consumed by both platforms (flagged in ui/STRAGGLERS.md for review).
Deletes 33 files nothing imports and adds an eslint boundary rule
(desktop and mobile never import each other; features are private
except exports/ and chats/core).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MvT4UYdWURffYxsCHowXFy
@github-actions

Copy link
Copy Markdown

canbench 🏋 (dir: .)

./canbench_results.yml is up to date ✅

---------------------------------------------------

Benchmark: add_reactions
  total:
    instructions: 1.36 B (0.00%) (change within noise threshold)
    heap_increase: 5 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: push_simple_text_messages
  total:
    instructions: 207.96 M (0.03%) (change within noise threshold)
    heap_increase: 12 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant