Files
SubMiner/backlog/tasks/task-306 - Separate-background-stats-daemon-from-regular-SubMiner-app.md

2.3 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority
id title status assignee created_date updated_date labels dependencies priority
TASK-306 Separate background stats daemon from regular SubMiner app Done
2026-04-27 00:56 2026-04-27 01:00
stats
runtime
high

Description

Background stats mode should run only the stats data/server pieces. It must not bring up tray UI or expose the regular mpv connection surface, and stopping should remain CLI-only.

Acceptance Criteria

  • #1 Launching stats background mode starts a separate stats daemon process rather than booting the regular SubMiner runtime.
  • #2 Background stats mode does not create or keep a tray icon.
  • #3 Background stats mode does not start mpv IPC/client surfaces that let mpv connect to the app.
  • #4 Background stats mode remains stoppable through the stats stop command line path.

Implementation Plan

  1. Add entry-runtime tests for public stats background/stop daemon detection.
  2. Implement early public stats daemon command detection and route it before regular app boot.
  3. Run targeted tests and update task status/criteria.

Implementation Notes

Implemented early public stats daemon routing in main-entry runtime. Direct --stats-background and --stats-stop now resolve to daemon control before single-instance lock and before loading main.js, matching the existing internal launcher daemon flags. Installed missing Bun dependencies to run targeted tests.

Final Summary

Summary:

  • Added resolveStatsDaemonCommandAction and updated entry detection so public --stats-background / --stats-stop invocations route through the isolated stats daemon control path.
  • Reused that action resolution in stats-daemon-entry so public stop commands map to stop instead of the default start path.
  • Added regression coverage for public daemon detection/action resolution.

Verification:

  • bun test src/main-entry-runtime.test.ts launcher/commands/command-modules.test.ts src/main/runtime/stats-cli-command.test.ts src/stats-daemon-control.test.ts
  • bun run typecheck