Skip to content

refactor(dlq): keep start identity decoding private - #1088

Open
sbalabanov wants to merge 1 commit into
wt/sqc011from
dlq-start-wire-identity
Open

sbalabanov wants to merge 1 commit into
wt/sqc011from
dlq-start-wire-identity

Conversation

@sbalabanov

@sbalabanov sbalabanov commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

TLDR: Keep start-payload identity decoding private to the dedicated start DLQ without changing deserialization.

Summary

Move the start-only identity helper into the start DLQ controller's file and make it private. It continues to use UnmarshalLandRequest, preserving complete canonical wire validation and the existing identity checks. Update the existing test reference and the Start DLQ wiring example.

Based on #1040, which introduces the dedicated start DLQ controller.

Repro

Run ./tool/bazel test //submitqueue/orchestrator/controller/dlq:go_default_test --test_filter='TestDLQStartController_(ReconcilesOnlyError|RejectsMalformedPayload)' --test_output=all. Complete Start payloads retain their existing reconciliation behavior; malformed known fields and invalid identities are still rejected.

Test Plan

  • Existing Start DLQ reconciliation, malformed-payload, and retry tests cover the unchanged helper behavior; all five focused DLQ, message-contract, pipeline, primary-start, and gateway controller targets pass.
  • The DLQ build target, make gazelle, make fmt, make lint, and make check-gazelle pass.

Revert Plan

Revert this PR.

Issue Links

None.

@cla-assistant

cla-assistant Bot commented Nov 13, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant

cla-assistant Bot commented Nov 13, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sbalabanov sbalabanov left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If DecodeLandRequestID is only used by "start" dlq, should it be placed there? Can put it on top of a PR implementing a separate start dlq.
Also, the goal was to make deserialization as safe as possible, so if LandRequest slightly changes, ID and queue could still be safely deserialized. Present me with options; if switching away from deserialization helper only brings us subtle performance/memory saving benefits, it does not worth the additional complexity of the code.

@sbalabanov

Copy link
Copy Markdown
Contributor Author

In reply to your review: yes, this is start-specific. On main only the start-DLQ registration uses it; the separate start-DLQ controller becomes its sole production caller, so the helper can be private in that controller's file.

Both the existing helper and this PR deserialize the complete generated Start message with the same canonical protojson options. Unknown additions are already tolerated. LandRequestFromStart is currently just a conversion, with no validation/error return. Skipping it avoids that coupling and an unused URI copy/strategy mapping, but does not improve recovery from invalid known wire fields; both versions reject change:false.

Options:

  1. Keep the existing deserialization helper (recommended minimal option). Do not carry this standalone conversion cleanup. When the separate start DLQ is in place, move/unexport the start-only helper there. This preserves current full-wire validation with the least code.
  2. Keep direct full-Start decoding, local to the separate start DLQ. This can sit on top of that controller change, but its benefit is only avoiding the unused domain conversion and its coupling, not stronger compatibility. I would not keep it just for small memory/work savings.
  3. Make start-DLQ recovery explicitly identity-only. Read the whole JSON document, but allow unusable non-identity land fields while requiring an unambiguous ID/queue and retaining tenant checks. That would recover change:false, unlike either current implementation. The tradeoff is intentionally relaxing Start-field validation in the DLQ only; it needs explicit compatibility/identity-safety rules and tests, not merely replacing the helper call. Primary start processing would retain full validation.

For the resilience goal you described, option 3 is the meaningful behavior change; otherwise I recommend option 1. No code, stacking, or PR-state changes made while waiting for your choice.

[addressed by agent]

@sbalabanov

Copy link
Copy Markdown
Contributor Author

In reply to your review: yes, this is start-specific. On main only the start-DLQ registration uses it; the separate start-DLQ controller becomes its sole production caller, so the helper can be private in that controller's file.

Both the existing helper and this PR deserialize the complete generated Start message with the same canonical protojson options. Unknown additions are already tolerated. LandRequestFromStart is currently just a conversion, with no validation/error return. Skipping it avoids that coupling and an unused URI copy/strategy mapping, but does not improve recovery from invalid known wire fields; both versions reject change:false.

Options:

  1. Keep the existing deserialization helper (recommended minimal option). Do not carry this standalone conversion cleanup. When the separate start DLQ is in place, move/unexport the start-only helper there. This preserves current full-wire validation with the least code.
  2. Keep direct full-Start decoding, local to the separate start DLQ. This can sit on top of that controller change, but its benefit is only avoiding the unused domain conversion and its coupling, not stronger compatibility. I would not keep it just for small memory/work savings.
  3. Make start-DLQ recovery explicitly identity-only. Read the whole JSON document, but allow unusable non-identity land fields while requiring an unambiguous ID/queue and retaining tenant checks. That would recover change:false, unlike either current implementation. The tradeoff is intentionally relaxing Start-field validation in the DLQ only; it needs explicit compatibility/identity-safety rules and tests, not merely replacing the helper call. Primary start processing would retain full validation.

For the resilience goal you described, option 3 is the meaningful behavior change; otherwise I recommend option 1. No code, stacking, or PR-state changes made while waiting for your choice.

[addressed by agent]

In that light, keep using UnmarshalLandRequest(). However, refactor the whole helper function to be private and move to a new start dlq controller introduced in another PR. Base this PR on top of that another PR.

Summary:
Move the start-payload identity helper next to its dedicated DLQ controller and make it private. Keep UnmarshalLandRequest and all identity and wire validation behavior unchanged. Update the existing same-package test reference and the Start DLQ wiring example.

Test Plan:
Existing DLQ Start reconciliation, malformed-payload, and retry tests cover the unchanged behavior. Five focused controller/contract/pipeline test targets, the DLQ build target, formatting, lint, and BUILD synchronization checks pass.

Revert Plan:
Revert this commit.
@sbalabanov
sbalabanov force-pushed the dlq-start-wire-identity branch from 1d5b137 to 2a08ae3 Compare November 14, 2026 08:41
@sbalabanov
sbalabanov changed the base branch from main to wt/sqc011 November 14, 2026 08:41
@sbalabanov sbalabanov changed the title refactor(dlq): decode start identity from wire refactor(dlq): keep start identity decoding private Nov 14, 2026
@sbalabanov

Copy link
Copy Markdown
Contributor Author

In reply to your comment: moved the identity helper into dlq/start.go as private decodeLandRequestID in 2a08ae39.

It still calls UnmarshalLandRequest(), with deserialization and controller identity checks unchanged. This PR now targets the dedicated start-DLQ PR #1040's branch. Existing Start DLQ reconciliation, malformed-payload, and retry coverage, the focused test targets, and build/lint checks pass.

[addressed by agent]

@sbalabanov
sbalabanov marked this pull request as ready for review November 14, 2026 08:45
@sbalabanov
sbalabanov requested review from a team and behinddwalls as code owners November 14, 2026 08:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants