Give a measurement its own id - #29
Merged
Merged
Conversation
Until now the only way to name a measurement was the pair (Serial Num., RECORDED). That collides when two are taken inside the same second, and RECORDED carries no timezone, so the same measurement on two machines could not reliably be recognised as one thing. Cloud backup needs it to be: an upload keys on the id, and a retry over a bad connection has to land on the file already stored rather than a second copy of it. Adds the key, a generator, and a tolerant reader. The tolerance is not politeness -- radicl, the Android app and the iOS app each write these files from their own implementation, and a stray underscore or a lowercased key should not orphan somebody's backup. find_measurement_id returns None for the files captured before the key existed, and LyteProfileV6.measurement_id does the same rather than following serial_number's habit of substituting a placeholder. An absent id is worth acting on: it is what tells a sync client to mint one and write it back. A value invented on read would look real and would differ every time. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.
Until now the only way to name a measurement was the pair (Serial Num., RECORDED). That collides when two are taken inside the same second, and RECORDED carries no timezone, so the same measurement on two machines could not reliably be recognised as one thing. Cloud backup needs it to be: an upload keys on the id, and a retry over a bad connection has to land on the file already stored rather than a second copy of it.
Adds the key, a generator, and a tolerant reader. The tolerance is not politeness -- radicl, the Android app and the iOS app each write these files from their own implementation, and a stray underscore or a lowercased key should not orphan somebody's backup.
find_measurement_id returns None for the files captured before the key existed, and LyteProfileV6.measurement_id does the same rather than following serial_number's habit of substituting a placeholder. An absent id is worth acting on: it is what tells a sync client to mint one and write it back. A value invented on read would look real and would differ every time.