mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6140] [Issue]: Review and clear stale code quality and AI findings #3415
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#3415
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SpicyMarinara on GitHub (Sep 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6140
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Review and clear the existing Code Quality and AI quality findings against current staging. Apply valid minimal corrections and record why outdated or intentional patterns are dismissed.
Expected behavior
Quality reports reflect the maintained code, and valid cleanup or UI issues are corrected without changing intentional behavior.
Actual behavior
The dashboard lists 51 standard findings and six AI suggestions against older main commits. Initial review finds both outdated/intentional patterns and small remaining cleanup opportunities.
Steps to reproduce
Environment
1a299369aLogs, screenshots, or video
Additional context
Requested by SpicyMarinara during the September issue sweep. SpicyMarinara / Codex owns the review and minimal fixes, coordinated in #6137. Preserve Promise identity checks, supported browser APIs, and necessary Windows interop when findings are not applicable.
Template check
@SpicyMarinara commented on GitHub (Sep 13, 2026):
Reviewed all 51 standard findings and all six AI suggestions. Fixes are now merged to staging in PR #6137 (
e044997a2a972bed2e2274c1fd95ba8a64d78237). The code-quality UI offers dismissal without a reason field, so this comment preserves the decisions.cgWindowNotFound.used_in_tests. No live credentials were involved.Standard findings
e2e/core-flows.e2e.ts— The bookmarks locator in the Home Widgets test is never read; the test now uses openHomeBookmark for every action. Other bookmarks bindings at lines285 and18644 are used and must stay.e2e/core-flows.e2e.ts— extensionImportToggle is declared but never read. The following evaluate block independently finds the extension toggle via its label to assert document order.e2e/core-flows.e2e.ts— expectHomeContentFits has no callers anywhere in the file/repository; its only occurrence is its definition.e2e/core-flows.e2e.ts— This runs in page.evaluate in a real browser. StorageEvent accepts a type and an optional StorageEventInit dictionary; {key:null} deliberately simulates storage being cleared. The second argument is supported, not superfluous.packages/server/src/routes/lorebooks.routes.ts— parseRecord has already returned for falsy raw. The second raw && is redundant; retain typeof/object and Array.isArray checks.packages/server/src/routes/chats.routes.ts— The enclosing fallback now checks description OR any other persona field OR enabled RPG stats. A persona with only another field reaches this branch with an empty description, so the inner description guard is necessary. Same fix is already on staging.packages/client/src/components/chat/ChatMessage.tsx— processNode returns null/undefined/booleans before this block, and the following typeof-object check already excludes remaining primitive React nodes. The extra node truthiness guard adds no protection here. Keep the null guards in isCodeNode/isColoredContext, where they are necessary.packages/client/src/components/bot-browser/BotBrowserView.tsx— The entire content branch is the false arm of the loading conditional at3449; the inner loading ternary cannot show loadingCharacterDetails here.packages/client/src/components/capabilities/CapabilityElement.tsx— All nonempty runtime errors have already returned CapabilityFailureState at478; the ready element key does not need to include an error-message segment. The actual runtimeError state/effects and retry handler remain required. Empty string is technically possible via the event setter, so the checker wording is stronger than the useful conclusion: this is redundant ready-key state, not a broken failure path.packages/server/src/routes/game.routes.ts— The repaired-JSON conclusion handler also awaits the promise before cleanup and intentionally compares promise identity, not resolved summaries.packages/server/src/routes/game.routes.ts— The normal conclusion handler awaits conclusionRequest before finally. Its promise identity comparison prevents cleanup from deleting a different in-flight request. Awaiting the comparison would break that guard.packages/server/src/routes/game.routes.ts— The session start handler returns await startSessionRequest then compares the stored promise identity in finally before deleting it. This is a request-deduplication cleanup guard.packages/server/src/db/file-backed-store.ts— flush is assigned to activeFlush and awaited immediately before finally. Promise identity is intentional to clear only the matching flush; no await is missing.packages/client/src/App.tsx— Canvas fillStyle is a validating native setter: assigning an invalid/unsupported CSS color leaves the previous value unchanged. The sentinel write is read back to distinguish accepted colors from rejected ones; removing it can reuse a stale prior color.scripts/regressions/open-issues.regression.ts— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. The first block-local retryAgentsRouteSource is read from disk but never used before its block ends at10316. A separate variable with the same name at10347 is used and must remain. Remove only the unused first read.scripts/regressions/prompt.regression.ts— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. chatBackgroundTags appears only in this static import list; remove the unused specifier while retaining other game-asset-generation imports.scripts/regressions/chat-branch-lineage.regression.ts— The first message receipt is now used at173-174 to seed Advanced Memory scene records in the branch regression; removing it would break those assertions.scripts/regressions/open-issues.regression.ts— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. MAX_FILE_SIZES is imported twice from the same module (36 and131). Assertions669-672 use the binding; remove only the duplicate standalone import at36, not the grouped import or assertions.packages/server/src/routes/generate.routes.ts— The default initializer is never read. All reads occur inside if(directorAgent), after unconditional resolver assignment. Make the resolved interval a block-scoped const there and remove the now-unused default constant import if it has no other uses.packages/server/src/routes/generate.routes.ts— The second providerRuntime destructuring writes topK after its last local read. Earlier topK is correctly passed into the runtime; later calls use providerTopK. Remove only topK from this assignment, preserving its initial-runtime input and providerTopK.packages/server/src/routes/generate/conversation-history-runtime.ts— Every branch, including the final else with its own Character fallback, assigns author before first use. Remove the redundant initializer while retaining the existing fallback.packages/client/src/components/panels/SettingsPanel.tsx— In the single CSS-file branch, workingThemes is not read after assigning the created theme; only import counts and notices follow. The analogous assignment in the JSON entries loop at6390 is needed to reject duplicates within one imported folder.packages/client/src/components/onboarding/OnboardingTutorial.tsx— computeTooltipStyle already returns from its mobile branch at306-317, so the remaining placement code always uses the desktop scroll minimum.scripts/regressions/prompt.regression.ts— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. GAME_GM_BUILT_IN_PROMPT_TEMPLATES occurs only in the shared static import list. Remove the unused specifier.scripts/regressions/professor-mari/relevance-names.regression.ts— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. BOW_STUB_DIM as DIM is never referenced. createBowStubEmbedder is used; remove only the unused aliased specifier.scripts/regressions/professor-mari/fetch-integration.regression.ts— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. PROFESSOR_MARI_ID occurs only in this static import declaration. Remove it; the regression constructs its own fixture identities.scripts/regressions/dev-launcher-process.regression.mjs— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. The outer appendFileSync import is unused. The other textual occurrences are inside fixture source strings that declare their own appendFileSync imports; preserve those fixture strings.scripts/regressions/prompt.regression.ts— computeSummaryHideIds is a static ESM import at747. Static import declarations can appear textually below their callers without use-before-initialization.scripts/regressions/prompt.regression.ts— resolveRoleplaySummaryTail is a static ESM import at756, not a late const initialization. Static imports are bound before module evaluation, so the earlier assertion is valid; existing prompt regression passes.scripts/regressions/prompt.regression.ts— isMessageHiddenFromAIForCharacter is a static ESM import at751, initialized before module evaluation. The earlier assertions are valid.scripts/regressions/prompt.regression.ts— getMessageHiddenFromAICharacterIds is a static ESM import at749, initialized before module evaluation. No temporal-dead-zone access occurs.packages/client/src/components/onboarding/OnboardingTutorial.tsx— Every exhaustive placement arm (right/left/bottom/else) assigns maxHeight before it is read by positioning/clamping/return. The initial viewport-derived value is unused.packages/client/src/components/ui/ColorPicker.tsx— The two different Canvas fillStyle sentinels intentionally detect rejected colors: an invalid assignment preserves each sentinel, so differing readbacks return null. Replacing this with a plain property-write model would break CSS color validation.scripts/protect-launcher-data.mjs— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. serverRoot is computed once and never referenced. Remove only that unused declaration; repositoryRoot and resolve are used elsewhere.packages/client/src/lib/markdown.tsx— This reset is after the parsing loop in the final unclosed-code-block fallback. flushAll only flushes text/quote/list/table buffers; inCodeBlock is never read afterward. Resets inside the main loop remain necessary.packages/client/src/lib/markdown.tsx— The unclosed code buffer has already been copied into textBuffer, and no later function reads codeBuffer; flushAll does not process code blocks. Main-loop buffer resets remain necessary.scripts/migrate-static-jsx-localization.mjs— Removed the unused declaration/import in PR #6137; no executable behavior or fixture source changed. basename and extname occur only in the node:path import. Remove those two specifiers; retain relative, resolve, and sep.packages/server/src/services/video/roleplay-video-direction.ts— All JSON parse branches and the catch assign narrationBeat before it is read. Replace only the unused initializer with an explicit string declaration; preserve the raw-text catch fallback.packages/server/src/services/sidecar/scene-postprocess.ts— sanitizeSpotifyTrack already returns for falsy raw. The second raw && is redundant; preserve candidate allowlist and object/string checks.packages/server/src/services/spotify/dj-mari-playlist.service.ts— parseJsonObject already returns for falsy value. The final value && is redundant; preserve object and non-array checks.packages/server/src/services/game/map-position.service.ts— Both targetNode branches assign targetId before reads. Replace only the redundant initializer with an explicit string declaration; preserve node creation/discovery and edge behavior.win/launcher/Program.cs— SetWindowText intentionally titles the launcher-owned console after checking its HWND. Replacing the platform API is an optional Windows compatibility change, not a required bug fix from this informational rule.win/launcher/Program.cs— GetConsoleWindow intentionally obtains the Win32 handle for the launcher-owned console so its window title can be set; the code guards IntPtr.Zero. This informational interoperability rule identifies the platform mechanism, not a correctness defect.win/launcher/Program.cs— AllocConsole is required because this launcher is built /target:winexe and deliberately creates an owned console to preserve taskbar grouping while running the batch launcher.win/launcher/Program.cs— SetCurrentProcessExplicitAppUserModelID deliberately assigns the pinned shortcut AppUserModelID before creating the console. Removing the native call would defeat the launcher taskbar-grouping purpose.win/launcher/Program.cs— The GetConsoleWindow P/Invoke declaration is the intentional Win32 bridge used at129 for the launcher-owned console; it is not unused or untrusted dynamic native loading.win/launcher/Program.cs— SetWindowText is a statically declared user32.dll API used at132 on the verified nonzero console HWND. Its informational unmanaged-code classification alone does not establish a defect.win/launcher/Program.cs— AllocConsole is the explicit kernel32 bridge needed for this windowed executable to own the console running the batch file; retaining it avoids a new framework or launcher redesign.win/launcher/Program.cs— SetCurrentProcessExplicitAppUserModelID is the explicit shell32 API implementing taskbar grouping, called before console creation. It is intentional platform integration.win/launcher/Program.cs— RunBat catches at the outer process-launch boundary, prints the complete exception to stderr, keeps the console visible, and returns a distinct failure exit4. Failures are not swallowed; narrowing exception types would only lose the launcher error report for other failures.win/launcher/Program.cs— StampLnk is an isolated command boundary: any COM/file failure returns explicit nonzero exit1, with COM object release in finally. Broad handling intentionally gives the caller one failed-operation status and does not continue with partial success.AI suggestions
fd5a467d0(Home rebuild #4780). Neither current staging nor current main contains it. There is no remaining checkbox/loading path to fix; restoring deleted UI would be unrelated work.fd5a467d0(Home rebuild #4780). The shared DEFAULT_NOODLE_SETTINGS already defines postsPerDay: 4. Adding a client constant for deleted code would not change current behavior.Dependency alerts remain temporarily dismissed at the maintainer’s request while the tested staging fixes await the planned release to main. PR #6139 is closed as superseded by those staging updates; this audit does not claim that main has been updated.