M2-07: The track file — write it, and survive a crash #48
No reviewers
Labels
No labels
area/agent
area/capture
area/editor
area/geo
area/security
area/sync
area/transcription
area/ui
area/vault
area/voice-memos
blocked
milestone/M1
milestone/M2
milestone/M3
milestone/M4
needs-decision
needs-hardware
p0
p1
p2
type/bug
type/enhancement
type/feature
type/idea
type/infrastructure
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Stash/stash-ios!48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "m2-07-track-file"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes part one of #34.
<base>_track.gpxbeside the memo: the route written in roughly one-minute parts as the recording runs, joined at stop. The launch sweep that recovers a route a crash interrupted is a second change against the same issue — this one does not sweep, and the docs say so rather than promising it.The split is here rather than at the writer because the other seam would have shipped a build that persists routes to Documents while the Settings screen still says "nothing is written to a file". That is the one state this feature may not have.
The format
GPX 1.1, recorded in
stash-docs(m2-07-track-gpx-decision). Absolute UTC time and altitude are native; speed and course are Garmin'sTrackPointExtensionv2, whose units are already Core Location's; horizontal accuracy is<stash:hacc>in metres.It is deliberately not
<hdop>. HDOP is a dimensionless satellite-geometry factor and this is a radius in metres — different quantities, and a reader has no way to tell that a number under that name means something else. A rendered sample validates against both published schemas underxmllint, confirmed meaningful by breaking the extension deliberately and watching validation fail.Ten seconds, not a minute
The plan proposed one write per closed part and the reasoning was wrong: the part at risk is the end of the walk, so writing only at the boundary loses everything since the last one — and a force-quit before the first boundary leaves no track at all, which this issue's own minute-20 checklist item would never have caught. The open part is rewritten atomically every ten seconds instead.
Consent
Withdrawing mid-recording removes the parts already on disk, oldest first. A withdrawal is several deletions and the process can die between them, so taking part 001 first means an interrupted withdrawal leaves a run that does not begin at one — a state the writer never produces, so recovery can refuse it rather than mistake it for the remains of an ordinary crash. No tombstone file.
LocationCollectionand the sentence saying no route was saved are deleted, which is what that constant existed for.What Codex caught that was a real defect
.trackcase to the parts-folder ownership rule as designed would have had track assembly delete transcript parts — the predicate treated every transcript part as owned before it looked at ownership.Full dispositions in
.agent/m2-07-track-file/SUMMARY.md.Validated, and not
507 tests pass,
make lintclean,make runlaunches.Not tested on a device. The
needs-hardwarelabel is what this is waiting on; device steps are inSUMMARY.md.No test covers
AudioRecorder's three call sites into the collector. DeletinglocationCollector.begin,endorfinishleaves the whole suite green while the app respectively collects no route, keeps location running after a recording stops, or never writes the file. The recorder needs an audio engineStashTestsdeliberately has none of, and the rules that could be lifted out of it already have been. The device steps stand in, which is weaker than a test.