crbench//

← all cases

The cached shipment payload changes shape without bumping CACHE_VERSION, so old entries are read as current

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

Ground-truth defects

d1 · correctness · high · tracker/cache.py:8
The diff changes the shape of the shipment payload (destination_city and destination_country become a nested destination object) and updates TrackingService.summary to read the new shape, but leaves CACHE_VERSION in tracker/cache.py at 6. The cache is Redis, shared by every replica and outliving a deploy, and CACHE_VERSION is part of every key. After this ships, the new code reads payloads the previous release cached under the same v6 keys, in the old flat shape, and summary() raises KeyError for every shipment still cached until the entries expire. Nothing in the diff references cache.py.

The change under review

diff
diff --git a/tracker/serializers.py b/tracker/serializers.py
index c1d7330..28abbe8 100644
--- a/tracker/serializers.py
+++ b/tracker/serializers.py
@@ -16,7 +16,6 @@ def shipment_to_payload(shipment: Shipment) -> dict[str, object]:
         "status": shipment.status.value,
         "eta": shipment.eta.isoformat() if shipment.eta else None,
         "carrier": shipment.carrier,
-        "destination_city": shipment.destination_city,
-        "destination_country": shipment.destination_country,
+        "destination": {"city": shipment.destination_city, "country": shipment.destination_country},
         "weight_kg": shipment.weight_kg,
     }
diff --git a/tracker/service.py b/tracker/service.py
index 38e3800..0603fdb 100644
--- a/tracker/service.py
+++ b/tracker/service.py
@@ -28,7 +28,7 @@ class TrackingService:
         """One line for support tooling: where a shipment is going and when it lands."""
         p = self.shipment_payload(shipment_id)
         eta = str(p["eta"])[:16] if p["eta"] else "unknown"
-        destination = f"{p['destination_city']}, {p['destination_country']}"
+        destination = f"{p['destination']['city']}, {p['destination']['country']}"
         return f"{p['tracking_number']}: {p['status']} to {destination} (ETA {eta})"
 
     def is_delayed(self, shipment_id: int, now: datetime) -> bool:

Leaderboard for this case

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

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

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 medium
The module docstring says shipment_to_payload defines 'the JSON shape the API returns'. The diff removes the top-level destination_city and destination_country keys, so any API consumer reading them now gets nothing. No compatibility alias or versioning was added. [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
tracker/serializers.py:19
This change replaces the flat `destination_city`/`destination_country` fields with a nested `destination` object, but `CACHE_VERSION` in tracker/cache.py stays at 6, so cache keys (`shipment:v6:<id>`) are unchanged. Payloads cached in Redis before the deploy still have the old flat shape and `shipment_payload()` returns them as-is. Two things break: `summary()` now reads `p['destination']['city']` and raises KeyError for every shipment with a stale cache entry, and the API returns a mix of old and new shapes until those entries are evicted. During a rolling deploy, old and new pods also write different shapes under the same key. Fix: bump `CACHE_VERSION` (or flush the cache) along with the shape change.
tracker/serializers.py:19
This is a breaking change to the public API response: the `destination_city` and `destination_country` fields are removed and replaced by a nested `destination` object, with no versioning or transition period. Any API consumer that reads the old field names stops getting them. The serializer docstring calls this 'the JSON shape the API returns', so it is a contract.
Cubic · 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/service.py:31
<!-- cubic:v=81cfa930-523a-421d-9356-8e0642301471 --> <!-- cubic:review-run=54091c2a-f537-5338-b411-fe712c5a7a93 --> <!-- metadata:{"confidence":6} --> P1: After this deploy, any payload cached before the change is still under `shipment:v6:{id}` in Redis with the old flat shape (`destination_city`/`destination_country`), because `ShipmentCache` stores the serialized payload, `shipment_payload()` returns it unvalidated, and no entry has a TTL — `cache_ttl_s` in settings is never wired into the cache and `invalidate()` has no callers. That changed line then raises `KeyError: 'destination'`, and the API serves the old shape to the tracking page. Bump `CACHE_VERSION` (or flush the cache) as part of this payload-shape change, and also apply `cache_ttl_s` to entries so such staleness self-heals. <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/service.py, line 31: <comment>After this deploy, any payload cached before the change is still under `shipment:v6:{id}` in Redis with the old flat shape (`destination_city`/`destination_country`), because `ShipmentCache` stores the serialized payload, `shipment_payload()` returns it unvalidated, and no entry has a TTL — `cache_ttl_s` in settings is never wired into the cache and `invalidate()` has no callers. That changed line then raises `KeyError: 'destination'`, and the API serves the old shape to the tracking page. Bump `CACHE_VERSION` (or flush the cache) as part of this payload-shape change, and also apply `cache_ttl_s` to entries so such staleness self-heals.</comment> <file context> @@ -28,7 +28,7 @@ def summary(self, shipment_id: int) -> str: p = self.shipment_payload(shipment_id) eta = str(p["eta"])[:16] if p["eta"] else "unknown" - destination = f"{p['destination_city']}, {p['destination_country']}" + destination = f"{p['destination']['city']}, {p['destination']['country']}" return f"{p['tracking_number']}: {p['status']} to {destination} (ETA {eta})" </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/service.py"> <violation number="1" location="tracker/service.py:31"> P1: After this deploy, any payload cached before the change is still under `shipment:v6:{id}` in Redis with the old flat shape (`destination_city`/`destination_country`), because `ShipmentCache` stores the serialized payload, `shipment_payload()` returns it unvalidated, and no entry has a TTL — `cache_ttl_s` in settings is never wired into the cache and `invalidate()` has no callers. That changed line then raises `KeyError: 'destination'`, and the API serves the old shape to the tracking page. Bump `CACHE_VERSION` (or flush the cache) as part of this payload-shape change, and also apply `cache_ttl_s` to entries so such staleness self-heals.</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/104/ai_pr_review_github_delivery_a7e2072d6ed14ad0dd442afbbe13101f8be7e5b3853b4c4a6c043107399a7c1d?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F104)</sub> <!-- cubic:review-post:ai_pr_review_github_delivery_a7e2072d6ed14ad0dd442afbbe13101f8be7e5b3853b4c4a6c043107399a7c1d:0c579a8d9354d20c8092added015a3abda723008:54091c2a-f537-5338-b411-fe712c5a7a93 -->
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/serializers.py:19
### Stale cache serves old payload shape **High Severity** <!-- DESCRIPTION START --> The payload now nests `destination`, but `CACHE_VERSION` is still 6, so Redis keeps serving the old flat keys. `summary` then reads `p['destination']` and raises `KeyError` for any already-cached shipment, and the tracking page keeps seeing the previous shape. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: c8c94131-c978-4ec2-a1d9-8bd2c1770893 --> <!-- LOCATIONS START tracker/serializers.py#L18-L19 tracker/service.py#L30-L31 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`tracker/service.py#L30-L31`](https://github.com/drape-io/crbench-cursor-2026-09/blob/7e69742cd13f60eb19c3c25e0061b03f21a80c49/tracker/service.py#L30-L31) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojc4OTZjMDkzLTZmNTUtNGUxNS04MjViLWJhOGE3NmFkYWI2NyIsImVuY3J5cHRpb25LZXkiOiItdXozbXllcl82b1dSMy1HRnM0b3dYU1NVN1o2OWZHRXVKYmJmQXNUdEtnIiwiYnJhbmNoIjoicHItYTA4ZmQ2MTZlOCIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" 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=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojc4OTZjMDkzLTZmNTUtNGUxNS04MjViLWJhOGE3NmFkYWI2NyIsImVuY3J5cHRpb25LZXkiOiItdXozbXllcl82b1dSMy1HRnM0b3dYU1NVN1o2OWZHRXVKYmJmQXNUdEtnIiwiYnJhbmNoIjoicHItYTA4ZmQ2MTZlOCIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNCwiY29tbWl0U2hhIjoiN2U2OTc0MmNkMTNmNjBlYjE5YzNjMjVlMDA2MWIwM2YyMWE4MGM0OSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" 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 7e69742cd13f60eb19c3c25e0061b03f21a80c49. 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=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTpkNTBlMTc2Ny02ZjE5LTQ2N2QtYTM0Zi1mYWJmMTY2Y2I4YzgiLCJlbmNyeXB0aW9uS2V5IjoiZHlPaTdwY3YwWnlJbU1qRHFYSWpoVGhybWxBSDhpWUxlMlNJeEtaSUo3VSIsImJyYW5jaCI6InByLWEwOGZkNjE2ZTgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" 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 7e69742cd13f60eb19c3c25e0061b03f21a80c49. 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 · impact high
The serializer is documented as producing "the JSON shape the API returns", and `search`/`shipment_payload` return it to callers. This change removes the flat `destination_city`/`destination_country` keys and doesn't keep them during a transition, so existing clients that read those keys break. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact high
raw comments (2)
tracker/serializers.py:19
**API payload drops the flat destination fields** The serialized shipment is what `shipment_payload` and `search` return to API callers. Replacing `destination_city`/`destination_country` with a nested object breaks clients that read them, and nothing keeps the old fields during a transition. Keep the flat fields next to the new `destination` object until clients have moved, or version the API. ``` tracker/serializers.py:19 "destination": {"city": shipment.destination_city, "country": shipment.destination_country}, tracker/serializers.py:19 (base) "destination_city": shipment.destination_city, tracker/serializers.py:20 (base) "destination_country": shipment.destination_country, tracker/service.py:1 """Shipment tracking: the operations the API exposes.""" tracker/service.py:38 def search(self, tracking_number: str) -> dict[str, object] | None: tracker/service.py:39 shipment = self._store.find_by_tracking_number(tracking_number) tracker/service.py:40 return None if shipment is None else self.shipment_payload(shipment.id) ```
tracker/serializers.py:19
**Cached old-shape payloads break after deploy** The payload shape changed but `CACHE_VERSION` wasn't bumped, so Redis entries from the previous release are still read. `summary` raises KeyError on `destination`, and the API serves the old flat shape until entries expire. Bump `CACHE_VERSION` in tracker/cache.py to 7. ``` tracker/serializers.py:19 "destination": {"city": shipment.destination_city, "country": shipment.destination_country}, tracker/service.py:31 destination = f"{p['destination']['city']}, {p['destination']['country']}" tracker/cache.py:8 CACHE_VERSION = 6 tracker/cache.py:11 def key_for(shipment_id: int) -> str: tracker/cache.py:12 return f"shipment:v{CACHE_VERSION}:{shipment_id}" tracker/cache.py:15 def connect_backend(url: str) -> MutableMapping[str, str]: tracker/cache.py:16 """A cache backend for `url`: in-process for memory://, otherwise Redis.""" tracker/cache.py:17 if url.startswith("memory://"): tracker/cache.py:18 return {} tracker/cache.py:19 import redis # only needed outside tests and local runs ```
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
raw comments (1)
tracker/cache.py:8
**Stale Redis entries break after payload reshape** The payload shape changed (flat destination_city/country became a nested destination) but CACHE_VERSION is still 6. Entries cached under the old shape are still served from Redis, and summary() then reads p['destination'] and fails. Bump CACHE_VERSION so old entries are ignored. ``` tracker/serializers.py:19 "destination": {"city": shipment.destination_city, "country": shipment.destination_country}, tracker/service.py:31 destination = f"{p['destination']['city']}, {p['destination']['country']}" tracker/cache.py:8 CACHE_VERSION = 6 tracker/cache.py:11 def key_for(shipment_id: int) -> str: tracker/cache.py:12 return f"shipment:v{CACHE_VERSION}:{shipment_id}" tracker/cache.py:28 def get(self, shipment_id: int) -> dict[str, object] | None: tracker/cache.py:29 raw = self._backend.get(key_for(shipment_id)) tracker/cache.py:30 return None if raw is None else json.loads(raw) docs/architecture.md:4 serialized shipment payloads are cached in Redis. ```
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/service.py:31
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Stale cache breaks summaries** Existing Redis entries under the unchanged `shipment:v6:<id>` key contain the former flat destination fields. After deployment, `shipment_payload()` can return one of these entries, causing this nested lookup to raise `KeyError: 'destination'` and break support summaries until the cached entry is invalidated or expires. Bump the cache version or handle the previous payload shape.
PR-level
<!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=66790217"><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 cached payloads using the previous destination schema are invalidated, versioned away, or handled compatibly. <h2>Findings</h2> 1. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Stale Cache Breaks Summaries** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/104#discussion_r4059119184">▶</a> <h3>Summary</h3> The PR changes shipment payloads from flat destination fields to a nested `destination` object and updates support summaries to consume the new shape. - Produces `destination.city` and `destination.country`. - Updates summary formatting for the nested payload. - Leaves the serialized-payload cache version unchanged, allowing incompatible pre-deployment entries to be reused. <details open><summary>Diagram</summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart LR S[Shipment] --> N[New nested payload] N --> C[shipment:v6 cache] O[Existing flat v6 payload] --> C C --> P[shipment_payload] P --> U[support summary] O -. missing destination object .-> E[KeyError] ``` </details> <sub>Reviews (1) · Last reviewed commit: ["Nest the destination in shipment payload..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/a4430f7de36307f01c4c8bbe2b6003fce968a7e9)</sub>
Mjolnir (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 change switches the payload to a nested `destination` object, but `CACHE_VERSION` stays at 6, so `key_for` still builds the same keys. `ShipmentCache.get` returns old cached JSON as it is, and `put` sets no expiry. Any shipment cached in the old flat shape will make `summary()` fail with `KeyError: 'destination'`, and old and new pods break each other during a rolling deploy. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact high
raw comments (2)
PR-level
[P1] Payload shape changed but the cache key version was not bumped tracker/serializers.py:19. This change replaces `destination_city`/`destination_country` with a nested `destination` object, but `tracker/cache.py` still builds keys as `shipment:v6:{id}`. Payloads that were cached in Redis before the deploy keep the old flat shape. `ShipmentCache.put` sets no expiry, so those entries are never evicted even though a TTL is configured. After the deploy, `TrackingService.shipment_payload` returns these stale entries as they are, so `summary()` hits `KeyError: 'destination'` at `p['destination']['city']` for any shipment that was already cached. API consumers also get a mix of old-shape and new-shape payloads. During a rolling deploy it fails in both directions: old pods write flat payloads that new pods can't read, and new pods write nested payloads that old pods' `summary()` can't read. This only affects environments with a shared Redis cache; tests use a fresh in-memory dict, so they don't catch it. Bumping `CACHE_VERSION` in the same change avoids this.
tracker/serializers.py:19
[P1] Payload shape changed without bumping the cache version, so cached entries break `summary()` `shipment_payload()` returns whatever is cached under `shipment:v6:‹id›` in Redis. `ShipmentCache.put` sets no TTL, and `CACHE_VERSION` in `tracker/cache.py` is still 6. After this deploys, every shipment cached by the previous release still has the flat `destination_city`/`destination_country` keys. For those shipments, `summary()` raises `KeyError: 'destination'` at `p['destination']['city']`, and the API keeps returning the old shape. The reverse also fails during a rolling Helm upgrade with several replicas: old pods read entries written by new pods and hit `KeyError: 'destination_city'`. The cache key already has a version prefix for exactly this case, so bumping `CACHE_VERSION` to 7 alongside the serializer change would fix both directions. The tests don't catch this because each one starts with an empty in-memory cache.
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 cache key is versioned with CACHE_VERSION = 6, which this change did not bump. ShipmentCache.put writes json.dumps(payload) with no expiry, and shipment_payload returns cached entries as they are. So payloads cached before the change still have the flat keys, and summary() raises KeyError on p['destination']. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact high
raw comments (2)
tracker/serializers.py:19
[P1] Payload shape changed without bumping CACHE_VERSION The serializer now emits a nested `destination` object in place of the flat `destination_city` and `destination_country` keys. Cached payloads are keyed by `shipment:v{CACHE_VERSION}:{id}`, and `CACHE_VERSION` in `tracker/cache.py` is still 6. Any shipment already cached in Redis under v6 keeps the old flat shape, because `ShipmentCache.put` sets no expiry and `cache_ttl_s` is never applied. `shipment_payload` returns those entries as-is. After deploy, `TrackingService.summary()` (tracker/service.py:31) raises `KeyError: 'destination'` for every previously cached shipment. API consumers of `shipment_payload` and `search` also get a mix of old and new shapes. During a rolling deploy, old pods reading new-shape entries hit the same problem in reverse. Bumping `CACHE_VERSION` to 7 in the same change avoids it.
tracker/serializers.py:19
[P1] Payload shape changed without bumping CACHE_VERSION The serialized shipment payload changes from flat `destination_city`/`destination_country` to a nested `destination` object, but `CACHE_VERSION` in `tracker/cache.py` is still 6. Payloads are cached as JSON in Redis and read back by `shipment_payload`. After deploy, any entry written by the old code under `shipment:v6:*` is served as-is with the old flat shape. `TrackingService.summary` now reads `p['destination']['city']`, so it raises `KeyError: 'destination'` for every shipment that is still cached, until the entries expire or are invalidated. Any other consumer of the cached payload, such as `search`, also sees the old shape. This happens when the Redis backend persists across the deploy, i.e. a real `redis_url` rather than `memory://`. Bumping `CACHE_VERSION` in the same change would avoid the stale entries.
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/service.py:31
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 1\. Cached shipments can break support summaries <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> <b><i>shipment_payload</i></b> still reads entries under the unchanged cache version after the serializer changes the destination shape. Redis entries created by the previous code lack <b><i>destination</i></b>, so <b><i>summary</i></b> raises <b><i>KeyError</i></b> for those shipments until the entries expire or are manually removed. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The serializer now nests destination fields, but existing cached payloads remain under the same cache key namespace and still use the old flat shape. Support summaries can therefore fail with `KeyError` after deployment when they read a pre-deployment cached shipment. ## Fix Focus Areas - tracker/cache.py[8-10] - tracker/service.py[19-24] ## Recommended Fix Increment `CACHE_VERSION` when changing the serialized shipment schema, or make cache reads validate and invalidate legacy payloads before returning them. Ensure a cache miss repopulates the entry using the new nested destination structure. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </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. Cached shipments can break support summaries <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>shipment_payload</i></b> still reads entries under the unchanged cache version after the serializer >changes the destination shape. Redis entries created by the previous code lack <b><i>destination</i></b>, so ><b><i>summary</i></b> raises <b><i>KeyError</i></b> for those shipments until the entries expire or are manually removed. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[tracker/service.py[31]](https://github.com/drape-io/crbench-qodo-2026-09/pull/104/files#diff-c765d0913a406bf2ed144c979a40131c4d4d7da3311c0628d2546603ad473d35R31-R31)</code> > >```diff >+ destination = f"{p['destination']['city']}, {p['destination']['country']}" >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The new summary access requires the nested <b><i>destination</i></b> key, while <b><i>ShipmentCache</i></b> constructs keys >from the unchanged <b><i>CACHE_VERSION = 6</i></b> and directly JSON-decodes any existing entry without schema >validation or migration. A cache entry written by the prior serializer can therefore be returned >unchanged and cause the new lookup to fail. ></pre> > > <code>[tracker/service.py[19-24]](https://github.com/drape-io/crbench-qodo-2026-09/blob/1b9a0bd6f026b93251a99d183beb7f31f204bf59/tracker/service.py/#L19-L24)</code> > <code>[tracker/service.py[29-32]](https://github.com/drape-io/crbench-qodo-2026-09/blob/1b9a0bd6f026b93251a99d183beb7f31f204bf59/tracker/service.py/#L29-L32)</code> > <code>[tracker/cache.py[8-18]](https://github.com/drape-io/crbench-qodo-2026-09/blob/1b9a0bd6f026b93251a99d183beb7f31f204bf59/tracker/cache.py/#L8-L18)</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 serializer now nests destination fields, but existing cached payloads remain under the same cache key namespace and still use the old flat shape. Support summaries can therefore fail with `KeyError` after deployment when they read a pre-deployment cached shipment. > >## Fix Focus Areas >- tracker/cache.py[8-10] >- tracker/service.py[19-24] > >## Recommended Fix >Increment `CACHE_VERSION` when changing the serialized shipment schema, or make cache reads validate and invalidate legacy payloads before returning them. Ensure a cache miss repopulates the entry using the new nested destination structure. >``` > <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>🚀 Fast</code>: This is a small, localized payload-shape change with a corresponding support-summary update and no high-risk or broad behavioral impact.</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/1b9a0bd6f026b93251a99d183beb7f31f204bf59 --> <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>
PR-level
<h3>PR Summary by Qodo</h3> Nest destination fields in shipment payloads <code>✨ Enhancement</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> >• Groups destination city and country under a single extensible payload object. >• Updates support summaries to consume the nested destination structure. ></pre> </dd> </dl> </details> <details> <summary>Diagram</summary> <dl> <dd> <br/> ```mermaid graph TD A["Shipment model"] -->|"flat fields"| B["Payload serializer"] -->|"nested destination"| C["Tracking service"] -->|"serves payload"| E["Tracking page"] C -->|"caches payload"| D["Shipment cache"] C -->|"formats destination"| F["Support summary"] ``` </dd> </dl> </details> <details> <summary>High-Level Assessment</summary> <dl> <dd> <br/> >The nested payload object is the appropriate approach because destination metadata can grow without adding more top-level shipment fields. Keeping the fields flat would limit extensibility, while introducing a destination domain model would add unnecessary scope for this payload-only contract change. Cache-version compatibility should be verified before rollout. </dd> </dl> </details> <details> <summary> Files changed (2) <code> +2 / -3 </code> </summary> <dl> <dd> <br/> <details> <summary>Enhancement (1) <code> +1 / -2 </code></summary> <dl> <dd> <details> <summary>serializers.py<code>Serialize destination as a nested object</code> <code>+1/-2</code></summary> <br/> >Serialize destination as a nested object > ><pre> >• Replaces the top-level destination city and country keys with a single destination object containing city and country. This creates an extensible location structure for future postcode and coordinate fields. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/104/files#diff-f7853b9744af3856616afb137f4acb3c8b4fa56fd39decdc9499f6ca6892a9b7'>tracker/serializers.py</a> </details> </dd> </dl> </details> <details> <summary>Refactor (1) <code> +1 / -1 </code></summary> <dl> <dd> <details> <summary>service.py<code>Read nested destination fields in support summaries</code> <code>+1/-1</code></summary> <br/> >Read nested destination fields in support summaries > ><pre> >• Updates support summary formatting to read city and country from the new destination object. The resulting human-readable summary remains unchanged. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/104/files#diff-c765d0913a406bf2ed144c979a40131c4d4d7da3311c0628d2546603ad473d35'>tracker/service.py</a> </details> </dd> </dl> </details> </dd> </dl> </details>