[GH-ISSUE #3491] [Issue]: Code sweep: misleading names and duplicated implementations that invite wrong edits #1888

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

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

Originally assigned to: @kolacheee on GitHub.

Summary

Names that say the wrong thing and duplicated implementations that have already started to drift.

Why this is a problem: agents and contributors act on names. An alias whose name implies a narrower scope than it gates, refs whose names are swapped, and a load-bearing variable dressed as unused all invite confident wrong edits. Duplicated logic means a fix to one copy silently misses the other.
What it negatively affects: refactor safety (including automated "remove unused" passes), and behavior consistency between duplicated code paths.

Expected behavior

Names describe scope and usage truthfully; shared logic has one implementation.

Actual behavior

Misleading names:

  • server/.../services/generation/prose-guardian-settings.ts:108 — shouldHoldForProseGuardianRewrite is a verbatim alias of shouldHoldForTextRewrite, which fires for ANY of prose-guardian, continuity, or html rewrites. Its result gates 7 generation branches far from the definition. The name invites scoping a hold change to Prose Guardian and breaking the other two.
  • client/.../chat/HomeProfessorMariChat.tsx:1894 — embeddedTextareaRef is attached inside the floating body (:3073) and floatingTextareaRef inside the embedded body (:3693). The names are inverted relative to usage; editing "the floating textarea" by name grabs the wrong ref with no type error.
  • client/.../game/GameCombatUI.tsx:441 — _isStreaming carries the unused-underscore convention but is load-bearing: read in the custom-action reset effect (:1544-1556), fed live by GameSurface.tsx:10984. An automated unused-prop cleanup would break combat UI resets.
  • client/.../features/tracker-panel/components/sections/PersonaTrackerPanel.tsx:102 — filename does not match the export (PersonaInventoryPanel), breaking the sibling convention (low; TS catches misuse).

Duplicated logic already drifting:

  • client/.../chat/HomeProfessorMariChat.tsx:2916 — renderFloatingChatBody (~200 lines) is re-implemented inline in the non-floating return (:3519-3725) and has already drifted (different text-size classes; MariSuggestionChips compact prop in one copy only). Fixes to one surface miss the other.
  • client/.../ui/SpriteGenerationModal.tsx:457 — private re-implementation of cropSpriteDataUrl/percentToPixels/clampPercent (exported by SpriteFrameEditor.tsx) with hardcoded 80/90 instead of the editor's named MAX_SINGLE_EDGE_CROP/MAX_PAIR_CROP.
  • server/.../services/video/video-generation.ts:1022 and :1026 — maybeUploadSeedanceReferenceImage called twice with identical arguments; the second call is a guaranteed no-op when both run.
  • server/.../routes/generate/retry-agents-route.ts:2923 — an inner chatMeta shadows the outer live-synced object by re-parsing stale chat.metadata. No active bug today, but any new field crossover silently reads stale data.

Steps to reproduce

Open any entry's file/line; each one-liner names the contradicting code location.

Environment

  • Marinara Engine version: 2.2.0 (staging @ 45b650de9)
  • Install type: source
  • OS + version: N/A — verified by reading the code
  • Browser or app shell: N/A

Logs, screenshots, or video

N/A.

Additional context

Found by a repo-wide read-only sweep; adversarially re-verified before filing. Part of a coordinated set of sweep catalogue issues filed together.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Jul 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3491 Originally assigned to: @kolacheee on GitHub. ## Summary Names that say the wrong thing and duplicated implementations that have already started to drift. **Why this is a problem:** agents and contributors act on names. An alias whose name implies a narrower scope than it gates, refs whose names are swapped, and a load-bearing variable dressed as unused all invite confident wrong edits. Duplicated logic means a fix to one copy silently misses the other. **What it negatively affects:** refactor safety (including automated "remove unused" passes), and behavior consistency between duplicated code paths. ## Expected behavior Names describe scope and usage truthfully; shared logic has one implementation. ## Actual behavior Misleading names: - [ ] `server/.../services/generation/prose-guardian-settings.ts:108` — `shouldHoldForProseGuardianRewrite` is a verbatim alias of `shouldHoldForTextRewrite`, which fires for ANY of prose-guardian, continuity, or html rewrites. Its result gates 7 generation branches far from the definition. The name invites scoping a hold change to Prose Guardian and breaking the other two. - [ ] `client/.../chat/HomeProfessorMariChat.tsx:1894` — `embeddedTextareaRef` is attached inside the floating body (:3073) and `floatingTextareaRef` inside the embedded body (:3693). The names are inverted relative to usage; editing "the floating textarea" by name grabs the wrong ref with no type error. - [ ] `client/.../game/GameCombatUI.tsx:441` — `_isStreaming` carries the unused-underscore convention but is load-bearing: read in the custom-action reset effect (:1544-1556), fed live by `GameSurface.tsx:10984`. An automated unused-prop cleanup would break combat UI resets. - [ ] `client/.../features/tracker-panel/components/sections/PersonaTrackerPanel.tsx:102` — filename does not match the export (`PersonaInventoryPanel`), breaking the sibling convention (low; TS catches misuse). Duplicated logic already drifting: - [ ] `client/.../chat/HomeProfessorMariChat.tsx:2916` — `renderFloatingChatBody` (~200 lines) is re-implemented inline in the non-floating return (:3519-3725) and has already drifted (different text-size classes; `MariSuggestionChips compact` prop in one copy only). Fixes to one surface miss the other. - [ ] `client/.../ui/SpriteGenerationModal.tsx:457` — private re-implementation of `cropSpriteDataUrl`/`percentToPixels`/`clampPercent` (exported by `SpriteFrameEditor.tsx`) with hardcoded 80/90 instead of the editor's named `MAX_SINGLE_EDGE_CROP`/`MAX_PAIR_CROP`. - [ ] `server/.../services/video/video-generation.ts:1022` and `:1026` — `maybeUploadSeedanceReferenceImage` called twice with identical arguments; the second call is a guaranteed no-op when both run. - [ ] `server/.../routes/generate/retry-agents-route.ts:2923` — an inner `chatMeta` shadows the outer live-synced object by re-parsing stale `chat.metadata`. No active bug today, but any new field crossover silently reads stale data. ## Steps to reproduce Open any entry's file/line; each one-liner names the contradicting code location. ## Environment - Marinara Engine version: 2.2.0 (staging @ 45b650de9) - Install type: source - OS + version: N/A — verified by reading the code - Browser or app shell: N/A ## Logs, screenshots, or video N/A. ## Additional context Found by a repo-wide read-only sweep; adversarially re-verified before filing. Part of a coordinated set of sweep catalogue issues filed together. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@kolacheee commented on GitHub (Jul 11, 2026):

Status update after re-verification against current staging:

  • Fixed in the linked PR: the shouldHoldForProseGuardianRewrite alias, the _isStreaming underscore trap, the PersonaTrackerPanel.tsx filename mismatch, and the duplicate Seedance reference upload.
  • No longer present: the HomeProfessorMariChat textarea-ref inversion. The component was restructured upstream since the sweep; verified today that floatingTextareaRef attaches inside the floating surface and embeddedTextareaRef outside it. This item can be checked off.
  • Still open, needs behavior-equivalence verification before touching: the Mari chat body duplication (the two parallel composer trees still exist and have drifted) and the SpriteGenerationModal private crop helpers (values match the editor's constants — 80/90 — but the pixel math needs line-by-line equivalence proof).
  • Still open, deliberately untouched: the retry-agents chatMeta shadow — four parallel local parses exist in that route, there is no active bug, and re-scoping without runtime coverage looks riskier than the latent issue.
<!-- gh-comment-id:4948737825 --> @kolacheee commented on GitHub (Jul 11, 2026): Status update after re-verification against current staging: - **Fixed in the linked PR:** the `shouldHoldForProseGuardianRewrite` alias, the `_isStreaming` underscore trap, the `PersonaTrackerPanel.tsx` filename mismatch, and the duplicate Seedance reference upload. - **No longer present:** the HomeProfessorMariChat textarea-ref inversion. The component was restructured upstream since the sweep; verified today that `floatingTextareaRef` attaches inside the floating surface and `embeddedTextareaRef` outside it. This item can be checked off. - **Still open, needs behavior-equivalence verification before touching:** the Mari chat body duplication (the two parallel composer trees still exist and have drifted) and the SpriteGenerationModal private crop helpers (values match the editor's constants — 80/90 — but the pixel math needs line-by-line equivalence proof). - **Still open, deliberately untouched:** the retry-agents `chatMeta` shadow — four parallel local parses exist in that route, there is no active bug, and re-scoping without runtime coverage looks riskier than the latent issue.
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#1888
No description provided.