[2/N] feat(gateway): persist request receipts on Land#341
Conversation
Create authoritative request summaries, exact change URI mappings, and queue receipt projections before publishing accepted Land requests. Validation: make fmt && make build && make test && make e2e-test
| ) | ||
|
|
||
| // AdmissionWriter creates immutable request context and initial read-model projections. | ||
| type AdmissionWriter struct { |
There was a problem hiding this comment.
thinking if there is a better name for it? admission seems too generic for what we do here?
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package controller |
There was a problem hiding this comment.
any reason to separate this tests from land_test?
| } | ||
|
|
||
| // Create writes immutable request context and initial accepted projections. | ||
| // Writes are independent and stop on the first error; successful earlier writes are not rolled back. |
There was a problem hiding this comment.
Stop-on-first-error with no rollback means a failure anywhere between the summary Create and the publish in Land leaves permanent accepted summary/queue rows for an sqid that never entered the pipeline. The client retry mints a fresh sqid (land.go:133), so these orphans accumulate rather than converge — and once the List API lands later in this stack, every queue viewer sees them forever. I couldn't find any reaper/reconciler for accepted-without-progress rows. That story doesn't have to be in this PR, but it needs to exist (or at least be written down) before List ships: e.g. a sweeper that errors out accepted rows older than some bound, or admission-before-counter idempotency so retries reuse the sqid.
| Change: change, | ||
| LandStrategy: strategy, | ||
| } | ||
| if err := validateStoredIdentifier("generated sqid", landRequest.ID); err != nil { |
There was a problem hiding this comment.
Queue names in the (~235, 255] byte range pass the validateStoredIdentifier("queue", ...) check at line 104 but then deterministically fail here once /{seq} is appended, surfacing as a confusing "generated invalid request ID" user error for a request that was accepted as valid. Suggest bounding the queue-name length up front to leave room for the suffix, so the rejection happens at the right check with the right message.
Summary
Create authoritative request summaries, exact change URI mappings, and queue receipt projections before publishing accepted Land requests.
Test Plan
✅
make fmt && make build && make test && make e2e-testStack