Skip to content

🤖 refactor: auto-cleanup#2749

Merged
ethanndickson merged 7 commits intomainfrom
auto-cleanup
Mar 4, 2026
Merged

🤖 refactor: auto-cleanup#2749
ethanndickson merged 7 commits intomainfrom
auto-cleanup

Conversation

@mux-bot
Copy link
Contributor

@mux-bot mux-bot bot commented Mar 3, 2026

Long-lived PR for small, behavior-preserving cleanups discovered by periodic automated sweeps.

Each push adds at most one low-risk refactor (dead code removal, deduplication, naming, etc.) and advances the checkpoint so subsequent runs skip already-considered commits.

Current changes

  • Deduplicate secret type guards in Config class: Remove private static isSecretReferenceValue() and isOpSecretValue() from Config, replacing them with the identical shared exports from @/common/types/secrets. Both methods had byte-identical logic to their shared counterparts.

  • Extract shared runAnalyticsEffect helper: All 9 reactive analytics hooks in useAnalytics.ts repeated the same ~45-line boilerplate (API readiness check, analytics namespace validation, ignore-flag cancellation, error handling). Extracted into a single generic helper, reducing the file by ~310 lines while preserving identical behavior and exported signatures.

  • Use CARD_CLASS constant for project cards in LandingPage: The ProjectsSection component had a hardcoded className string identical to the CARD_CLASS constant already defined at the top of the file and used by three other components. Replaced with the shared constant for consistency.

Auto-cleanup checkpoint: 36e3577


Generated with mux · Model: anthropic:claude-opus-4-6 · Thinking: xhigh · Cost: $—

@mux-bot
Copy link
Contributor Author

mux-bot bot commented Mar 3, 2026

@codex review

@mux-bot mux-bot bot force-pushed the auto-cleanup branch from d32a121 to 3242261 Compare March 3, 2026 12:13
@mux-bot
Copy link
Contributor Author

mux-bot bot commented Mar 3, 2026

⚠️ CI failures on this run (22622467321) are all flaky tests unrelated to the cleanup changes:

  1. Test / Unit: SigningService > with Ed25519 key > should load key and return capabilities — timed out after 5000ms (infrastructure flakiness)
  2. Test / Integration: rightSidebar.test.ts:353 — "Sidebar not found after navigation" — DOM rendering race in happy-dom
  3. Test / Integration: compaction1MRetry.integration.test.ts:103 — Anthropic HTTP 529 overload (external service)

The auto-cleanup branch only modified toolUtils.tsx (removed unused formatValue) and config.ts (deduplicated secret type guards). None of these test files or features are affected by those changes.

Re-triggering CI.

@mux-bot mux-bot bot force-pushed the auto-cleanup branch 3 times, most recently from 3139a09 to aca2618 Compare March 4, 2026 00:14
mux-bot bot added 7 commits March 4, 2026 04:31
The function was exported but never imported anywhere in the codebase.
Confirmed dead via ts-prune and exhaustive grep.
Remove private static isSecretReferenceValue() and isOpSecretValue()
from Config class, replacing them with the identical shared exports
from @/common/types/secrets.

Both methods had byte-identical logic to their shared counterparts
and config.ts already imported from that module.
All 9 reactive analytics hooks repeated the same ~45-line boilerplate:
API readiness check, analytics namespace validation, ignore-flag
cancellation, and error handling. Extract this into a single
runAnalyticsEffect<T>() helper that each hook delegates to.

Behavior-preserving: identical logic, same exported signatures.
-401 lines, +95 lines (net -306 lines).
The ProjectsSection component had a hardcoded className string identical
to the CARD_CLASS constant already defined at the top of the file and
used by three other components (SessionStatsRow, SpendGraph loading/main).
Replace with the shared constant for consistency.
getTokenTotalOrUndefined was a thin wrapper around getTokenTotal (from
@/common/types/devtools) that added a null check — but getTokenTotal
already handles null/undefined inputs and returns undefined for them.

Replace the two call sites with direct getTokenTotal calls and remove
the dead function.
The onChat subscription had an inline stall watchdog (manual
setInterval + lastChatEventAt tracking + cleanup) that duplicated
the createStallWatchdog helper already used by runActivitySubscription
and runTerminalActivitySubscription.

Replace the inline implementation with the shared helper for
consistency and to reduce duplication (-19/+6 lines).
@mux-bot mux-bot bot force-pushed the auto-cleanup branch from aca2618 to efccc16 Compare March 4, 2026 04:36
@ethanndickson ethanndickson added this pull request to the merge queue Mar 4, 2026
Merged via the queue into main with commit c9ac48a Mar 4, 2026
23 checks passed
@ethanndickson ethanndickson deleted the auto-cleanup branch March 4, 2026 06:11
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