crbench//

← all cases

The location record gains a field but the TypeScript client decoder keeps the old record layout

Tier 1 easy python · cross-file · authored, execution-grounded case

Ground-truth defects

d1 · correctness · high · client/src/decode.ts:4
The diff appends a uint16 accuracy_m to the backend's fixed-size little-endian location record (tracker/wire.py), growing it from 22 to 24 bytes, and updates the Python round-trip tests. The TypeScript client (client/src/decode.ts), which decodes the same records for the tracking page, is not touched: its RECORD_SIZE is still 22 and its layout has no accuracy field. A batch the backend now produces is rejected by decodeBatch whenever its length is not a multiple of 22, and otherwise every record after the first is read from the wrong offset. Nothing in the diff references the client.

The change under review

diff
diff --git a/tests/test_wire.py b/tests/test_wire.py
index 4a06b3f..ac96c2d 100644
--- a/tests/test_wire.py
+++ b/tests/test_wire.py
@@ -16,6 +16,7 @@ SAMPLE = LocationUpdate(
     heading_deg=270,
     status=2,
     battery_pct=81,
+    accuracy_m=12,
 )
 
 
@@ -24,7 +25,7 @@ def test_round_trip():
 
 
 def test_record_size():
-    assert len(encode_update(SAMPLE)) == RECORD_SIZE == 22
+    assert len(encode_update(SAMPLE)) == RECORD_SIZE == 24
 
 
 def test_batch_round_trip():
diff --git a/tracker/wire.py b/tracker/wire.py
index 5ce9b9b..3faa4c2 100644
--- a/tracker/wire.py
+++ b/tracker/wire.py
@@ -10,7 +10,7 @@ import struct
 from collections.abc import Iterable
 from dataclasses import dataclass
 
-_RECORD = struct.Struct("<IiiIHHBB")
+_RECORD = struct.Struct("<IiiIHHBBH")
 RECORD_SIZE = _RECORD.size
 
 # Coordinates travel as integers: degrees multiplied by COORD_SCALE.
@@ -27,6 +27,7 @@ class LocationUpdate:
     heading_deg: int
     status: int
     battery_pct: int
+    accuracy_m: int
 
 
 def encode_update(update: LocationUpdate) -> bytes:
@@ -39,13 +40,14 @@ def encode_update(update: LocationUpdate) -> bytes:
         update.heading_deg,
         update.status,
         update.battery_pct,
+        update.accuracy_m,
     )
 
 
 def decode_update(data: bytes) -> LocationUpdate:
     if len(data) != RECORD_SIZE:
         raise ValueError(f"expected {RECORD_SIZE} bytes, got {len(data)}")
-    shipment_id, lat, lon, recorded_at, speed_kmh, heading_deg, status, battery_pct = (
+    shipment_id, lat, lon, recorded_at, speed_kmh, heading_deg, status, battery_pct, accuracy_m = (
         _RECORD.unpack(data)
     )
     return LocationUpdate(
@@ -57,6 +59,7 @@ def decode_update(data: bytes) -> LocationUpdate:
         heading_deg=heading_deg,
         status=status,
         battery_pct=battery_pct,
+        accuracy_m=accuracy_m,
     )
 
 

Leaderboard for this case

easy · 9 of 9 bots fully caught it (100% solve rate) · 100% avg coverage.

#BotResultCaughtCoverageFindingsFalse alarms
1 Cubic solved 1/1 100.0% 1 0
2 cursor solved 1/1 100.0% 1 0
3 Drape (Deep Review) solved 1/1 100.0% 2 0
4 Drape (Review) solved 1/1 100.0% 2 0
5 greptile solved 1/1 100.0% 1 0
6 Mjolnir (Opus 5.5) solved 1/1 100.0% 4 0
7 Mjolnir (Sonnet 5.5) solved 1/1 100.0% 2 0
8 qodo solved 1/1 100.0% 2 0
9 Claude Code (Opus 5.5) solved 1/1 100.0% 3 1

Bot results

Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ exact
valid · matches d1 · impact high
valid · impact high
The record grows from 22 to 24 bytes with no version marker. decode_batch now rejects 22-byte-record batches unless the length is a multiple of 24 (12 old records = 264 = 11×24), and those batches decode from misaligned bytes. ingest_updates calls this function directly. [grounded: diff] [consensus 3/3: valid=3]
invalid
A grep shows only two Python constructors of LocationUpdate: the test SAMPLE, which this change updated, and decode_update, which now passes accuracy_m. No existing constructor breaks. Raising struct.error on out-of-range values is the same behaviour as the sibling uint16 fields like speed_kmh and heading_deg, so it is not a new defect. [invalid: contradiction] [consensus 3/4: invalid=3, valid=1]
raw comments (3)
client/src/decode.ts:4
The commit grows the wire record from 22 to 24 bytes by adding a trailing uint16 accuracy_m (format `<IiiIHHBBH`), but the TypeScript client was not updated. It still has RECORD_SIZE = 22, and decodeLocationUpdate/decodeBatch use the old layout. A batch from the new format will throw ('not a multiple of 22') unless it happens to hold a multiple of 11 records. When it does divide evenly, every record after the first is decoded from the wrong offset and comes back as garbage. client/src/types.ts also lacks accuracyM.
tracker/wire.py:13
This changes the binary format courier devices upload, with no version byte and no backward compatibility. `ingest_updates` calls `decode_batch`, which now rejects any batch whose length isn't a multiple of 24. Devices still running firmware that sends 22-byte records will be rejected unless the batch has a multiple of 12 records. Those multiple-of-12 batches are worse: they are accepted silently and every record is decoded from misaligned bytes, so shipment IDs and coordinates are corrupted. The rollout needs a versioned format, or the server has to accept both record sizes during migration.
tracker/wire.py:30
`accuracy_m` was added as a required dataclass field with no default, so any existing code that builds LocationUpdate without it now raises TypeError. It is packed as an unsigned 16-bit value, so an accuracy above 65535 or below 0 raises struct.error during encoding instead of being clamped or validated.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ off by one
valid · matches d1 · impact high
raw comments (2)
tracker/wire.py:13
<!-- cubic:v=c28bb45c-6198-4c0a-9c84-64cea55d559f --> <!-- cubic:review-run=5f673b77-b614-57dc-9ae9-d56683f22f10 --> <!-- metadata:{"confidence":10} --> P2: When a new 24-byte batch reaches the shipped client, `decodeBatch` still enforces 22-byte framing and throws; `pollLatest` also silently drops `accuracy_m`. Update the client decoder and type alongside this wire-format change. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At tracker/wire.py, line 13: <comment>When a new 24-byte batch reaches the shipped client, `decodeBatch` still enforces 22-byte framing and throws; `pollLatest` also silently drops `accuracy_m`. Update the client decoder and type alongside this wire-format change.</comment> <file context> @@ -10,7 +10,7 @@ from dataclasses import dataclass -_RECORD = struct.Struct("<IiiIHHBB") +_RECORD = struct.Struct("<IiiIHHBBH") RECORD_SIZE = _RECORD.size </file context> ``` </details>
PR-level
<!-- cubic:review-summary:start --> **1 issue found** across 2 files <!-- cubic:review-summary:end --> <details> <summary>Prompt for AI agents (unresolved issues)</summary> ```text Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately. <file name="tracker/wire.py"> <violation number="1" location="tracker/wire.py:13"> P2: When a new 24-byte batch reaches the shipped client, `decodeBatch` still enforces 22-byte framing and throws; `pollLatest` also silently drops `accuracy_m`. Update the client decoder and type alongside this wire-format change.</violation> </file> ``` </details> <sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/102/ai_pr_review_github_delivery_5037d028559a583833b0a0e43c65c2f109938b11177940d8480be65900919a7e?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F102)</sub> <!-- cubic:review-post:ai_pr_review_github_delivery_5037d028559a583833b0a0e43c65c2f109938b11177940d8480be65900919a7e:0f1847208a8829c5b171dd6486af1b46359f7081:5f673b77-b614-57dc-9ae9-d56683f22f10 -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ exact
valid · matches d1 · impact high
raw comments (2)
tracker/wire.py:30
### Client decoder out of sync **High Severity** <!-- DESCRIPTION START --> The Python wire format now includes `accuracy_m` and is 24 bytes, but the TypeScript decoder still assumes `RECORD_SIZE` 22 and never reads the new field. `decodeBatch` then rejects or mis-slices those records, so the tracking page can fail to parse updates or display shifted coordinates. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: d6cfdbd2-e907-433d-a478-1767dfe5d26d --> <!-- LOCATIONS START tracker/wire.py#L12-L30 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjZmMjg2NjMzLTJjMTctNDA0Ni04YTEzLWM1ZjFjYjQ1OGZkZiIsImVuY3J5cHRpb25LZXkiOiIwMGd5TFVZeHVRcTlwZzRyQWV5Y3hSZlJpUFB5TnJjUWQxZjh6NWhjQXJvIiwiYnJhbmNoIjoicHItYzNmNTQ5NDdjZiIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjZmMjg2NjMzLTJjMTctNDA0Ni04YTEzLWM1ZjFjYjQ1OGZkZiIsImVuY3J5cHRpb25LZXkiOiIwMGd5TFVZeHVRcTlwZzRyQWV5Y3hSZlJpUFB5TnJjUWQxZjh6NWhjQXJvIiwiYnJhbmNoIjoicHItYzNmNTQ5NDdjZiIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwMiwiY29tbWl0U2hhIjoiYmQwNTRiNzRiYzEwMWM3NjY4ZjUwNjNhNzg1OTNhZTAxODNmN2JhMCIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit bd054b74bc101c7668f5063a78593ae0183f7ba0. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PR-level
<!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue. <!-- BUGBOT_FIX_ALL --> <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aToxMDVmZmE5ZC1lYTY2LTRjMTgtOTc2YS1lNWExNTk1NzNkYjkiLCJlbmNyeXB0aW9uS2V5IjoidWk2NXBSN1JQcEJPS19EMzRJWTNXUWJmc3VlbTYyZGo0S2d3R2ZfMWVTNCIsImJyYW5jaCI6InByLWMzZjU0OTQ3Y2YiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <!-- /BUGBOT_FIX_ALL --> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit bd054b74bc101c7668f5063a78593ae0183f7ba0. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ exact
valid · matches d1 · impact high
valid · impact high
The change makes the fixed record 24 bytes instead of 22 and adds no version marker. Devices that send the old format now get rejected by decode_batch. When the batch length happens to be a multiple of 24 (e.g. 12×22 = 264 = 11×24), the batch is split at the wrong boundaries and silently decodes into garbage updates. [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
tracker/wire.py:13
**TypeScript client still decodes 22-byte records** The record is now 24 bytes, but `client/src/decode.ts` still has `RECORD_SIZE = 22`. Decoding new batches either throws or reads at the wrong offsets. Set RECORD_SIZE to 24 in decode.ts and read `accuracyM` as a little-endian Uint16 at offset 22. ``` tracker/wire.py:13 _RECORD = struct.Struct("<IiiIHHBBH") tracker/wire.py:14 RECORD_SIZE = _RECORD.size tracker/wire.py:30 accuracy_m: int tracker/wire.py:43 update.accuracy_m, client/src/decode.ts:4 export const RECORD_SIZE = 22; client/src/decode.ts:9 export function decodeLocationUpdate(view: DataView, offset = 0): LocationUpdate { client/src/decode.ts:10 return { client/src/decode.ts:11 shipmentId: view.getUint32(offset, true), client/src/decode.ts:12 lat: view.getInt32(offset + 4, true) / COORD_SCALE, client/src/decode.ts:13 lon: view.getInt32(offset + 8, true) / COORD_SCALE, ```
tracker/wire.py:13
**Old-format device uploads rejected or corrupted** Devices still sending 22-byte records fail the length check in `decode_batch`, or get split at the wrong boundaries when the batch length happens to be a multiple of 24. Nothing in the format marks the version. Add a version byte, or keep accepting 22-byte records until devices migrate. ``` tracker/wire.py:13 _RECORD = struct.Struct("<IiiIHHBBH") tracker/wire.py:14 RECORD_SIZE = _RECORD.size tracker/wire.py:47 def decode_update(data: bytes) -> LocationUpdate: tracker/wire.py:48 if len(data) != RECORD_SIZE: tracker/wire.py:71 if len(data) % RECORD_SIZE: tracker/wire.py:72 raise ValueError(f"batch length {len(data)} is not a multiple of {RECORD_SIZE}") tracker/wire.py:73 return [decode_update(data[i : i + RECORD_SIZE]) for i in range(0, len(data), RECORD_SIZE)] tracker/wire.py:49 raise ValueError(f"expected {RECORD_SIZE} bytes, got {len(data)}") ```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ exact
valid · matches d1 · impact high
valid · impact high
The change grows the fixed record from 22 to 24 bytes and adds no version marker or fallback. The module docstring says courier devices upload these records, and decode_batch rejects any batch whose length isn't a multiple of 24. A batch of 22-byte records whose total length happens to divide by 24 (e.g. 12 records = 264 bytes) gets split at the wrong boundaries and decodes to garbage values. [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
client/src/decode.ts:4
**TS client still decodes 22-byte records** The Python wire record grew to 24 bytes (new `accuracy_m` field), but the client's `RECORD_SIZE` is still 22 and `decodeLocationUpdate` doesn't read the new field. Set RECORD_SIZE to 24, read accuracy as getUint16 at offset+22, and add accuracyM to the LocationUpdate type. ``` tracker/wire.py:13 _RECORD = struct.Struct("<IiiIHHBBH") tracker/wire.py:14 RECORD_SIZE = _RECORD.size tracker/wire.py:30 accuracy_m: int tracker/wire.py:43 update.accuracy_m, client/src/decode.ts:4 export const RECORD_SIZE = 22; client/src/decode.ts:9 export function decodeLocationUpdate(view: DataView, offset = 0): LocationUpdate { client/src/decode.ts:10 return { client/src/decode.ts:11 shipmentId: view.getUint32(offset, true), client/src/decode.ts:12 lat: view.getInt32(offset + 4, true) / COORD_SCALE, client/src/decode.ts:13 lon: view.getInt32(offset + 8, true) / COORD_SCALE, ```
tracker/wire.py:13
**Format change breaks devices sending 22-byte records** The record layout changed in place with no version marker or fallback. Devices still sending 22-byte records are now rejected by `decode_batch`, or mis-split when the batch length happens to divide by 24. Add a version/format marker, or support both record sizes during rollout. ``` tracker/wire.py:13 _RECORD = struct.Struct("<IiiIHHBBH") tracker/wire.py:14 RECORD_SIZE = _RECORD.size tracker/wire.py:50 shipment_id, lat, lon, recorded_at, speed_kmh, heading_deg, status, battery_pct, accuracy_m = ( tracker/wire.py:51 _RECORD.unpack(data) tracker/wire.py:70 def decode_batch(data: bytes) -> list[LocationUpdate]: tracker/wire.py:71 if len(data) % RECORD_SIZE: tracker/wire.py:72 raise ValueError(f"batch length {len(data)} is not a multiple of {RECORD_SIZE}") tracker/wire.py:73 return [decode_update(data[i : i + RECORD_SIZE]) for i in range(0, len(data), RECORD_SIZE)] tracker/service.py:42 def ingest_updates(self, body: bytes) -> list[LocationUpdate]: tracker/service.py:43 updates = decode_batch(body) ```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ exact
valid · matches d1 · impact high
raw comments (2)
tracker/wire.py:13
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Client Record Size Mismatch** This changes the shared location record to 24 bytes, but the TypeScript client still expects 22-byte records. When the client receives the new payload, ordinary batches fail its length check; batch sizes divisible by both widths are decoded using incorrect record boundaries. As a result, the tracking client cannot reliably consume location records in the new format. Update the client record layout and location type alongside this protocol change.
PR-level
<!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=66790190"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a>Confidence Score: 4/5</h2> The PR is not safe to merge until the TypeScript decoder is updated to consume the new 24-byte wire format. <h2>Findings</h2> 1. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Client Record Size Mismatch** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/102#discussion_r4059120138">▶</a> <h3>Summary</h3> This PR extends the binary location record from 22 to 24 bytes by appending GPS horizontal accuracy and updates the Python round-trip and size tests. - Adds `accuracy_m` to `LocationUpdate`. - Encodes accuracy as a little-endian unsigned 16-bit value. - Updates the Python record-size assertion to 24 bytes. - Leaves the TypeScript decoder on the previous 22-byte layout, creating an incompatible consumer. <details open><summary>Diagram</summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart LR D[Courier device<br/>24-byte record] --> P[Python ingest<br/>24-byte decoder] P --> C[Location record] C --> T[TypeScript client<br/>still expects 22 bytes] T --> F[Batch rejection or<br/>misaligned decoding] ``` </details> <sub>Reviews (1) · Last reviewed commit: ["Include GPS accuracy in device location ..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/7e6c89bc34b629c6584f08aa5ec59fc2c17843ec)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ off by one
valid · impact high
The record grows from 22 to 24 bytes and has no version marker. decode_batch only checks that the length is a multiple of RECORD_SIZE, so 22-byte batches from old devices are rejected. A batch of 12 old records (264 bytes, the LCM of 22 and 24) passes the check and is misparsed. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact high
valid · impact high
This is the same issue as finding 0. The size change has no versioning, so old 22-byte batches are rejected, and a 264-byte batch is silently decoded with shifted fields. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The TS decoder reads the same wire format but still hardcodes 22-byte records and has no accuracy field. The change updated the Python side and left this parallel decoder out of sync. [grounded: tree client/src/decode.ts] [consensus 3/3: valid=3]
raw comments (4)
tracker/wire.py:13
[P1] Older courier devices' 22-byte batches are now rejected or decoded wrongly Adding the trailing `H` changes the record from 22 to 24 bytes, and nothing marks which format a batch uses (no version or length prefix). Once this ships, devices still on the old firmware will have their uploads to `TrackingService.ingest_updates` rejected by `decode_batch` with "not a multiple of 24". Some batch sizes are worse than rejected. If the old batch's total length happens to be a multiple of 24, for example 12 old records = 264 bytes = 11 new records, the batch is accepted and decoded with shifted offsets. Every record after the first then has the wrong shipment_id, coordinates and so on, and no error is raised. Devices in the field can't all be updated at the same moment as the server. So either the format needs a version marker, or the server needs to keep accepting 22-byte records during the rollout.
tracker/wire.py:13
[P2] TypeScript client decoder still uses the 22-byte layout `client/src/decode.ts` hardcodes `RECORD_SIZE = 22`, and its `LocationUpdate` type in `client/src/types.ts` has no `accuracyM` field. Both describe this same binary wire format, and neither file was changed here. `decodeBatch` will therefore throw on most 24-byte batches. When the total length happens to be a multiple of 22 (e.g. 11 records = 264 bytes), it misreads every record after the first. `pollLatest`/`decodeLocationUpdate` never reads the new accuracy value, and in a batch it would read it as part of the next record. The client needs the matching 24-byte layout and the new field.
tracker/wire.py:13
[P1] Record size change breaks devices still sending 22-byte records, and some batches are misparsed without an error Adding `H` to `_RECORD` raises `RECORD_SIZE` from 22 to 24 bytes, and nothing marks which format a record uses (no version byte, no fallback). Courier devices in the field that haven't been updated still upload 22-byte records. When the update rolls out, `TrackingService.ingest_updates` → `decode_batch` will reject most of their batches. Worse, any batch whose length is a multiple of both 22 and 24 (every 12 records, e.g. 264 bytes = 11×24) passes the length check. It then decodes into 11 records with every field shifted, so shipments get wrong coordinates and timestamps and no error is raised. The fix is a versioned format, or accepting both record sizes during a migration window.
tracker/wire.py:13
[P2] TypeScript client decoder still expects the old 22-byte record `client/src/decode.ts` describes the same binary format but still hardcodes `RECORD_SIZE = 22` and reads only the eight original fields. `client/src/types.ts` has no `accuracyM` field. After this change, `decodeBatch` throws or misreads data on 24-byte records whenever the batch length isn't a multiple of 22, and `accuracy_m` never reaches the tracking page. The client decoder and types should be updated together with the Python struct.
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ exact
valid · impact high
The change grows the Python record format to 24 bytes ("<IiiIHHBBH"). The TypeScript client in the same repo, which decodes the same binary format, still hard-codes 22 bytes and the old offsets. This is an incomplete change: the client will throw on, or misdecode, new-format batches, and the server now rejects 22-byte records. [grounded: tree client/src/decode.ts] [consensus 3/3: valid=3]
valid · matches d1 · impact high
raw comments (2)
tracker/wire.py:13
[P1] TypeScript client decoder not updated for the new 24-byte record The Python wire record grows from 22 to 24 bytes (new trailing `accuracy_m` uint16), but `client/src/decode.ts` still hard-codes `RECORD_SIZE = 22` and decodes only the old fields; `client/src/types.ts` has no accuracy field. The client is in the same repo and decodes this same binary format, so after this change `decodeBatch` throws for any new-format batch whose byte length isn't a multiple of 22. When the length happens to be a multiple of both 22 and 24 (for example 11 records of 24 bytes = 264 bytes = 12 records of 22 bytes), it silently decodes misaligned garbage. `pollLatest` also reads one record with the old layout. The client's `RECORD_SIZE`, the decode offsets and the `LocationUpdate` type all need the matching change. The server's `decode_batch` has the same problem in the other direction: it rejects every batch sent by devices still emitting 22-byte records, so the rollout needs coordination or versioning.
client/src/decode.ts:4
[P1] Client decoder not updated for the new 24-byte wire record (change originates at tracker/wire.py:13) The Python wire format now has a 24-byte record, with a trailing `accuracy_m` uint16. The TypeScript client decoder, `client/src/decode.ts`, still hardcodes `RECORD_SIZE = 22` and has no accuracy field. Neither that file nor `client/src/types.ts` is touched by this diff. Any batch encoded or decoded across the two sides will break. A batch of N 24-byte records is read by the client as 24N/22 records. When 24N is not a multiple of 22, `decodeBatch` throws. Otherwise, from the second record on, every field is read at the wrong offset. For example, one 24-byte record gives a length of 24, which is not a multiple of 22, so it throws. Separately, any deployed courier device still sending 22-byte records will be rejected by `decode_batch` in `tracker/service.py`. The change needs the client constant, decoder and type updated in the same change. It may also need a rollout or version plan for the wire format.
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 high ✓ exact
valid · matches d1 · impact high
valid · impact high
The wire format grows from 22 to 24 bytes in place, with no version field. decode_batch only checks `len(data) % RECORD_SIZE`, so batches from devices still sending 22-byte records get rejected. A payload of 264 bytes (12 old records, and also a multiple of 24) gets split as 11 corrupted records instead of being rejected. [grounded: diff] [consensus 3/3: valid=3]
raw comments (4)
tracker/wire.py:13
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 1\. Tracking clients reject new batches <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> The Python encoder now produces 24-byte records, while the TypeScript decoder still validates and advances through records using a 22-byte size and exposes no accuracy field. New batches therefore fail client validation, and single-record polling silently returns an update without the newly reported accuracy. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The Python wire format now appends a two-byte accuracy value, but the TypeScript client still implements the old 22-byte record. Valid new batches are rejected and polling omits accuracy. ## Fix Focus Areas - client/src/decode.ts[3-30] - client/src/types.ts[2-11] - tracker/wire.py[13-14] ## Recommended Fix Set the client record size to 24, decode the little-endian unsigned accuracy value at offset 22, add `accuracyM` to `LocationUpdate`, and add client coverage for both single-record and batch decoding of the new format. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
tracker/wire.py:13
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 2\. Old device batches become corrupted <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> Changing the unversioned record size from 22 to 24 makes <b><i>decode_batch</i></b> reject most legacy payloads and slice ambiguous payloads at the wrong boundaries. In particular, twelve old records occupy 264 bytes, which passes the new divisibility check and is decoded as eleven corrupted records instead of being rejected. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The record size changes in place without identifying the protocol version. Delayed or not-yet-upgraded devices can have 22-byte batches rejected or, for lengths divisible by both 22 and 24, silently decoded at incorrect boundaries. ## Fix Focus Areas - tracker/wire.py[13-14] - tracker/wire.py[47-73] - tracker/service.py[42-46] ## Recommended Fix Add an explicit protocol version to batch framing or select the decoder through a versioned endpoint or request field. Retain a legacy 22-byte decoder during rollout and dispatch to exactly one record format from the explicit version rather than inferring it only from payload length. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
PR-level
<h3>PR Summary by Qodo</h3> Add GPS accuracy to binary location updates <code>✨ Enhancement</code> <code>🧪 Tests</code> <code>🕐 10-20 Minutes</code> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <details> <summary>AI Description</summary> <dl> <dd> <br/> ><pre> >• Adds metre-based horizontal GPS accuracy to each decoded location update. >• Extends fixed binary records from 22 to 24 bytes. >• Verifies single and batched records preserve the added accuracy field. ></pre> </dd> </dl> </details> <details> <summary>Diagram</summary> <dl> <dd> <br/> ```mermaid sequenceDiagram actor Device as Courier Device participant Wire as Wire Codec participant Service as Ingest Service Device->>Wire: 24-byte location record Wire->>Service: Update with accuracy ``` </dd> </dl> </details> <details> <summary>High-Level Assessment</summary> <dl> <dd> <br/> >The following are alternative approaches to this PR: <details> <summary><b>1. Version the wire protocol</b></summary> <dl> <dd> - ➕ Supports staged producer and consumer rollouts - ➕ Allows explicit rejection or migration of legacy 22-byte records - ➖ Adds framing or negotiation overhead - ➖ Requires broader protocol and deployment changes </dd> </dl> </details> >**Recommendation:** Appending an unsigned 16-bit field is the simplest compact representation when device and server deployments are coordinated. If 22-byte and 24-byte producers may coexist, add explicit protocol versioning because batch length alone cannot reliably distinguish mixed record formats. </dd> </dl> </details> <details> <summary> Files changed (2) <code> +7 / -3 </code> </summary> <dl> <dd> <br/> <details> <summary>Enhancement (1) <code> +5 / -2 </code></summary> <dl> <dd> <details> <summary>wire.py<code>Encode GPS accuracy in location records</code> <code>+5/-2</code></summary> <br/> >Encode GPS accuracy in location records > ><pre> >• Adds &#x27;accuracy_m&#x27; to &#x27;LocationUpdate&#x27; and appends it as an unsigned 16-bit value in the binary format. Encoding and decoding now preserve the field, increasing each fixed-size record from 22 to 24 bytes. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/102/files#diff-a96ff02b19d865466d47bd00f4571b21735869683ea182ceb28404225cffc689'>tracker/wire.py</a> </details> </dd> </dl> </details> <details> <summary>Tests (1) <code> +2 / -1 </code></summary> <dl> <dd> <details> <summary>test_wire.py<code>Validate accuracy round trips and expanded record size</code> <code>+2/-1</code></summary> <br/> >Validate accuracy round trips and expanded record size > ><pre> >• Adds horizontal accuracy to the sample location update and verifies the binary record is now 24 bytes. Existing single-record and batch round trips cover preservation of the new field. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/102/files#diff-836a87d2c740c3bd6c6bfd205b2e6ac72a4934d13aeae465955728dae08abafa'>tests/test_wire.py</a> </details> </dd> </dl> </details> </dd> </dl> </details>
PR-level
<h3>Code Review by Qodo</h3> <code>🐞 Bugs (2)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <br/> <img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> <details> <summary> 1. Tracking clients reject new batches <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >The Python encoder now produces 24-byte records, while the TypeScript decoder still validates and >advances through records using a 22-byte size and exposes no accuracy field. New batches therefore >fail client validation, and single-record polling silently returns an update without the newly >reported accuracy. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[tracker/wire.py[13]](https://github.com/drape-io/crbench-qodo-2026-09/pull/102/files#diff-a96ff02b19d865466d47bd00f4571b21735869683ea182ceb28404225cffc689R13-R13)</code> > >```diff >+_RECORD = struct.Struct("<IiiIHHBBH") >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The changed Python struct appends an unsigned short and packs <b><i>accuracy_m</i></b>, making each record 24 >bytes. The exported client decoder still requires multiples of 22, reads only through byte 21, and >is used directly by the tracking poller, while its public type has no accuracy property. ></pre> > > <code>[tracker/wire.py[13-14]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/tracker/wire.py/#L13-L14)</code> > <code>[tracker/wire.py[33-44]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/tracker/wire.py/#L33-L44)</code> > <code>[client/src/decode.ts[3-30]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/client/src/decode.ts/#L3-L30)</code> > <code>[client/src/types.ts[2-11]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/client/src/types.ts/#L2-L11)</code> > <code>[client/src/index.ts[27-33]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/client/src/index.ts/#L27-L33)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The Python wire format now appends a two-byte accuracy value, but the TypeScript client still implements the old 22-byte record. Valid new batches are rejected and polling omits accuracy. > >## Fix Focus Areas >- client/src/decode.ts[3-30] >- client/src/types.ts[2-11] >- tracker/wire.py[13-14] > >## Recommended Fix >Set the client record size to 24, decode the little-endian unsigned accuracy value at offset 22, add `accuracyM` to `LocationUpdate`, and add client coverage for both single-record and batch decoding of the new format. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 2. Old device batches become corrupted <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >Changing the unversioned record size from 22 to 24 makes <b><i>decode_batch</i></b> reject most legacy payloads >and slice ambiguous payloads at the wrong boundaries. In particular, twelve old records occupy 264 >bytes, which passes the new divisibility check and is decoded as eleven corrupted records instead of >being rejected. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[tracker/wire.py[13]](https://github.com/drape-io/crbench-qodo-2026-09/pull/102/files#diff-a96ff02b19d865466d47bd00f4571b21735869683ea182ceb28404225cffc689R13-R13)</code> > >```diff >+_RECORD = struct.Struct("<IiiIHHBBH") >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The repository states that courier devices upload fixed-size batches over flaky mobile links, but >ingestion immediately applies the single new <b><i>RECORD_SIZE</i></b> without framing or version selection. >Because 264 is divisible by both the old size of 22 and the new size of 24, the current modulo check >cannot distinguish a twelve-record legacy batch from an eleven-record new batch. ></pre> > > <code>[tracker/wire.py[1-5]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/tracker/wire.py/#L1-L5)</code> > <code>[tracker/wire.py[13-14]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/tracker/wire.py/#L13-L14)</code> > <code>[tracker/wire.py[47-73]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/tracker/wire.py/#L47-L73)</code> > <code>[tracker/service.py[42-46]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/tracker/service.py/#L42-L46)</code> > <code>[docs/architecture.md[4-7]](https://github.com/drape-io/crbench-qodo-2026-09/blob/21b31c6390b473dd894716426bd7926e4d84e2d8/docs/architecture.md/#L4-L7)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The record size changes in place without identifying the protocol version. Delayed or not-yet-upgraded devices can have 22-byte batches rejected or, for lengths divisible by both 22 and 24, silently decoded at incorrect boundaries. > >## Fix Focus Areas >- tracker/wire.py[13-14] >- tracker/wire.py[47-73] >- tracker/service.py[42-46] > >## Recommended Fix >Add an explicit protocol version to batch framing or select the decoder through a versioned endpoint or request field. Retain a legacy 22-byte decoder during rollout and dispatch to exactly one record format from the explicit version rather than inferring it only from payload length. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-context:start --> <details><summary><strong>Context sources</strong></summary> <div>Review mode: <code>⚖️ Balanced</code>: This changes a runtime wire-format contract and serialization/deserialization behavior, so it warrants a careful complete review despite the small, localized diff.</div> <!-- qodo-context:end --> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-daily-tip:start --> <details> <summary><strong>Tip of the day</strong></summary> <br/> <pre>💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR</pre> <a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-daily-tip:end --> <!-- https://github.com/drape-io/crbench-qodo-2026-09/commit/21b31c6390b473dd894716426bd7926e4d84e2d8 --> <a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>