feat(devices): send this install's current name on the heartbeat - #264
Merged
Conversation
The client half of VTI #1191, now that vta-sdk 0.32 is in. `displayName` is written once, at registration, and `device/register` is intentionally refused from the second launch on — so nothing this install could do would ever change it. Rename the machine, or run the install under a different profile, and the binding went on identifying it by a name that no longer picks it out of the list the name exists for. The heartbeat now carries the current name through `device_heartbeat_named`. The VTA applies it only when it differs, and only to the binding the caller authenticated as, so this cannot touch another device's row. Sent on every beat rather than only when we believe it changed: this side cannot know what the maintainer holds without asking, the payload is one short string on a five-minute timer, and a correction that depends on a local belief is one that stays wrong exactly when the belief is. A drift seen in the listing is corrected immediately rather than waited out. That is not an optimisation: the name only travels on a heartbeat, so an install opened and closed inside one interval would never send one, and the stale name would survive every launch — the case a rename is most likely to produce. The listing is already fetched for the sibling check, and our own row is already identified there by `consumerDid`, so noticing the drift costs nothing new on the wire. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
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.
The client half of verifiable-trust-infrastructure#1191, unblocked by #263.
The gap
displayNameis written once, at registration, anddevice/registeris intentionally refused from the second launch on (device/register:alreadyRegistered) — so nothing this install could do would ever change it. Rename the machine, or run the install under a different profile, and its binding goes on identifying it by a name that no longer picks it out of the list the name exists for.The change
The heartbeat carries the current name through
device_heartbeat_named. The VTA applies it only when it differs, and only to the binding the caller authenticated as, so this cannot touch another device's row.Two decisions worth stating:
Sent on every beat, not only when we think it changed. This side cannot know what the maintainer holds without asking. The payload is one short string on a five-minute timer, and a correction that depends on a local belief is one that stays wrong exactly when the belief is.
A drift seen in the listing is corrected immediately, not on the next beat. Not an optimisation — the name only travels on a heartbeat, so an install opened and closed inside one interval would never send one and the stale name would survive every launch. That is precisely the case a rename produces: you rename the machine, restart, and look at the list. The listing is already fetched for the sibling check and our own row already identified there by
consumerDid, so this costs nothing new on the wire.Tests
name_correction_dueis a pure predicate, so the drift cases are pinned directly: a renamed host, a switched profile (the name is host and profile, so both drift it), a binding the VTA returned with no name at all, and — the one that keeps the steady state quiet — a name that already matches, which must not fire a heartbeat on every listing.Full sweep:
cargo fmt,clippy --workspace --all-targets,cargo test --workspace -- --include-ignored,RUSTDOCFLAGS="-D warnings" cargo doc.Pre-merge checklist