Skip to content

feat(client): send the local machine id header explicitly on register and asset downloads - #2210

Open
mikhailm-coder wants to merge 1 commit into
mainfrom
hotfix/register-machine-id-header
Open

mikhailm-coder wants to merge 1 commit into
mainfrom
hotfix/register-machine-id-header

Conversation

@mikhailm-coder

Copy link
Copy Markdown
Contributor

Summary

  • RegistrationClient::register() and GithubDownloadService (client updates and tool downloads, e.g. the gateway's /v0/api/assets/download) now set X-Machine-Id explicitly instead of relying on the injected reqwest client's default headers.
  • New shared with_machine_id helper next to MACHINE_ID_HEADER in machine_id_service.rs, reused by the doctor probes (removes their private duplicate).
  • RegistrationClient::new and GithubDownloadService::new take the local machine id as Option<String>; DeregistrationService passes None since deregister() only ever sends the saved server-assigned credentials.
  • Reinstall and uninstall are unchanged: still the server-assigned machine id + client secret.

Behaviour note

On the shipped client this is a no-op on the wire: the shared HTTP clients built in lib.rs already carry x-machine-id as a reqwest default header (since v0.0.14). The change makes the contract explicit per call site so it no longer depends on which reqwest::Client a caller injects. Request-level headers win over client defaults, so exactly one header value is sent; it also rides the gateway's 302 to GitHub/jsDelivr as it already did.

Tests

  • 6 new unit tests: the build_register_headers branches (fresh with/without local id, reinstall precedence, unparseable id) and with_machine_id (set / none).
  • make lint (fmt + clippy -D warnings) and cargo test --release green locally: 192 passed.

🤖 Generated with Claude Code

… and asset downloads

`register()` and the update/tool downloads only carried X-Machine-Id
through the injected reqwest client's default headers, so the header
depended on which HTTP client the caller built the service with. Both
now set it explicitly via a shared `with_machine_id` helper (also used
by the doctor probes): fresh /register calls and every asset download
(e.g. the gateway's /v0/api/assets/download on client updates) send the
locally generated machine id, while reinstall and uninstall keep sending
the server-assigned id per the existing API contract.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

🦩 Flamingo Code Review

No findings on the current head.

Mode: advisory


Need another pass? Commits pushed after this review are not reviewed automatically.

  • Review the new commits — the commits added since this review
  • Review the whole diff again — ignoring what was already reviewed

Prefer typing? Comment @flamingo-review, or @flamingo-review full. To review every push on this pull request, add the flamingo-review-always label.

React 👍/👎 on inline comments to teach the reviewer.

Started 2026-09-16 11:11 UTC · updated 2026-09-16 11:11 UTC · workflow run

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