Repository navigation
feat: list stored deals over REST and make export read them - #4
Merged
Merged
Conversation
Both booking paths persist deals under deal:<id>, but no route enumerated
them: export_deals read a deal_index key that nothing writes, so
GET /api/v1/deals/export always returned an empty list.
- Add GET /api/v1/deals (optional ?status=) returning DealListResponse,
a page of DealBookingResponse envelopes, registered with the other
literal deal routes ahead of the {deal_id} catch-all.
- Back it with deal_service.list_deals(), which uses the storage
backend's deal:* scan; export_deals now reads the same set.
- Regenerate docs/reference/endpoints.md.
Relies on IABTechLab#75 for the wire mapping of the template path's internal
"confirmed" status. docs/api/openapi.json is not touched here: the
committed file predates several routes, and a separate docs PR
regenerates it from the app.
numarasSigmaSoftware
force-pushed
the
feature/deal-list-route
branch
from
September 15, 2026 20:07
053e761 to
f37c7c6
Compare
numarasSigmaSoftware
marked this pull request as ready for review
September 15, 2026 20:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Both booking paths persist deals under
deal:<id>, but no route enumerates them.export_dealsreads adeal_indexkey that nothing in the codebase writes, soGET /api/v1/deals/exportalways returns an empty list. Verified against a running instance on the CSV adapter: two deals booked throughPOST /api/v1/dealsandPOST /api/v1/deals/from-template, export still returnedcount: 0.Change
GET /api/v1/deals, operator key required, with an optionalstatusfilter typed as the sharedDealStatuswire enum and applied to the wire-mapped status, so?status=bookedreturns template-booked deals stored asconfirmed. ReturnsDealListResponse: the existingDealBookingResponseenvelope per deal,count, andskipped, the ids of stored records that fail to serialize (logged with their id; one bad row no longer fails the whole list).GET /api/v1/deals/{deal_id}. Export is unchanged, including its stored-status filter (confirmed/proposed/cancelled) that connectors already use.deal_service.list_deals(), which uses the storage base's existingdeal:*scan.export_dealsnow reads the same set and the deaddeal_indexlookup is gone.docs/reference/endpoints.md; add the route todocs/api/overview.md; changelog entry under Unreleased.Relies on IABTechLab#75 for the wire mapping of the template path's internal
confirmedstatus.docs/api/openapi.jsonis not touched here: it is regenerated in IABTechLab#83, and this branch rebases onto that once merged and regenerates again so the list route lands in the document.Verification
tests/unit/test_deal_list_route.py: route registration, list, wire-status filter (including the 422 on an internal name), operator gate (401 anonymous), skipped rows, empty store, non-matching filter, a real scan on a temp SQLite backend with an idempotency key in the store, and export after booking through both POST routes. Each behavior test was seen failing before its change.tests/unit/test_route_shadowing.py: storage mock gainedlist_deals.test_self_asserted_advertiser_identity_is_floored, because the suite leavesad_seller.dbbehind; that is Unit suite leaves ./ad_seller.db behind, so a second consecutive local run can fail IABTechLab/seller-agent#82 and is not touched by this PR.Not changed
No pagination on the list yet, since no other list route in the API pages either. Endpoint counts in the hand-written docs are bumped in IABTechLab#83; one further bump follows once both merge.
Note for maintainers, not part of this change
tests/unit/test_deal_list_route.pycopies thesys.modulesstub forad_seller.flows.execution_activation_flowthattest_route_shadowing.py,test_deal_booking_endpoints.py, andtest_trust_tier_verification.pyalready carry. Each copy exists to dodge the cancel-scope leak tracked in IABTechLab#60. IABTechLab#66 landed as part 2 of that issue, so the four stub blocks may now be removable. Left untouched here; a separate cleanup PR should delete all four once the suite is confirmed green without them.