feat(trips): a ride start on a trip day makes that trip active - #2157
Conversation
The start of a fresh ride on a trip day writes the trip's progress record again, unchanged, so it is the latest record. The start card reads the active trip from the latest record, so its day row follows the trip the rider started, and the store keeps that order across a power cycle. A progress write keeps a Revision the record carries and stamps only a record without one, so a moved record keeps the Revision its metres belong to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
VERDICT: CHANGES 1. A start can overwrite a stored record with a blank one (blocking). 2. Spec §7.7 is not bytes ( 3. Crash window (nit). Only Owner decision, not a code change. #2069 says "Opening a trip day from the day list also makes that trip active". The PR makes only the start do this. I agree with the PR: Verified OK. A torn write cannot lose records: the image is copy-on-write, and the old head goes in the same commit ( Ran: |
A start writes a start record: day 0, day 0's route, 0 m, no finished day, no dates. The bound rules never let a start record replace a record: the store moves the stored record of its key to the end, byte for byte, and adds the start record only when the key has none. So a start before the device has read the records cannot blank a trip's progress, and every written record takes the store's Revision again. A continuation after a reset writes the start record too, because a reset can come before the start's write lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Finish after the rider arrived at the end of the loaded route and rode on past it owes, beside its record, the last fix and the next day. The executor projects the fix onto the next day's route once when it writes the record: within 50 m, the position moves to the nearest point of that route, in the next day. obc-route's `nearest_along` walks the route through one small block, so the board needs no second route index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixes pushed (71efe93, cf482a3).
Also in this PR, as its own commit: the last code item of #2069, Keep riding past the end. The executor projects the last fix onto the next day's route once; within 50 m the position moves into the next day. The PR body now says "Closes #2069". 🤖 Generated with Claude Code |
|
VERDICT: CHANGES 1. A Finish owed during a start write is lost (blocking). 2. Verified OK.
Ran: |
A Finish owed while a start's write is in flight is no longer cleared by that write's answer: owing a record ends the in-flight write's claim on it. `nearest_along` keeps the earliest point unless a later one is more than the matcher's first-lock tie nearer, so a fix beside an out-and-back day lands on its outbound leg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed in 5fb5eb1.
🤖 Generated with Claude Code |
The embedded CI job on 5fb5eb1 measured App 58,064 B, 32 B above the baseline: the owed Finish keeps the last fix and the next day of a ride that rode on past the end of its day. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What changed
A ride that starts on a trip day makes that trip the active trip. A Finish after Keep riding past the end of a day moves the position into the next day when the rider is on its route. These are the last code items of #2069.
A start makes its trip active
TripSummary::start,App::note_trip_start). The device writes none when the trip's record is already the last one.obc_formats::trip_progress::record) never let a start record replace a record. When the key has a record, that record moves to the end, byte for byte. The start record goes in only when the key has none. The resident records and the store apply the same function. So a start before the device has read the records cannot blank a trip's progress, and every written record takes the store's Revision.The latest progress record already names the active trip (§7.7,
next_trip_day), and the Metadata object keeps the records in write order. So a move gives a durable "last started trip" with no new format, field or request type.Keep riding past the end
Arrival::RodeOn) owes, beside its record, the last fix and the next day (trip::RodeOn).flat_store) reads the next day's route and projects the fix once withRodeOn::settle. Within 50 m (RODE_ON_MATCH_M) the position moves to the nearest point of that route, in the next day. Otherwise it stays at the end of the finished day.obc_route::nearest_alongwalks the route through one 112-byte block without aRouteIndex, so the board needs no second index.Spec
obc-ble-interface-spec.md§7.7: the start record bytes and its move rule, the "Rode on" rule, and the "Active trip" rule.Tests
obc-formats:a_start_record_moves_the_stored_record_and_never_replaces_it.obc-storage:progress_records_survive_row_and_checkpoint_edits_and_a_remountwrites a start record after a real record; the stored record comes back unchanged.obc-app:a_ride_on_a_day_of_another_trip_makes_that_trip_active(integration),a_start_moves_the_record_and_gives_a_trip_without_one_no_progress,a_ride_that_rode_on_moves_into_the_next_day_when_the_fix_is_on_its_route(pure rule: within 50 m, past 50 m, no line).obc-route:nearest_along_agrees_with_the_join_scanacross chunk seams.Checks
obc test -p obc-app(1,163 pass),-p obc-route(259),-p obc-storage(213),-p obc-formats(56),-p obc-host-core(132).cargo clippy -D warnings --all-targetson obc-app, obc-route, obc-storage, obc-formats, obc-host-core;cargo clippy --locked -D warningsinfirmware/obc-fw-nrf54l.cargo fmt --allandcargo fmtin the board root.obc suites check: OK.obc shot --check(no frame changes; CI runs it),obc test affected(CI), the board release build and resource guard (CI's embedded job).Hardware checks pending
Public docs: no change (the contract
specs/obc-ble-interface-spec.mdchanged).Closes #2069
Requirements: none
🤖 Generated with Claude Code