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 project's history shows the pairing: every earlier change to the record layout (speed, heading, microdegree coordinates, battery) changed wire.py and client/src/decode.ts in the same commit, and the one that didn't (the status byte) was followed by a client commit decoding it.

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% 3 0
8 qodo solved 1/1 100.0% 1 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 · impact high
The record size goes from 22 to 24 bytes with no version tag. decode_batch only checks `len % RECORD_SIZE`, so a 264-byte batch of old records (264 = lcm(22,24)) passes and gets decoded as misaligned records. Other old batches are rejected. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact high
invalid
The only LocationUpdate constructors in the repo are the test SAMPLE, which was updated, and decode_update, which passes accuracy_m, so no existing caller breaks. The uint16 range claim follows the same pattern as every other packed field, and nothing in the code produces an out-of-range value. [invalid: contradiction] [consensus 3/3: invalid=3]
raw comments (3)
tracker/wire.py:13
This changes the wire record from 22 to 24 bytes without any version field or negotiation. Courier devices already in the field still upload 22-byte records. Most of their batches will now fail `decode_batch` with "not a multiple of 24". Worse, any batch whose length is a multiple of both 22 and 24 (e.g. 264 bytes, which is 12 old records) passes the length check and is decoded as 11 misaligned 24-byte records. That ingests corrupted shipment IDs and coordinates without raising any error. The new format needs a version or tag (or a separate endpoint), or the server needs to keep accepting the old size during rollout.
client/src/decode.ts:4
The TypeScript client decoder was not updated. It still hard-codes `RECORD_SIZE = 22` and does not read `accuracy_m` (and `types.ts` has no `accuracyM` field). Any 24-byte record from the new Python encoder will be rejected or misdecoded: from the second record on, every offset is shifted by 2 bytes per record. A batch whose length divides by 22 will decode into garbage. The client must be updated to 24 bytes with `accuracyM` read via `getUint16(offset + 22, true)`.
tracker/wire.py:30
`accuracy_m` is added as a required dataclass field with no default. Any existing code that builds `LocationUpdate` without it will now raise a TypeError. The value is also packed as an unsigned 16-bit integer with no validation, so an accuracy above 65535 or a negative sentinel (e.g. -1 for 'unknown') makes `struct.pack` raise `struct.error`, which fails the whole batch.
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=7e856b01-98bd-495c-863b-ecef6fd2334e --> <!-- cubic:review-run=cb0161d1-6b0b-5b01-b9c2-218223d5ab1b --> <!-- metadata:{"confidence":10} --> P2: The new 24-byte wire record is incompatible with the checked-in client decoder, which still uses 22-byte records and drops `accuracy_m`. Update the client record size, decode the trailing `Uint16`, and expose it as `accuracyM` before shipping this 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>The new 24-byte wire record is incompatible with the checked-in client decoder, which still uses 22-byte records and drops `accuracy_m`. Update the client record size, decode the trailing `Uint16`, and expose it as `accuracyM` before shipping this 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: The new 24-byte wire record is incompatible with the checked-in client decoder, which still uses 22-byte records and drops `accuracy_m`. Update the client record size, decode the trailing `Uint16`, and expose it as `accuracyM` before shipping this 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/101/ai_pr_review_github_delivery_f5e51b9023ad631ce0359c9b98dc7c28b8c7fe79e1894e836eb4a92856029d0b?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F101)</sub> <!-- cubic:review-post:ai_pr_review_github_delivery_f5e51b9023ad631ce0359c9b98dc7c28b8c7fe79e1894e836eb4a92856029d0b:0dee44f11aad0e6102315b99119585e8952752f5:cb0161d1-6b0b-5b01-b9c2-218223d5ab1b -->
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 misses accuracy field **High Severity** <!-- DESCRIPTION START --> The TypeScript client still treats records as 22 bytes, so `decodeBatch` rejects or mis-parses the new 24-byte layout that includes `accuracy_m`. `pollLatest` silently drops the extra field, so the tracking page never sees GPS accuracy. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 0bb5ee6e-51e0-4a0f-99b6-9f50564215bd --> <!-- LOCATIONS START tracker/wire.py#L12-L30 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjNjYTc1MzYzLTMyYjktNDFkZi1hMThkLWU4MWQ5MzVlY2YyOCIsImVuY3J5cHRpb25LZXkiOiJiQmppYWs5WW9IWDliVXVsYzI2Q05IMHR5OXZRYlU2Qng1c2FHUzlzV01vIiwiYnJhbmNoIjoicHItYWI5YjNkMDBmNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" 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=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjNjYTc1MzYzLTMyYjktNDFkZi1hMThkLWU4MWQ5MzVlY2YyOCIsImVuY3J5cHRpb25LZXkiOiJiQmppYWs5WW9IWDliVXVsYzI2Q05IMHR5OXZRYlU2Qng1c2FHUzlzV01vIiwiYnJhbmNoIjoicHItYWI5YjNkMDBmNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwMSwiY29tbWl0U2hhIjoiOTE3Yjc2N2Q5MGNiNGY5ZDNjZGUzMjdiMmUzZmY1ZGVmYWJmMjk1YiIsInByb3ZpZGVyIjoiZ2l0aHViIn19" 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 917b767d90cb4f9d3cde327b2e3ff5defabf295b. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PR-level
<!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue. <!-- BUGBOT_FIX_ALL --> <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aToyMmVkMzRlYS01ZDVlLTRkMmQtYmE2Ny1hZWU2ZGQ4ZTNlYTIiLCJlbmNyeXB0aW9uS2V5IjoiQXhybUZJT0pvbVlTSEg0X0hmQTZPUWFMUWlBNjhRUGFJSnZVMks5WWtXcyIsImJyYW5jaCI6InByLWFiOWIzZDAwZjciLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" 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 917b767d90cb4f9d3cde327b2e3ff5defabf295b. 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 grows the unversioned wire record from 22 to 24 bytes. Any device still sending the old format will have its batch rejected by decode_batch's modulo check, and a batch of 12n old records passes that check and gets misparsed. Nothing in the code handles version negotiation or the old layout. [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
tracker/wire.py:13
**Tracking page client still decodes 22-byte records** Records are now 24 bytes, but `client/src/decode.ts` still uses `RECORD_SIZE = 22` and has no accuracy field. Batches get rejected or decoded at the wrong offsets. Change the client to 24-byte records and read `accuracyM` with `getUint16(offset + 22, true)`. ``` 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 batches rejected or misread** Courier devices in the field still post 22-byte records, and nothing marks the format. `decode_batch` rejects most of their batches and misparses any whose length also divides by 24. Add a format version to the batch and keep decoding the 22-byte layout for old devices. ``` tracker/wire.py:13 _RECORD = struct.Struct("<IiiIHHBBH") tracker/wire.py:50 shipment_id, lat, lon, recorded_at, speed_kmh, heading_deg, status, battery_pct, accuracy_m = ( tracker/wire.py:14 RECORD_SIZE = _RECORD.size tracker/wire.py:13 (base) _RECORD = struct.Struct("<IiiIHHBB") ```
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 record format grows from 22 to 24 bytes with no version tag or fallback. The module docstring says the records are posted by courier devices, so older devices sending 22-byte records will fail the modulo check in decode_batch, or be misparsed when the total length happens to be a multiple of 24 (e.g. 12 legacy records = 264 bytes = 11×24). [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
client/src/decode.ts:4
**TS client misreads new 24-byte batches** decode.ts still uses RECORD_SIZE = 22, so decodeBatch throws on 24-byte batches, or misaligns every record after the first when the length is also a multiple of 22. Set RECORD_SIZE to 24 and read accuracyM 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 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, client/src/decode.ts:14 recordedAt: view.getUint32(offset + 12, true), ```
tracker/wire.py:13
**Existing 22-byte device uploads now rejected** The record size changed from 22 to 24 bytes with no versioning, so devices still posting 22-byte records fail in decode_batch. They either raise ValueError or are silently misparsed when the total length is a multiple of 24. Add a format version or accept both sizes during rollout. ``` tracker/wire.py:13 _RECORD = struct.Struct("<IiiIHHBBH") tracker/wire.py:14 RECORD_SIZE = _RECORD.size tracker/wire.py:1 """Binary encoding for location updates posted by courier devices. tracker/wire.py:3 Devices upload updates in batches over flaky mobile links, so each update is a fixed-size tracker/wire.py:4 little-endian record rather than JSON. tracker/wire.py:5 """ 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)] ```
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 decoder remains incompatible** Changing the shared binary record to 24 bytes leaves the TypeScript decoder on the 22-byte format. A newly encoded record passed to `decodeBatch` fails its length check, and the client model cannot expose the new accuracy value. As a result, clients cannot decode location batches produced in the new format. Update the client record size, decoder, and `LocationUpdate` type alongside this change.
PR-level
<!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=66790175"><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 in-repository TypeScript decoder and model support the new 24-byte record. <h2>Findings</h2> 1. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Client decoder remains incompatible** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/101#discussion_r4059119858">▶</a> <h3>Summary</h3> This PR appends horizontal GPS accuracy to each Python location-update record and increases its encoded size from 22 to 24 bytes. - Adds `accuracy_m` to the immutable `LocationUpdate` model and Python encode/decode paths. - Updates Python round-trip fixtures and the record-size assertion. - Leaves the repository’s TypeScript wire decoder on the incompatible 22-byte layout. <sub>Reviews (1) · Last reviewed commit: ["Include GPS accuracy in device location ..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/fe68b1852c939d5eb73200026d5624a0d3ea15a7)</sub>
Mjolnir (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 and there is no version marker. decode_batch only checks `len % RECORD_SIZE`, so old 22-byte batches get rejected, and a batch of 12n legacy records (264n bytes) passes the check and decodes misaligned. [grounded: diff] [consensus 3/3: valid=3]
valid · impact high
Same issue as finding 1. Legacy 22-byte payloads are rejected, and a batch whose length is a multiple of 264 bytes passes the length check and decodes silently into garbage. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The TS client decodes the same wire format but still hardcodes 22-byte records and the old offsets. The change updated the Python side and left this parallel decoder out of step, so the client now throws on 24-byte batches or misdecodes them. [grounded: tree client/src/decode.ts] [consensus 3/3: valid=3]
raw comments (4)
PR-level
[P1] TypeScript client still decodes 22-byte records tracker/wire.py:13-14 Records are now 24 bytes (an extra `H` for `accuracy_m`), but `client/src/decode.ts` still hardcodes `RECORD_SIZE = 22`. It also never reads the accuracy field, and `client/src/types.ts` doesn't have one. As a result, the tracking page's `decodeBatch` throws "batch length … is not a multiple of 22" for most batches the server now produces. When the length is a multiple of both 22 and 24 (264 bytes, for example), it silently misreads every record after the first. `pollLatest` keeps working only because it reads the first 22 bytes and drops the accuracy value. The TS decoder and types need to change in the same commit.
PR-level
[P1] Changing the record layout with no version breaks existing devices tracker/wire.py:13 `TrackingService.ingest_updates` → `decode_batch` now accepts only 24-byte records, and nothing in the payload marks which layout a batch uses. Courier devices still running firmware that sends the old 22-byte records will get most of their uploads rejected. Worse, when a batch length happens to be a multiple of 24 (12 records = 264 bytes, for example), the batch passes the length check and decodes into garbage shipment IDs and coordinates without any error. Server and fleet can't all be upgraded at the same moment, so the layout change needs a version marker or a transition path that accepts both sizes.
PR-level
[P1] Record layout changed in place, so every existing device payload breaks tracker/wire.py:13-14 — `_RECORD` grows from 22 to 24 bytes, and there is no version byte, length negotiation or fallback. The module docstring says courier devices upload these fixed-size records in batches, and `TrackingService.ingest_updates` passes the body straight to `decode_batch`. Any device still on firmware that sends 22-byte records will have its batches rejected with "not a multiple of 24". The worse case is a batch whose byte length is a multiple of both sizes (any multiple of 264 bytes, e.g. 12 legacy records). That batch passes the length check and decodes silently into 11 garbage updates with misaligned shipment IDs, coordinates and timestamps. Unless every device is updated at the same moment as the server, the server needs to keep accepting the old layout, for example through a format version or a separate record size per layout.
PR-level
[P2] TypeScript client decoder still assumes 22-byte records tracker/wire.py:13 — `client/src/decode.ts` hardcodes `RECORD_SIZE = 22` and the old field offsets, and `client/src/types.ts` has no accuracy field. After this change, the client's `decodeBatch` throws on any 24-byte-record payload unless the byte length happens to be a multiple of 264, in which case it decodes misaligned records. `decodeLocationUpdate` also never exposes `accuracy_m`. The client package needs to be updated together with the Python format.
Mjolnir (Sonnet 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
RECORD_SIZE goes from 22 to 24, so decode_batch (called by TrackingService.ingest_updates) raises on 22-byte batches from old devices. Batches whose length is a multiple of 24 get misparsed. The format has no version field. [grounded: diff] [consensus 3/3: valid=3]
valid · impact high
The TS client decodes the same binary wire format but still hardcodes a 22-byte record and has no accuracy field. This change updated only the Python side, so the client is now out of sync: 24-byte batches will throw or be mis-framed (264 bytes is 12×22). The pollLatest mention is a detail that isn't shown, but the core failure holds. [grounded: tree client/src/decode.ts] [consensus 3/3: valid=3]
raw comments (3)
tracker/wire.py:13
[P1] Wire format change not mirrored in the TypeScript client decoder The Python record grows from 22 to 24 bytes (new trailing `accuracy_m` uint16), but `client/src/decode.ts` still hardcodes `RECORD_SIZE = 22` and reads fields only up to offset 21. `client/src/types.ts` also has no `accuracyM`. Any 24-byte batch decoded by the client fails the `byteLength % 22` check, or is split at the wrong boundaries and yields garbage records, whenever the byte length isn't a multiple of 22. The client and server are now incompatible, so the matching decode.ts/types.ts update belongs in this change.
tracker/wire.py:13
[P1] Server now rejects every 22-byte record from existing devices, with no versioning `decode_batch` requires `len(data) % RECORD_SIZE == 0` and `decode_update` requires exactly `RECORD_SIZE` bytes. After this change, batches from devices still sending 22-byte records are rejected with `ValueError` through `TrackingService`. If the batch length happens to be a multiple of 24 (for example 12 old records = 264 bytes), it is misparsed as 11 new records with shifted fields. Devices upload over flaky links, so firmware will not update in lockstep with the server. The change adds no version marker or compatibility path for the layout change, and the lack of one risks dropped or corrupted location data during rollout.
tracker/wire.py:13
[P1] TypeScript client still decodes the old 22-byte record layout Adding the `H` field makes each record 24 bytes, but `client/src/decode.ts` still hardcodes `RECORD_SIZE = 22` and has no `accuracy_m`/`accuracyM` field in `client/src/types.ts` (the tracking page decodes this same wire format; `docs/architecture.md` calls `client/` the tracking page's TypeScript package). Once the server emits 24-byte records, `decodeBatch` throws "batch length N is not a multiple of 22" for most batch sizes. A batch of 11 records is 264 bytes, which happens to be a multiple of 22 and would be mis-framed instead. `pollLatest`/`decodeLocationUpdate` on a single record would read only the first 22 bytes and drop the accuracy. The client's size constant, decoder (`getUint16(offset + 22, true)`) and `LocationUpdate` type need to change together with this wire-format change, or the format needs versioning or coordinated rollout.
qodo · 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 (3)
tracker/wire.py:13
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 1\. Tracking page misreads new updates <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> <b><i>_RECORD</i></b> now emits 24-byte records, but the exported client decoder still validates and advances batches in 22-byte increments and omits the accuracy field. A single new record is rejected, while an 11-record batch is divisible by 22 and is silently decoded as twelve misaligned updates. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The Python encoder now produces 24-byte location records containing a two-byte accuracy value, while the TypeScript client still expects the previous 22-byte format. This causes new batches to be rejected or decoded with incorrect record boundaries. ## Fix Focus Areas - client/src/decode.ts[1-33] - client/src/types.ts[1-11] ## Recommended Fix Set the client `RECORD_SIZE` to 24, decode an unsigned little-endian 16-bit accuracy value at offset 22, and expose that value on `LocationUpdate` using the client’s existing camel-case naming convention. Add coverage that decodes Python-compatible 24-byte records and multi-record batches. ``` <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> Include GPS accuracy in device location records <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 horizontal GPS accuracy to every courier location update. >• Extends binary location records from 22 to 24 bytes. >• Verifies record and batch round trips with the expanded schema. ></pre> </dd> </dl> </details> <details> <summary>Diagram</summary> <dl> <dd> <br/> ```mermaid graph TD A["Courier Device"] -->|location fields| B["LocationUpdate"] -->|encode| C["Wire Encoder"] -->|24-byte record| D["Binary Batch"] -->|decode| E["Wire Decoder"] -->|accuracy_m| F["Location Ingest"] ``` </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 binary record format</b></summary> <dl> <dd> - ➕ Supports old and new device records during rolling deployments - ➕ Makes future wire-format evolution explicit - ➕ Avoids interpreting mixed 22-byte and 24-byte batches incorrectly - ➖ Adds protocol metadata and decoder branching - ➖ Expands scope beyond the single-field addition - ➖ Requires defining backward-compatibility behavior </dd> </dl> </details> >**Recommendation:** Appending an unsigned 16-bit field is the simplest approach when device producers and ingest consumers deploy together and no old records remain buffered. If mixed client versions or delayed batches are possible, versioning or dual-format decoding should be added because changing RECORD_SIZE makes the formats incompatible. </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>Add GPS accuracy to the binary location schema</code> <code>+5/-2</code></summary> <br/> >Add GPS accuracy to the binary location schema > ><pre> >• Adds &#x27;accuracy_m&#x27; to &#x27;LocationUpdate&#x27; and appends it as an unsigned 16-bit value in the binary record. Encoding and decoding now preserve the field, increasing each record to 24 bytes. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/101/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>Cover accuracy in wire-format round trips</code> <code>+2/-1</code></summary> <br/> >Cover accuracy in wire-format round trips > ><pre> >• Adds horizontal accuracy to the sample location update and confirms it survives record and batch encoding. Updates the expected fixed record size from 22 to 24 bytes. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/101/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 (1)</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 page misreads new updates <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>_RECORD</i></b> now emits 24-byte records, but the exported client decoder still validates and advances >batches in 22-byte increments and omits the accuracy field. A single new record is rejected, while >an 11-record batch is divisible by 22 and is silently decoded as twelve misaligned updates. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[tracker/wire.py[13]](https://github.com/drape-io/crbench-qodo-2026-09/pull/101/files#diff-a96ff02b19d865466d47bd00f4571b21735869683ea182ceb28404225cffc689R13-R13)</code> > >```diff >+_RECORD = struct.Struct("<IiiIHHBBH") >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The changed Python struct appends an unsigned two-byte value, making each encoded record 24 bytes. >The tracking-page package still declares a 22-byte record, checks batch divisibility against 22, >advances by 22, and exposes no accuracy property. ></pre> > > <code>[tracker/wire.py[13-14]](https://github.com/drape-io/crbench-qodo-2026-09/blob/55fac3115d588be1a6a54867ad1c7004076f552f/tracker/wire.py/#L13-L14)</code> > <code>[tracker/wire.py[32-44]](https://github.com/drape-io/crbench-qodo-2026-09/blob/55fac3115d588be1a6a54867ad1c7004076f552f/tracker/wire.py/#L32-L44)</code> > <code>[client/src/decode.ts[1-30]](https://github.com/drape-io/crbench-qodo-2026-09/blob/55fac3115d588be1a6a54867ad1c7004076f552f/client/src/decode.ts/#L1-L30)</code> > <code>[client/src/types.ts[1-11]](https://github.com/drape-io/crbench-qodo-2026-09/blob/55fac3115d588be1a6a54867ad1c7004076f552f/client/src/types.ts/#L1-L11)</code> > <code>[README.md[15-17]](https://github.com/drape-io/crbench-qodo-2026-09/blob/55fac3115d588be1a6a54867ad1c7004076f552f/README.md/#L15-L17)</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 encoder now produces 24-byte location records containing a two-byte accuracy value, while the TypeScript client still expects the previous 22-byte format. This causes new batches to be rejected or decoded with incorrect record boundaries. > >## Fix Focus Areas >- client/src/decode.ts[1-33] >- client/src/types.ts[1-11] > >## Recommended Fix >Set the client `RECORD_SIZE` to 24, decode an unsigned little-endian 16-bit accuracy value at offset 22, and expose that value on `LocationUpdate` using the client’s existing camel-case naming convention. Add coverage that decodes Python-compatible 24-byte records and multi-record batches. >``` > <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 is a behavioral wire-format/API change affecting serialization and deserialization compatibility, so it warrants a careful standard review.</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/55fac3115d588be1a6a54867ad1c7004076f552f --> <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>