Skip to content

Ensure all configs are used or checked in the constructor#172

Open
yushan8 wants to merge 7 commits into
mainfrom
yushan/check-constructor
Open

Ensure all configs are used or checked in the constructor#172
yushan8 wants to merge 7 commits into
mainfrom
yushan/check-constructor

Conversation

@yushan8

@yushan8 yushan8 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

All config validation is now done in constructors. Methods no longer check for config values. Return a validation error if the config was not set.

@yushan8 yushan8 requested review from a team as code owners July 10, 2026 01:55
Comment thread config/config.go
}
if config.Repository[i].QueryTimeoutSeconds <= 0 {
return nil, fmt.Errorf("repository[%d].query_timeout_seconds must be > 0", i)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why are we removing the default values and erroring out. Should we not have default values if user do not provide for timeout or chunks?

I am not sure what the config document will look like but initial gut reaction is that we are asking users of the library to be quite knowledgable in the code base vs working out of the box

@liujsj liujsj Jul 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also if we do decide to change that these must be provided, then please update service_config comments as it mentions

// streaming chunk sizes; zero values fall back to package defaults

Comment thread core/bazel/query_test.go
mockCmd.EXPECT().Wait().Return(nil),
)
client, err := NewBazelClient(context.Background(), Params{
QueryTimeout: 5 * time.Minute,

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.

it is better to rely on test timeout rather than hardcode

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