Skip to content

[4/N] feat(submitqueue): activate request status materialization#343

Open
albertywu wants to merge 1 commit into
wua/request-log-materializerfrom
wua/request-projection-activation
Open

[4/N] feat(submitqueue): activate request status materialization#343
albertywu wants to merge 1 commit into
wua/request-log-materializerfrom
wua/request-projection-activation

Conversation

@albertywu

@albertywu albertywu commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Route synchronous, queued, and DLQ request-log writes through the shared materializer so authoritative and queue projections converge with retained history.

Preserve the original DLQ failure reason as the terminal request last error.

Test Plan

make fmt && make build && make test && make e2e-test

Stack

  1. [1/N] feat(storage): add request read-model stores #340
  2. [2/N] feat(gateway): persist request receipts on Land #341
  3. [3/N] feat(request): materialize request log status #342
  4. @ [4/N] feat(submitqueue): activate request status materialization #343
  5. [5/N] feat(gateway): add request status lookups #344
  6. [6/N] feat(gateway): add queue request listing #345
  7. [7/N] feat(gateway): add request history lookups #346

Route synchronous, queued, and DLQ request-log writes through the shared materializer so authoritative and queue projections converge with retained history.

Preserve the original DLQ failure reason as the terminal request last error.

Validation: make fmt && make build && make test && make e2e-test
if err := store.GetRequestLogStore().Insert(ctx, logEntry); err != nil {
return fmt.Errorf("failed to insert request log for %s: %w", requestID, err)
logEntry := entity.NewRequestLog(requestID, entity.RequestStatusError, logVersion, lastError, nil)
if err := requestcore.NewMaterializer(store).PersistLog(ctx, logEntry); err != nil {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unconditional PersistLog(error) is now authoritative-status-bearing, and it runs even when the request is already in a different terminal state — with logVersion left at the request's current version on that branch. Conclude's landed log carries that same post-CAS version, so in logWins the two are versioned-terminal at equal RequestVersion and the decision falls to the timestamp tie-break — which this reconcile-time log always wins. Net effect: a request that landed (or cancelled) gets its user-visible Status/List state flipped to error whenever a stale message for it dead-letters afterward. failBatch amplifies it: an already-Succeeded batch still "fans out only" and flips every landed member. Before this PR the spurious error log was cosmetic history noise; now it overwrites the answer users see.

Fix shape: mirror conclude's divergent-terminal skip (conclude.go:128-140) — only write the error log when the terminal state is actually Error (i.e. this reconcile owns it, including the repair-on-redelivery case the comment above describes); a genuinely landed/cancelled request needs no error entry. The logWins tie-break on #342 is the belt to this suspender.

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.

2 participants