AntFleet

Disagreement · de288601-openai-1

API contract divergence between /activity server page and /api/activity endpoint serialization

solo GPT-5
repo e24ef98c·PR #7·reviewed 2 weeks ago

GPT-5 finding

API contract divergence between /activity server page and /api/activity endpoint serialization

mediumapi-contractmedium
  • apps/web/app/activity/page.tsx
  • apps/web/app/api/activity/route.ts
The server page normalizes Dates to ISO strings before passing to the client, but the API route returns the raw query result and relies on JSON serialization. This duplication risks future drift (e.g., additional fields, BigInt counts) and type mismatches. The client casts the polled response to FleetActivityJson without validation, so any drift can cause runtime errors.

Recommendation

Create a shared serializer that converts loadFleetActivity() results into FleetActivityJson (e.g., normalize lastSweepAt/lastReceiptAt/events.ts to strings and ensure numeric windows). Use it in both the server page and /api/activity route. Optionally validate the response shape on the client with a schema (e.g., zod) before setData.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →