[GH-ISSUE #3248] docs: docs/ARCHITECTURE_MAP.md is out of date - stale file counts, service inventory, and already-done refactors #1744

Closed
opened 2026-10-21 05:42:13 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3248

Originally assigned to: @SpicyMarinara on GitHub.

docs/ARCHITECTURE_MAP.md has drifted from the shipped app. Found in a full docs-vs-code audit against v2.1.0. Each item below is independently checkable: open the doc at the noted spot and compare against the app or code. These can all land in one PR that refreshes the file.

6 items found.


1. Scope line (line 6) and Section Codes table, TEST row (line 27)

(outdated)

The doc lists packages/server/test as an audited scope and as the TEST section's primary home, but that directory no longer exists - and, more importantly, the repo no longer keeps ANY checked-in tests. Commit b886b3ea9 (2026-06-07, "YEET TEST.TS OUT", after the doc's 2026-04-30 audit) deleted both packages/server/test/ and the src/**/__tests__/*.test.ts files, added *.test.ts to .gitignore under "Temporary tests", and added an AGENTS.md rule: "Do not keep .test.ts files in the repo." A contributor following the TEST section code would write tests into a dead location under a policy that forbids committing them at all.

Suggested fix: Rewrite the TEST row and Scope line: remove packages/server/test from scope; state that the repo keeps no committed test suite (per AGENTS.md, .test.ts files are temporary, gitignored, and removed after use), and that temporary server tests go under packages/server/src/**/__tests__/ and run via pnpm --filter @marinara-engine/server test (scripts/run-tests.mjs). Do NOT describe __tests__/ as the tests' permanent home.


2. Package Boundaries > packages/client (lines 50-64)

(outdated)

The client's "current shape" is stale: it claims "199 source files" (actual: 445 tracked .ts/.tsx) and the top-level listing omits src/features/ and src/styles/, which now exist. Critically, features/ is the doc's own Target Structure already being implemented - features/chat-settings/ (13 extracted section components plus PickerDropdown and ChatSettingsSection) and features/tracker-panel/ - so the doc misleads anyone planning the features-module migration into thinking it hasn't started.

Suggested fix: Re-count the files (445 as of 2026-07-05) and add features/ and styles/ to the current top-level shape, noting the features-module migration from Target Structure has begun with chat-settings and tracker-panel.


3. Package Boundaries > packages/server (lines 73-97)

(outdated)

The server's "current shape" is stale: "179 source files" is now 324, "routes: 45 route files" is now 53, and the services inventory omits about 14 subsystems present today: achievements, chat-summary, extensions, generation, mari-db, professor-mari, prompt-overrides, regex, setup, spotify, turn-games, video (directories), plus discord-webhook.ts and memory-recall.ts/memory-recall-embedding.ts (top-level service files). Most were added after the 2026-04-30 audit (regex 05-11, spotify 05-09, generation/mari-db/professor-mari 06-14, achievements 06-17, turn-games 06-20, chat-summary 06-23, extensions 07-02, video 07-03); setup (04-28), discord-webhook and memory-recall (03-22) predate it and were simply never listed. A user using this map to locate or classify server code has no section guidance for any of them.

Suggested fix: Refresh the counts (324 files, 53 route files) and extend the services inventory and section-code mapping to cover: extensions, regex, professor-mari + mari-db, turn-games, spotify, video, generation, chat-summary, achievements, prompt-overrides, setup, memory-recall, and discord-webhook.


4. Package Boundaries > packages/shared (lines 33-48) and Shared target note (line 250)

(outdated)

The shared package is described as only types, schemas, constants, utils, and line 250 asserts the "current flat layout" is the status quo. But packages/shared/src/features/ now exists and is substantial: an agents feature with agent-registry.ts, agent-registry.generated.ts, agent-manifest.types.ts, and 21 per-agent directories (background, card-evolution-auditor, character-tracker, combat, continuity, custom-tracker, cyoa, director, echo-chamber, expression, haptic, html, illustrator, knowledge-retrieval, knowledge-router, lorebook-keeper, persona-stats, prose-guardian, quest, spotify, world-state), plus folder-packages, function-calls, and turn-games. A feature-modular layout has already begun inside shared, contradicting the doc.

Suggested fix: Add features/ (agents registry with per-agent modules, function-calls, folder-packages, turn-games) to the shared package's current contents, and update the line-250 remark since the migration away from the flat layout has already started.


5. Current Large Files table (lines 152-164)

(outdated)

Every line count in the table is significantly wrong today - most files have roughly doubled - and the ranking has shifted. Measured 2026-07-05: generate.routes.ts 7703→12143, game.routes.ts 5338→11043 (now #2, ahead of GameSurface, not #3), GameSurface.tsx 7037→10978, ChatSettingsDrawer.tsx 4927→9350, GameNarration.tsx 4256→6294, GameCombatUI.tsx 1938→3288. RoleplayHUD.tsx went the other way, 2031→1582, because it has since been split into RoleplayHUDActionsMenu.tsx and RoleplayHUDPanels.tsx - yet the doc still lists it as "large enough to split." Anyone triaging refactor effort from this table under-scopes by roughly half and may re-do the HUD split.

Suggested fix: Re-measure the table, re-rank (game.routes.ts is now second-largest and has more than doubled), and drop or annotate the RoleplayHUD.tsx row as already split.


6. Current Large Files rows for RoleplayHUD.tsx (line 163) and ChatSettingsDrawer.tsx (line 161), plus the First Refactor Candidates list they feed (lines 264-281)

(obsolete)

Two of the doc's standing refactor concerns are already partially executed, so a contributor working from it could duplicate completed work. (1) The RoleplayHUD.tsx "large enough to split" concern is done: the file is down to 1,582 lines and lazy-loads RoleplayHUDActionsMenu.tsx and RoleplayHUDPanels.tsx (ActionsMenu plus six panel components). (2) The ChatSettingsDrawer "one component" concern is in progress: 13 per-topic sections have been extracted to packages/client/src/features/chat-settings/sections/ and the drawer imports them - though the drawer itself still grew to 9,350 lines, so it is not finished. Note the split maps to the Large Files rows, not to refactor-candidate item 1 ("Split components/chat into common/conversation/roleplay groups"), which remains un-done - the files still all live flat in components/chat. The whole candidates list needs re-validation against the post-2.0.0 tree.

Suggested fix: Mark the RoleplayHUD split as done (remove/annotate its Large Files row), note ChatSettingsDrawer sectioning is underway in features/chat-settings/ (drawer body still ~9,350 lines), and re-validate the First Refactor Candidates list against the current tree before anyone acts on it - item 1's components/chat regrouping is still genuinely outstanding.

Originally created by @kolacheee on GitHub (Jul 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3248 Originally assigned to: @SpicyMarinara on GitHub. `docs/ARCHITECTURE_MAP.md` has drifted from the shipped app. Found in a full docs-vs-code audit against **v2.1.0**. Each item below is independently checkable: open the doc at the noted spot and compare against the app or code. These can all land in one PR that refreshes the file. **6 items found.** --- ### 1. Scope line (line 6) and Section Codes table, TEST row (line 27) *(outdated)* The doc lists `packages/server/test` as an audited scope and as the TEST section's primary home, but that directory no longer exists - and, more importantly, the repo no longer keeps ANY checked-in tests. Commit b886b3ea9 (2026-06-07, "YEET TEST.TS OUT", after the doc's 2026-04-30 audit) deleted both `packages/server/test/` and the `src/**/__tests__/*.test.ts` files, added `*.test.ts` to .gitignore under "Temporary tests", and added an AGENTS.md rule: "Do not keep `.test.ts` files in the repo." A contributor following the TEST section code would write tests into a dead location under a policy that forbids committing them at all. **Suggested fix:** Rewrite the TEST row and Scope line: remove `packages/server/test` from scope; state that the repo keeps no committed test suite (per AGENTS.md, `.test.ts` files are temporary, gitignored, and removed after use), and that temporary server tests go under `packages/server/src/**/__tests__/` and run via `pnpm --filter @marinara-engine/server test` (scripts/run-tests.mjs). Do NOT describe `__tests__/` as the tests' permanent home. --- ### 2. Package Boundaries > `packages/client` (lines 50-64) *(outdated)* The client's "current shape" is stale: it claims "199 source files" (actual: 445 tracked .ts/.tsx) and the top-level listing omits `src/features/` and `src/styles/`, which now exist. Critically, `features/` is the doc's own Target Structure already being implemented - `features/chat-settings/` (13 extracted section components plus PickerDropdown and ChatSettingsSection) and `features/tracker-panel/` - so the doc misleads anyone planning the features-module migration into thinking it hasn't started. **Suggested fix:** Re-count the files (445 as of 2026-07-05) and add `features/` and `styles/` to the current top-level shape, noting the features-module migration from Target Structure has begun with chat-settings and tracker-panel. --- ### 3. Package Boundaries > `packages/server` (lines 73-97) *(outdated)* The server's "current shape" is stale: "179 source files" is now 324, "routes: 45 route files" is now 53, and the services inventory omits about 14 subsystems present today: achievements, chat-summary, extensions, generation, mari-db, professor-mari, prompt-overrides, regex, setup, spotify, turn-games, video (directories), plus discord-webhook.ts and memory-recall.ts/memory-recall-embedding.ts (top-level service files). Most were added after the 2026-04-30 audit (regex 05-11, spotify 05-09, generation/mari-db/professor-mari 06-14, achievements 06-17, turn-games 06-20, chat-summary 06-23, extensions 07-02, video 07-03); setup (04-28), discord-webhook and memory-recall (03-22) predate it and were simply never listed. A user using this map to locate or classify server code has no section guidance for any of them. **Suggested fix:** Refresh the counts (324 files, 53 route files) and extend the services inventory and section-code mapping to cover: extensions, regex, professor-mari + mari-db, turn-games, spotify, video, generation, chat-summary, achievements, prompt-overrides, setup, memory-recall, and discord-webhook. --- ### 4. Package Boundaries > `packages/shared` (lines 33-48) and Shared target note (line 250) *(outdated)* The shared package is described as only `types`, `schemas`, `constants`, `utils`, and line 250 asserts the "current flat layout" is the status quo. But `packages/shared/src/features/` now exists and is substantial: an agents feature with agent-registry.ts, agent-registry.generated.ts, agent-manifest.types.ts, and 21 per-agent directories (background, card-evolution-auditor, character-tracker, combat, continuity, custom-tracker, cyoa, director, echo-chamber, expression, haptic, html, illustrator, knowledge-retrieval, knowledge-router, lorebook-keeper, persona-stats, prose-guardian, quest, spotify, world-state), plus folder-packages, function-calls, and turn-games. A feature-modular layout has already begun inside shared, contradicting the doc. **Suggested fix:** Add `features/` (agents registry with per-agent modules, function-calls, folder-packages, turn-games) to the shared package's current contents, and update the line-250 remark since the migration away from the flat layout has already started. --- ### 5. Current Large Files table (lines 152-164) *(outdated)* Every line count in the table is significantly wrong today - most files have roughly doubled - and the ranking has shifted. Measured 2026-07-05: generate.routes.ts 7703→12143, game.routes.ts 5338→11043 (now #2, ahead of GameSurface, not #3), GameSurface.tsx 7037→10978, ChatSettingsDrawer.tsx 4927→9350, GameNarration.tsx 4256→6294, GameCombatUI.tsx 1938→3288. RoleplayHUD.tsx went the other way, 2031→1582, because it has since been split into RoleplayHUDActionsMenu.tsx and RoleplayHUDPanels.tsx - yet the doc still lists it as "large enough to split." Anyone triaging refactor effort from this table under-scopes by roughly half and may re-do the HUD split. **Suggested fix:** Re-measure the table, re-rank (game.routes.ts is now second-largest and has more than doubled), and drop or annotate the RoleplayHUD.tsx row as already split. --- ### 6. Current Large Files rows for RoleplayHUD.tsx (line 163) and ChatSettingsDrawer.tsx (line 161), plus the First Refactor Candidates list they feed (lines 264-281) *(obsolete)* Two of the doc's standing refactor concerns are already partially executed, so a contributor working from it could duplicate completed work. (1) The RoleplayHUD.tsx "large enough to split" concern is done: the file is down to 1,582 lines and lazy-loads RoleplayHUDActionsMenu.tsx and RoleplayHUDPanels.tsx (ActionsMenu plus six panel components). (2) The ChatSettingsDrawer "one component" concern is in progress: 13 per-topic sections have been extracted to `packages/client/src/features/chat-settings/sections/` and the drawer imports them - though the drawer itself still grew to 9,350 lines, so it is not finished. Note the split maps to the Large Files rows, not to refactor-candidate item 1 ("Split components/chat into common/conversation/roleplay groups"), which remains un-done - the files still all live flat in components/chat. The whole candidates list needs re-validation against the post-2.0.0 tree. **Suggested fix:** Mark the RoleplayHUD split as done (remove/annotate its Large Files row), note ChatSettingsDrawer sectioning is underway in `features/chat-settings/` (drawer body still ~9,350 lines), and re-validate the First Refactor Candidates list against the current tree before anyone acts on it - item 1's components/chat regrouping is still genuinely outstanding.
bsakaguchi 2026-10-21 05:42:13 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 5, 2026):

Addressed in #3289.

<!-- gh-comment-id:4887421920 --> @SpicyMarinara commented on GitHub (Jul 5, 2026): Addressed in #3289.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1744
No description provided.