Skip to content

Separate daemon HTTP client from supervisor#281

Merged
TraderSamwise merged 2 commits into
masterfrom
chore/core-sidecar-next-5
Jul 3, 2026
Merged

Separate daemon HTTP client from supervisor#281
TraderSamwise merged 2 commits into
masterfrom
chore/core-sidecar-next-5

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a daemon-client module for ordinary daemon JSON requests
  • remove requestDaemonJson from daemon-supervisor exports
  • update mobile push and core command request paths to use the split transport
  • extend sidecar boundary tests to keep ordinary modules out of supervisor lifecycle code

Verification

  • yarn typecheck
  • yarn lint
  • yarn vitest run
  • yarn build

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of daemon communication by routing all daemon JSON requests through a dedicated client helper with consistent error handling.
    • Updated mobile notification forwarding to use the daemon client request path, reducing misrouted/failed external notification sends.
  • Tests
    • Expanded automated coverage for daemon/client behavior and module boundary rules, including additional repository scans to prevent accidental re-exports.

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jul 3, 2026 9:09pm

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c376beda-ede2-45e7-8feb-584f5657cf5f

📥 Commits

Reviewing files that changed from the base of the PR and between 9080c82 and b74df0c.

📒 Files selected for processing (1)
  • src/daemon-client.test.ts

📝 Walkthrough

Walkthrough

requestDaemonJson is moved from daemon-supervisor.ts into daemon-client.ts. The affected consumers and tests now import the new module, and boundary tests enforce the new module split.

Changes

daemon-client extraction

Layer / File(s) Summary
New daemon-client module implementation
src/daemon-client.ts, src/daemon-supervisor.ts
requestDaemonJson is implemented in daemon-client.ts, and daemon-supervisor.ts now imports and uses it instead of defining it locally.
Consumer import updates
src/core-command-client.ts, src/core-command-client.test.ts, src/mobile-push-bridge.ts, src/mobile-push-bridge.test.ts
requestDaemonJson imports and test mocks are switched from daemon-supervisor.js to daemon-client.js.
Module boundary tests
src/core-sidecar-boundary.test.ts
Adds helpers for reading eligible source files and new assertions covering requestDaemonJson export location and daemon-supervisor.js reference allowlisting.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • TraderSamwise/aimux#84: Touches the same mobile push forwarding path that now imports requestDaemonJson from daemon-client.
  • TraderSamwise/aimux#271: Also involves src/core-command-client.ts, where requestCoreCommand depends on requestDaemonJson.
  • TraderSamwise/aimux#273: Modifies the requestCoreCommand path and related test wiring that now points at daemon-client.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: moving the daemon HTTP client out of the supervisor module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/core-sidecar-next-5

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/daemon-client.ts (1)

1-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Clean extraction; consider adding direct unit tests for this module.

The implementation is a faithful move of the prior requestDaemonJson logic. However, none of the provided test files exercise this module directly — core-command-client.test.ts and mobile-push-bridge.test.ts both mock requestDaemonJson entirely, so the real behavior here (daemon-not-running error, non-2xx status handling, json?.ok === false handling, timeout propagation) is no longer covered by any visible test after this extraction.

Would you like me to draft a daemon-client.test.ts covering these paths?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/daemon-client.ts` around lines 1 - 19, Add direct unit coverage for
requestDaemonJson in a new daemon-client.test.ts, since the current callers mock
it and no visible test exercises this module anymore. Cover the key behaviors in
requestDaemonJson and its dependencies loadDaemonInfo, getDaemonBaseUrl, and
requestJson: throwing when the daemon is not running, rejecting non-2xx
statuses, rejecting when json.ok is false, and passing through timeoutMs and
request init fields correctly. Use the exported requestDaemonJson symbol to keep
the tests focused on the extracted module’s real behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/daemon-client.ts`:
- Around line 1-19: Add direct unit coverage for requestDaemonJson in a new
daemon-client.test.ts, since the current callers mock it and no visible test
exercises this module anymore. Cover the key behaviors in requestDaemonJson and
its dependencies loadDaemonInfo, getDaemonBaseUrl, and requestJson: throwing
when the daemon is not running, rejecting non-2xx statuses, rejecting when
json.ok is false, and passing through timeoutMs and request init fields
correctly. Use the exported requestDaemonJson symbol to keep the tests focused
on the extracted module’s real behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62fdd1d3-0291-4a47-810e-843ce810299d

📥 Commits

Reviewing files that changed from the base of the PR and between a6844e0 and 9080c82.

📒 Files selected for processing (7)
  • src/core-command-client.test.ts
  • src/core-command-client.ts
  • src/core-sidecar-boundary.test.ts
  • src/daemon-client.ts
  • src/daemon-supervisor.ts
  • src/mobile-push-bridge.test.ts
  • src/mobile-push-bridge.ts

@TraderSamwise

Copy link
Copy Markdown
Owner Author

Resolved CodeRabbit's daemon-client coverage nitpick in b74df0c by adding direct tests for missing daemon info, request forwarding, non-2xx errors, and ok:false daemon responses.

@TraderSamwise
TraderSamwise merged commit 118e5a2 into master Jul 3, 2026
3 checks passed
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