Skip to content

feat(stovepipe): add the build stage controller#407

Open
roychying wants to merge 2 commits into
chenghan.ying/stovepipe-buildrunner-extentionfrom
chenghan.ying/stovepipe-build-controller
Open

feat(stovepipe): add the build stage controller#407
roychying wants to merge 2 commits into
chenghan.ying/stovepipe-buildrunner-extentionfrom
chenghan.ying/stovepipe-build-controller

Conversation

@roychying

Copy link
Copy Markdown
Contributor

Why?

Stovepipe needs a controller that actually triggers builds using the BuildRunner contract.

What?

Adds stovepipe/controller/build. Process unmarshals a BuildRequest (request id only), reloads the Request, no-ops if already terminal, resolves the runner via Factory.For(Config{QueueName}), reads the already-decided BuildStrategy/BaseURI (retryable if not yet visible — never re-derives full-vs-incremental itself), triggers via buildRunner.Trigger(ctx, baseURI, request.URI, nil), persists a Build row (BuildStore.Create, tolerant of ErrAlreadyExists), and publishes the resulting build id to the buildsignal topic, partitioned by build id.

Test Plan

stovepipe/controller/build/build_test.go covers: terminal-request no-op, unresolved build strategy (retryable), Factory.For/Trigger/BuildStore.Create/publish failure paths, and the happy path for both full and incremental strategies. go build ./... and go test ./stovepipe/controller/build/... pass.

Issue

@roychying
roychying requested review from a team, behinddwalls and sbalabanov as code owners July 20, 2026 23:19
Comment thread stovepipe/controller/build/build.go
Comment thread stovepipe/controller/build/build.go
return fmt.Errorf("BuildController failed to publish build signal for %s: %w", build.ID, err)
}

c.logger.Infow("triggered build",

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.

do we need this as Info log? or should it be debug?

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.

it matches convention for one-shot per-build events elsewhere (in sq orchestrator build step). my preference is reserving Debug for high-frequency logs like buildsignal's poll loop?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agree with keeping in Info for now, it would be nice to be able to scroll through all the logs of builds that got triggered and frequency of these shouldn't be unreasonably high.

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.

eventually it's a problem for ratining logs over time when they become too much due to all the info logs

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.

ok then shall we do same change for submitqueue orchestrator build as well?

Comment on lines +156 to +158
if errors.Is(err, storage.ErrNotFound) {
return entity.Request{}, errs.NewRetryableError(fmt.Errorf("request %s not found yet: %w", id, 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.

why would request be not found?

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.

Shouldn't happen in the common case as per we discussed in rfc (#336 (comment)). I kept it as a defensive guard but it's also making sense to remove here...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I replied on the other one - I think the defensive guard is ok here... it could be missing due to replication lag if this task hits a different replica than the one that inserted the row.

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 we should not add that logic here, we likely going to pin to primary region and require a consistent data store for this

Comment thread stovepipe/controller/build/build.go
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.

3 participants