plan 0002 (PR B): BLE sprint-track sync — TSLIST / TSGET / TSPUT / TSDEL - #120
Merged
Conversation
Sprint courses live in /TRACKS/SPRINT since plan 0002, but the BLE track commands all spliced /TRACKS - the new folder was only reachable over USB mass storage, which makes sprint mode unusable from the web app. Adds TS-prefixed twins of the four track verbs. They share the circuit code paths through a kind parameter (trackFolderFor()) rather than duplicating handlers, so the flash cost is a few hundred bytes on an image already at the OTA ceiling. TSLIST answers with its own TSFILE:/TSEND tokens so a sprint enumeration can't be mistaken for a circuit one; TSGET/TSPUT/TSDEL reuse the existing replies. Security posture is unchanged and deliberate: filename_validator still rejects '/', '..' and FAT-unsafe bytes on every track command, and the target folder is chosen by the OPCODE, never parsed from the wire - a client cannot path between the two folders. Circuit paths resolve byte-identically to before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HnTP6BdA9xjLR5hSWE9frb
Coverage — host-testable units📂 Overall coverage
📄 File coverage
|
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
Phase 2, PR B of plan 0002. Sprint courses have lived in
/TRACKS/SPRINTsince #116, but every BLE track command spliced/TRACKS— so the new folder was only reachable by plugging in a USB cable. That makes sprint mode effectively unusable from the web app. This closes that gap.Adds
TS-prefixed twins of the four track verbs:TSLISTTSFILE:name.jsonper file, thenTSENDTSGET:name.jsonTGET:(SIZE:N→ chunks →DONE)TSPUT:name.jsonTPUT:(TREADY→ chunks →TDONE→TOK)TSDEL:name.jsonTDEL:(TOK/TERR:NO_FILE)Two deliberate choices worth reviewing:
Shared implementations, not copies. The variants thread a
kindthrough the existing handlers (trackFolderFor(),bleSendTrackList(kind),trackUploadKind/trackDeleteKind) instead of duplicating four command bodies. On an image sitting at ~99% of the OTA cap, a copy-paste would have cost real flash for zero behavioural difference.The folder never comes off the wire.
filename_validatorstays strict —/,..and FAT-unsafe bytes are still rejected on every track command — and which of the two folders a command targets is decided by the opcode alone. A client cannot path its way between them, which is why this didn't become "allow aSPRINT/prefix in the filename".Only
TSLISTgets distinct reply tokens (TSFILE:/TSEND); the other three are 1:1 request/response where the client already knows what it asked for, so reusing the existing replies keeps the protocol (and the flash) smaller.Type of change
Protocol addition only — every existing command keeps its exact wire behaviour, and circuit paths resolve byte-identically to before.
How it was verified
filename_validator) is unchanged and still coveredclang-tidyclean — deferred to CIbluetooth.inois excluded from the simulator TU and has no host build, so nothing local compiles itTSPUT:a sprint course,TSLISTit back, confirm it lands in/TRACKS/SPRINTand thatTLISTstill shows only circuit tracksTGET:OKC.json→/TRACKS/OKC.json(unchanged),TSGET:AX.json→/TRACKS/SPRINT/AX.json.Checklist
CHANGELOG.mdupdated under[Unreleased](if user-visible)ARCHITECTURE.md/CLAUDE.mdupdated (if a module or interface changed) — subsystem 6 protocol list, incl. the folder-from-opcode ruletests/— judgment call, flagging it: the added logic is dispatch glue inside an Arduino TU (akindternary and an opcode offset), not extractable pure logic worth its own unit on a flash-constrained image. The validation it depends on is already host-tested.Related issues
Plan 0002. Follows #116 (sprint core). Remaining: PR C, the on-device course creator — which likely needs the plan 0004 OTA rework first for flash headroom.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HnTP6BdA9xjLR5hSWE9frb
Generated by Claude Code