Skip to content

feat(gateway): add List API with request-summary read model#226

Open
albertywu wants to merge 5 commits into
wua/list-api-rfcfrom
wua/implement-list-api
Open

feat(gateway): add List API with request-summary read model#226
albertywu wants to merge 5 commits into
wua/list-api-rfcfrom
wua/implement-list-api

Conversation

@albertywu

@albertywu albertywu commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a queue-scoped, time-windowed List RPC to the gateway, served from a
new gateway-owned request-summary read model rather than by scanning and
reconciling the append-only request log per request.

  • entity: RequestSummary, plus queue + change URIs on RequestLog,
    QueueFromRequestID parse helper, and IsKnownRequestStatus allow-list
    for filter validation.
  • storage: RequestSummaryStore (page-in/page-out List with a stable
    newest-started-first cursor; UpsertFromLog guarded merge) and mysql impl
    • schema; queue/change_uri columns on request_log.
  • core/request: PersistLog helper that pairs RequestLogStore.Insert with a
    guarded summary upsert, wired into Land, Cancel, and the log sink so all
    three write paths update both views through one helper.
  • gateway: ListController + List RPC (proto + generated code) and wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Test Plan

Issues

Stack

  1. docs: add gateway list api rfc #225
  2. @ feat(gateway): add List API with request-summary read model #226

@albertywu albertywu force-pushed the wua/implement-list-api branch from 19d5978 to b218ec7 Compare June 16, 2026 21:35
@albertywu albertywu marked this pull request as ready for review June 16, 2026 21:39
@albertywu albertywu requested review from a team, behinddwalls and sbalabanov as code owners June 16, 2026 21:39
albertywu and others added 5 commits June 16, 2026 23:48
Add a queue-scoped, time-windowed List RPC to the gateway, served from a
new gateway-owned request-summary read model rather than by scanning and
reconciling the append-only request log per request.

- entity: RequestSummary, plus queue + change URIs on RequestLog,
  QueueFromRequestID parse helper, and IsKnownRequestStatus allow-list
  for filter validation.
- storage: RequestSummaryStore (page-in/page-out List with a stable
  newest-started-first cursor; UpsertFromLog guarded merge) and mysql impl
  + schema; queue/change_uri columns on request_log.
- core/request: PersistLog helper that pairs RequestLogStore.Insert with a
  guarded summary upsert, wired into Land, Cancel, and the log sink so all
  three write paths update both views through one helper.
- gateway: ListController + List RPC (proto + generated code) and wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The request-summary store was the only store using a database transaction
(BeginTx + SELECT ... FOR UPDATE + Commit), which this repo forbids in
favor of optimistic concurrency.

Replace it with the same optimistic-locking pattern as
requestStore.UpdateState: read the summary unlocked, merge the incoming
log in memory, then write back with a conditional update guarded by a new
row version column. A concurrent writer (another gateway write path or a
redelivered log event) loses the CAS, and the caller re-reads and
re-merges. Merges are monotonic and idempotent, so the bounded loop
converges; exhausting it surfaces as storage.ErrVersionMismatch.

- schema: add optimistic-lock version column to request_summary.
- update is now a pure conditional write taking oldVersion/newVersion;
  insert returns inserted=false on a duplicate-key race so the caller
  retries into the merge path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@albertywu albertywu force-pushed the wua/implement-list-api branch from b218ec7 to 883bf2f Compare June 16, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant