Skip to content

♻️ Split daemon process lifecycle helpers#267

Merged
Robdel12 merged 1 commit into
mainfrom
rd/daemon-lifecycle-hardening-1
May 19, 2026
Merged

♻️ Split daemon process lifecycle helpers#267
Robdel12 merged 1 commit into
mainfrom
rd/daemon-lifecycle-hardening-1

Conversation

@Robdel12
Copy link
Copy Markdown
Contributor

Why

tdd-daemon is a high-risk lifecycle surface. This PR takes one focused slice: process and PID lifecycle helpers.

By extracting those helpers from command orchestration, we keep start/stop UX behavior stable while making daemon internals easier to reason about and safer to change in follow-up PRs.

What Changed

  • Added src/commands/tdd-daemon-process.js with:
    • readDaemonPidFile(...)
    • findDaemonPidByPort(...)
    • resolveDaemonPid(...)
    • waitForProcessExit(...)
  • Updated src/commands/tdd-daemon.js to import/re-export these helpers.
  • Preserved export compatibility for existing tests/import paths.

Verification

  • node --test tests/commands/tdd-daemon.test.js
  • npm run lint

Notes

This is PR 2 in the tech-debt train and is intentionally behavior-preserving.

Why: isolate PID discovery and process-exit waiting from command orchestration so daemon lifecycle behavior is easier to test and reason about without touching start/stop UX paths.

What changed: moved pid-file parsing, lsof discovery, pid resolution, and wait-for-exit helpers into src/commands/tdd-daemon-process.js and re-exported them from tdd-daemon.js for compatibility.
@vizzly-testing
Copy link
Copy Markdown

vizzly-testing Bot commented May 19, 2026

Vizzly - Visual Test Results

CLI Reporter - 1 change needs review
Status Count
Passed 18
Changed 1
Auto-approved 18
Changes needing review (1)

fullscreen-viewer · Firefox · 375×667 · 78.5% diff

fullscreen-viewer

Review changes

CLI TUI - Approved

5 comparisons, no changes detected.

View build


rd/daemon-lifecycle-hardening-1 · 559d178a

@Robdel12 Robdel12 merged commit 2195eb1 into main May 19, 2026
29 of 30 checks passed
@Robdel12 Robdel12 deleted the rd/daemon-lifecycle-hardening-1 branch May 19, 2026 02:10
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