fix(batch): publish only fully initialized batches - #455
Open
ubettigole wants to merge 1 commit into
Open
Conversation
This was referenced Jul 29, 2026
ubettigole
marked this pull request as ready for review
July 29, 2026 00:40
ubettigole
requested review from
a team,
behinddwalls and
sbalabanov
as code owners
July 29, 2026 00:40
ubettigole
force-pushed
the
abettigole/idempotent_batch_creation
branch
from
July 31, 2026 01:02
3c288dd to
ebe1008
Compare
ubettigole
force-pushed
the
abettigole/idempotent_batch_creation
branch
from
July 31, 2026 01:04
ebe1008 to
d361e46
Compare
ubettigole
force-pushed
the
abettigole/idempotent_batch_creation
branch
from
July 31, 2026 06:27
d361e46 to
5f05d6a
Compare
behinddwalls
approved these changes
Jul 31, 2026
| } | ||
|
|
||
| // initializeBatch creates the reverse-index structure and marks a Creating batch ready for publication. | ||
| func (c *Controller) initializeBatch(ctx context.Context, batch entity.Batch) (entity.Batch, error) { |
Collaborator
There was a problem hiding this comment.
maybe we rename to populateBatch as we already created i guess?
| func (c *Controller) initializeBatch(ctx context.Context, batch entity.Batch) (entity.Batch, error) { | ||
| batchDependent := entity.BatchDependent{ | ||
| BatchID: batch.ID, | ||
| Dependents: []string{}, |
Collaborator
There was a problem hiding this comment.
can we use the conflict.Analyzer.all for now here to populate?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Prevent partially initialized batches from becoming visible to downstream processing or dependency analysis.
New batches are first persisted in the Creating state. The batch controller then creates the batch’s reverse-index row, registers it with each dependency, and transitions it to Created only after structural initialization succeeds. Request-log and speculate publication happen only after that transition.
Retries continue to mint fresh batch IDs. Failed attempts may leave unpublished Creating or Created batches behind, but these attempts remain inert; metrics track their creation so a cleanup job can be added later if necessary.
Test Plan
Unit tests
Issues