Repository navigation
feat(conflict): Add target signature and dictionary store contracts #850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
manjari25
merged 2 commits into
main
from
manjari/tango-signature-entities-and-contracts
Oct 16, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "go_default_library", | ||
| srcs = [ | ||
| "mock_store.go", | ||
| "store.go", | ||
| "target_label.go", | ||
| "target_signature.go", | ||
| ], | ||
| importpath = "github.com/uber/submitqueue/submitqueue/extension/conflict/tango", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["@org_uber_go_mock//gomock:go_default_library"], | ||
| ) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // Copyright (c) 2026 Uber Technologies, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package tango | ||
|
|
||
| //go:generate mockgen -source=store.go -destination=mock_store.go -package=tango | ||
|
|
||
| import "context" | ||
|
|
||
| // SignatureReader reads the target signature of a batch. It is the read-only | ||
| // view of SignatureStore for consumers that must not write. | ||
| type SignatureReader interface { | ||
| // Get returns the signature of batchID in the bound queue. The bool is | ||
| // false when no signature has been created for the batch. | ||
| Get(ctx context.Context, batchID string) (TargetSignature, bool, error) | ||
| } | ||
|
|
||
| // SignatureStore persists target signatures. A signature is immutable: it is | ||
| // created once under (Queue, BatchID) and never updated. Reads and writes are | ||
| // per-batch point operations, so any backend can implement it. | ||
| type SignatureStore interface { | ||
| SignatureReader | ||
|
|
||
| // Create persists signature in one write. Returns an already-exists error | ||
| // if the bound queue already holds a signature for signature.BatchID, so the | ||
| // first signature written stays and the caller can read it back with Get. | ||
| Create(ctx context.Context, signature TargetSignature) error | ||
| } | ||
|
|
||
| // DictionaryReader reads the label recorded for a target ID. It is the | ||
| // read-only view of DictionaryStore. | ||
| type DictionaryReader interface { | ||
| // Get returns the label recorded for id in the bound queue. The bool is | ||
| // false when none has been recorded. | ||
| Get(ctx context.Context, id uint64) (TargetLabel, bool, error) | ||
| } | ||
|
|
||
| // DictionaryStore persists the target dictionary: one TargetLabel for each | ||
| // 64-bit target ID. A record is immutable: it is created once under | ||
| // (Queue, ID) and never updated. Two labels can share an ID, so the first label | ||
| // recorded stays and the caller can read it back with Get to detect a collision. | ||
| type DictionaryStore interface { | ||
| DictionaryReader | ||
|
|
||
| // Create persists label in one write. Returns an already-exists error if | ||
| // the bound queue holds a label for label.ID, whether or not it is the same | ||
| // label, so repeating a write is harmless. | ||
| Create(ctx context.Context, label TargetLabel) error | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright (c) 2026 Uber Technologies, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package tango | ||
|
|
||
| // TargetLabel is one build target label and the 64-bit ID it hashes to. The | ||
| // whole record is immutable: (Queue, ID) is its identity and there is no update | ||
| // path. Two labels can share an ID on a hash collision; the first one recorded | ||
| // stays. | ||
| type TargetLabel struct { | ||
| // Queue is the queue the label was seen in. Unique together with ID. | ||
| Queue string | ||
|
|
||
| // ID is the 64-bit hash of Label. | ||
| ID uint64 | ||
|
|
||
| // Label is the target label exactly as the build graph reported it. | ||
| Label string | ||
|
|
||
| // CreatedAt is the Unix milliseconds timestamp when the record was created. | ||
| CreatedAt int64 | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // Copyright (c) 2026 Uber Technologies, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package tango | ||
|
|
||
| // TargetSignature is the set of build targets a batch changes, as 64-bit IDs. | ||
| // The whole record is immutable: (Queue, BatchID) is its identity and there is | ||
| // no update path. | ||
| type TargetSignature struct { | ||
| // Queue is the queue the batch belongs to. Unique together with BatchID. | ||
| Queue string | ||
|
|
||
| // BatchID is the canonical decimal batch identifier, unique within Queue. | ||
| BatchID string | ||
|
|
||
| // BaseRevision is the commit SHA the changed targets were computed against. | ||
| BaseRevision string | ||
|
|
||
| // Targets is sorted ascending by ID, with no duplicate IDs. | ||
| Targets []SignatureTarget | ||
|
|
||
| // CreatedAt is the Unix milliseconds timestamp when the record was created. | ||
| CreatedAt int64 | ||
|
manjari25 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| // SignatureTarget is one changed build target in a TargetSignature. | ||
| type SignatureTarget struct { | ||
| // ID is the 64-bit hash of the target's label. | ||
| ID uint64 | ||
|
|
||
| // Distance is the distance from the nearest directly changed source in the | ||
| // reverse dependency graph; 0 means directly changed. | ||
| Distance int32 | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.