feat: unify ErrorLimitOption at top-level Options for confgen and protogen - #445
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #445 +/- ##
==========================================
- Coverage 75.64% 75.58% -0.06%
==========================================
Files 88 88
Lines 9533 9553 +20
==========================================
+ Hits 7211 7221 +10
- Misses 1747 1755 +8
- Partials 575 577 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| Log *log.Options // Log options. | ||
|
|
||
| // Error limits for error collection at each level, shared by protogen and confgen. | ||
| ErrorLimits *ErrorLimitOption `yaml:"errorLimits"` |
| LocationName string // TZ location name. | ||
| InputOpt *options.ProtoInputOption // Input settings. | ||
| OutputOpt *options.ProtoOutputOption // Output settings. | ||
| ErrorLimits *options.ErrorLimitOption // error collection limits. |
There was a problem hiding this comment.
Keep naming consistent: ErrorLimits -> ErrorLimitOpt
811798a to
f153cb8
Compare
Kybxd
left a comment
There was a problem hiding this comment.
These collector tests are testing the xerrors.Collector infrastructure behavior (hierarchy, limits, Stringify rendering), not confgen/protogen-specific logic. After moving ErrorLimit to the shared Options, both packages use the identical collector setup, so consolidating them into internal/x/xerrors/collector_test.go avoids duplication and keeps the tests closer to the implementation they cover.
Kybxd
left a comment
There was a problem hiding this comment.
Replies to outdated threads (diff hunk changed, inline reply unavailable):
- ErrorLimits → ErrorLimit: Done, renamed across all files.
- "Keep naming consistent": Done, unified to
ErrorLimit. - "No need to distinguish proto/conf": Done,
errorLimitsis now a top-level config key shared by both.
- Add shared ErrorLimitOption (MaxErrors, MaxErrorsPerBook, MaxErrorsPerSheet) to options.Options, configurable via config.yaml - confgen defaults: 20/10/5, protogen defaults: 10/5/3 - Remove MaxErrorsPerMessage level since a sheet maps directly to messages - Update tests and add override examples to testdata/config.yaml
…togen - Move ErrorLimits from ProtoOption/ConfOption to top-level Options so confgen and protogen share the same instance. - Unify defaults to 20/10/5 (previous confgen values); remove separate DefaultProto* and DefaultConf* constants. - Add options.ErrorLimits() functional option setter. - Consolidate collector_test.go from confgen and protogen into xerrors/collector_test.go with structured error Stringify tests. - Update README to reflect 3-level hierarchy (drop deprecated Message level). - Simplify integration test helpers (single function with format param).
- Rename ErrorLimits struct field to ErrorLimit (wenchy review feedback). - Rename options.ErrorLimits() functional option to options.ErrorLimit(). - Keep yaml tag as errorLimits.
- rename Generator.ErrorLimit to ErrorLimitOpt (protogen/confgen) for naming consistency with InputOpt/OutputOpt - fix yaml tag errorLimits -> errorLimit to match field name and config.yaml - gofmt proto/tableaupb/wellknown_util_test.go
5641eb2 to
027b510
Compare
Summary
Move
ErrorLimitOptionfrom per-moduleProtoOption/ConfOptionto the top-levelOptionsso thatprotogenandconfgenshare a single set of error limits. Configurable viaconfig.yamlunder the top-levelerrorLimitskey.Changes
options/options.go: MoveErrorLimitsto top-levelOptions; unify defaults to 20/10/5 (previous confgen values); addErrorLimits()functional option setter.internal/confgen/confgen.go,internal/protogen/protogen.go: Readopts.ErrorLimitsinstead ofopts.Proto.ErrorLimits/opts.Conf.ErrorLimits.internal/protogen/collector_integration_test.go: Inject explicit limits (10/5/3) as defaults; mergenewCollectorTestGeneratorandnewCollectorTestGeneratorYAMLinto a single helper with aformatparameter.internal/x/xerrors/collector_test.go: Consolidate collector hierarchy + Stringify rendering tests fromconfgen/collector_test.goandprotogen/collector_test.go; delete both domain-specific files.internal/confgen/README.md: Update to 3-level hierarchy (drop deprecatedMessagelevel).cmd/tableauc/testdata/config.yaml: MoveerrorLimitsfromproto:/conf:to top level.Test plan
go build ./...passes.go test ./...passes.internal/x/xerrors/collector_test.go.