Skip to content

feat(conflict): Record target labels in the dictionary when signing a batch - #901

Open
manjari25 wants to merge 1 commit into
mainfrom
manjari/tango-dictionary-write
Open

manjari25 wants to merge 1 commit into
mainfrom
manjari/tango-dictionary-write

Conversation

@manjari25

Copy link
Copy Markdown
Contributor

Why

Signatures hold only 64-bit target IDs, so an overlap can't be traced back to targets. The dictionary store exists but nothing writes to it, and labels are only available while a batch is signed.

What

  • When an attempt creates a signature, it records each (ID, label) in the background, off the request path.
  • Best-effort: a failed write is logged and skipped, since conflicts use IDs alone and a later batch rewrites the label. ErrAlreadyExists is success, and on a hash collision the first label stays.
  • Params gains Dictionary and Logger.

Test plan

  • go test -race ./submitqueue/extension/conflict/tango/...: labels are written once on creation, not when the signature already exists, and failures are logged without failing the analysis.
  • Not wired into the orchestrator yet, so there's nothing to run manually

@manjari25
manjari25 marked this pull request as ready for review October 21, 2026 00:27
@manjari25
manjari25 requested review from a team, behinddwalls and sbalabanov as code owners October 21, 2026 00:27
// the analyzed batch's. It fails closed: any signature it cannot obtain fails
// the analysis.
func New(params Params) conflict.Analyzer {
if params.Logger == 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.

i would skip nil check here, logger not being passed, we should just panic

for _, l := range labels {
err := a.Dictionary.Create(ctx, TargetLabel{Queue: queue, ID: l.id, Label: l.label, CreatedAt: createdAt})
if err != nil && !errors.Is(err, storage.ErrAlreadyExists) {
a.Logger.Warnw("failed to record target label", "queue", queue, "id", l.id, "label", l.label, "error", err)

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.

i think @sbalabanov wanted it to not be best-effort but always fail if fail here?

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.

This is the target dictionary not the signature store.

@behinddwalls behinddwalls Oct 21, 2026 •

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.

i think even for labels, we should not skip, because then what's the point of storing it if we can live without one. So having a store which is source of truth for this data, we should ensure we have it recorded post this stage, so when it's required in later stages say conflict relaxation or any other then it's there and not missing. Because if missing, we will end-up adding another fallback in those stages again

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