fix: update autostart context to include querying users #10929
Merged
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.
Error
field toErrors
and records all errors that occur over an evaluation iteration.This bug surfaces some deviations we've made between our testing harness and our production path:
coderdtest.NewOptions
does more than just instantiate sensible defaults forcoderd.API
fields. It's also starting background processes likeautobuild
and theunhanger.Detector
prior to instantiating acoderd.API
which is surprising.cli/server.go
functions...it first instantiates acoderd.API
and then starts some background based on the optionscoderd.New
is not only instantiating acoderd.API
it's also overwriting options on fields likeDatabase
to wrap it indbauthz
. This means we're "getting lucky" when we startautobuild
in production, when instantiating that background process you need to be aware thatcoderd.API
is responsible for taking whatever type you passed for aDatabase
and wrapping it in adbauthz.Store
which seems unnecessarily brittle.The result of this is that we would never catch auth-related errors in
autobuild
in our tests.There's a non-trivial amount of code to refactor to make this less fragile so this only fixes the autobuild issues.