The API tester on the docs page answers questions the real endpoint answers differently #59

Open
opened 2026-11-03 18:52:31 +00:00 by skippy-bot · 0 comments

Problem

The Try it panel on the API docs page re-implements the callsign lookup in the LiveView process instead of calling the endpoint. It applies a 30 day window the endpoint does not have and it matches only the sender column, so for an old packet, or for an object or item name the endpoint resolves through object_name and item_name, the panel says No packets found while GET /api/v1/callsign/<same> returns the packet. The page states it is calling the API, so a developer debugging their client trusts the wrong answer.

Evidence

At 2f150f66:

  • lib/aprsme_web/live/api_docs_live.ex:109 builds thirty_days_ago and :113 passes it as start_time with limit: 1 into Packets.get_recent_packets/1, which also filters by sender only (lib/aprsme/packets/query_builder.ex:58).
  • lib/aprsme_web/controllers/api/v1/callsign_controller.ex:66 calls Packets.get_latest_packet_for_callsign/1, which has no time bound and matches object_name and item_name at lib/aprsme/packets/prepared_queries.ex:32.
  • lib/aprsme_web/live/api_docs_live.ex:899 tells the visitor the panel calls the API directly.

Expected

The tester shows what the documented endpoint returns, either by issuing the HTTP request or by calling the same function the controller calls.

How to verify

Create one packet 45 days old and one packet whose object_name is EOC, then compare the panel output with curl /api/v1/callsign/<name> for each. Both diverge today.

Acceptance criteria

  • The tester and the endpoint return the same body for the same callsign.
  • The tester has no window the endpoint does not apply.
  • A test compares the two for an old packet and for an object name.

Effort: S
Lens: api

## Problem The Try it panel on the API docs page re-implements the callsign lookup in the LiveView process instead of calling the endpoint. It applies a 30 day window the endpoint does not have and it matches only the sender column, so for an old packet, or for an object or item name the endpoint resolves through `object_name` and `item_name`, the panel says `No packets found` while `GET /api/v1/callsign/<same>` returns the packet. The page states it is calling the API, so a developer debugging their client trusts the wrong answer. ## Evidence At `2f150f66`: - `lib/aprsme_web/live/api_docs_live.ex:109` builds `thirty_days_ago` and `:113` passes it as `start_time` with `limit: 1` into `Packets.get_recent_packets/1`, which also filters by sender only (`lib/aprsme/packets/query_builder.ex:58`). - `lib/aprsme_web/controllers/api/v1/callsign_controller.ex:66` calls `Packets.get_latest_packet_for_callsign/1`, which has no time bound and matches `object_name` and `item_name` at `lib/aprsme/packets/prepared_queries.ex:32`. - `lib/aprsme_web/live/api_docs_live.ex:899` tells the visitor the panel calls the API directly. ## Expected The tester shows what the documented endpoint returns, either by issuing the HTTP request or by calling the same function the controller calls. ## How to verify Create one packet 45 days old and one packet whose `object_name` is `EOC`, then compare the panel output with `curl /api/v1/callsign/<name>` for each. Both diverge today. ## Acceptance criteria - [ ] The tester and the endpoint return the same body for the same callsign. - [ ] The tester has no window the endpoint does not apply. - [ ] A test compares the two for an old packet and for an object name. **Effort:** S **Lens:** api
Sign in to join this conversation.
No description provided.