Skip to content

feat(conflict): Add target signature and dictionary store contracts - #850

Merged
manjari25 merged 2 commits into
mainfrom
manjari/tango-signature-entities-and-contracts
Oct 16, 2026
Merged

manjari25 merged 2 commits into
mainfrom
manjari/tango-signature-entities-and-contracts

Conversation

@manjari25

@manjari25 manjari25 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Why?

The Tango-backed conflict analyzer needs to persist each batch's affected-target signature, and a dictionary that maps the 64-bit target IDs back to their labels. This is the first PR in a stack that builds that storage layer. It defines the vocabulary and contracts only.

What?

Everything is added under submitqueue/extension/conflict/tango, the extension that owns the data:

  • Adds the TargetSignature, SignatureTarget and TargetLabel entities.
  • Adds SignatureReader and SignatureStore:
    • Get: returns (signature, found, error).
    • Create: write-once, returns an already-exists error on a repeat.
    • SignatureStore embeds SignatureReader, so a consumer such as conflict relaxation can take the read-only view and cannot write.
  • Adds DictionaryReader and DictionaryStore, keyed by (queue, ID), with the same read/write split:
    • Create: write-once, returns an already-exists error if the ID is already recorded, even with a different label, so the first label stays.
    • Get: returns (label, found, error). A label that differs from the caller's means a hash collision.
  • Adds the generated mock for these interfaces. It sits in the tango package, not a mock/ subpackage, so the analyzer's same-package tests do not create an import cycle.
  • No behavior changes. Nothing implements or consumes the contracts yet, and neither service's storage aggregate exposes them.

Test Plan

make check-gazelle
make check-mocks
make lint
./tool/bazel test //submitqueue/extension/conflict/...
CI

Issue

@manjari25
manjari25 requested review from a team and sbalabanov as code owners October 13, 2026 19:41
@manjari25
manjari25 marked this pull request as draft October 13, 2026 19:47
@manjari25
manjari25 force-pushed the manjari/tango-signature-entities-and-contracts branch from 5b5e9d2 to 5afc805 Compare October 14, 2026 02:03
@manjari25
manjari25 marked this pull request as ready for review October 14, 2026 02:26
@manjari25
manjari25 added this pull request to stack #872 October 14, 2026 21:02
Comment thread submitqueue/extension/conflict/tango/target_label.go
Comment thread submitqueue/extension/conflict/tango/target_signature.go
Comment thread submitqueue/extension/storage/target_dictionary_store.go Outdated
@manjari25 manjari25 changed the title feat(storage): Add target signature and dictionary store contracts feat(conflict): Add target signature and dictionary store contracts Oct 15, 2026
@manjari25
manjari25 force-pushed the manjari/tango-signature-entities-and-contracts branch from 842f382 to 5d2bc1e Compare October 16, 2026 18:39
@manjari25
manjari25 added this pull request to the merge queue Oct 16, 2026
Merged via the queue into main with commit d6a6e08 Oct 16, 2026
18 checks passed
@manjari25
manjari25 deleted the manjari/tango-signature-entities-and-contracts branch October 16, 2026 18:56
DivyanshGarg380 pushed a commit to DivyanshGarg380/submitqueue that referenced this pull request Oct 17, 2026
## Why?
Signatures are expensive to recompute, so the analyzer needs a durable
source of truth keyed by batch. This PR implements the `SignatureStore`
contract from the [previous
PR](uber#850) on MySQL, as a package
owned by the tango conflict extension.

## What?
Everything is added under `submitqueue/extension/conflict/tango/mysql`:
- Adds the `target_signature` table:
  - Primary key `(queue, batch_id)`, with no secondary index.
  - A row is written once and never updated.
- `targets` is a `LONGBLOB`, because the largest signatures can be
large.
- Adds a queue-bound MySQL `SignatureStore`:
  - A duplicate create maps to `storage.ErrAlreadyExists`.
  - A signature whose queue differs from the bound queue is rejected.
  - `Get` reports a missing batch as `found=false`, not as an error.
- Adds a small binary codec for the targets: an 8-byte big-endian ID
followed by a signed varint distance per entry. The codec lives next to
the MySQL store because the byte format is a storage detail, so callers
only ever see `tango.TargetSignature`.
- Adds the schema directory to the `queueshard` linter so the new
table's primary key is checked.
- Restricts the Bazel visibility of the MySQL package to the tango tree,
the orchestrator service wiring, and its integration test.
- Adds an integration suite with its own compose file, which runs the
store against a real MySQL. It covers a large (100k-target) signature, a
duplicate create keeping the first signature, and queue isolation.
- The store is not added to the orchestrator `Storage` aggregate.
Nothing constructs it yet, and wiring the schema into the compose stack,
the e2e suites and the local init target is left for the PR that uses
it.

## Test Plan
`./tool/bazel test
//submitqueue/extension/conflict/tango/mysql:go_default_test`
`./tool/bazel test
//test/integration/submitqueue/extension/conflict/tango/mysql/...
--test_output=streamed`
`make check-gazelle`
`make check-mocks`
`make lint`
CI

## Issue
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