feat(client): send the local machine id header explicitly on register and asset downloads - #2210
Open
mikhailm-coder wants to merge 1 commit into
Open
mikhailm-coder wants to merge 1 commit into
mikhailm-coder wants to merge 1 commit into
Conversation
… 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>
Contributor
🦩 Flamingo Code ReviewNo findings on the current head. Mode: advisory Need another pass? Commits pushed after this review are not reviewed automatically.
Prefer typing? Comment React 👍/👎 on inline comments to teach the reviewer. Started 2026-09-16 11:11 UTC · updated 2026-09-16 11:11 UTC · workflow run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RegistrationClient::register()andGithubDownloadService(client updates and tool downloads, e.g. the gateway's/v0/api/assets/download) now setX-Machine-Idexplicitly instead of relying on the injected reqwest client's default headers.with_machine_idhelper next toMACHINE_ID_HEADERinmachine_id_service.rs, reused by the doctor probes (removes their private duplicate).RegistrationClient::newandGithubDownloadService::newtake the local machine id asOption<String>;DeregistrationServicepassesNonesincederegister()only ever sends the saved server-assigned credentials.Behaviour note
On the shipped client this is a no-op on the wire: the shared HTTP clients built in
lib.rsalready carryx-machine-idas a reqwest default header (since v0.0.14). The change makes the contract explicit per call site so it no longer depends on whichreqwest::Clienta 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
build_register_headersbranches (fresh with/without local id, reinstall precedence, unparseable id) andwith_machine_id(set / none).make lint(fmt + clippy-D warnings) andcargo test --releasegreen locally: 192 passed.🤖 Generated with Claude Code