Skip to content

feat: unify ErrorLimitOption at top-level Options for confgen and protogen - #445

Merged
wenchy merged 4 commits into
masterfrom
feat/error-limits-config
Aug 13, 2026
Merged

feat: unify ErrorLimitOption at top-level Options for confgen and protogen#445
wenchy merged 4 commits into
masterfrom
feat/error-limits-config

Conversation

@Kybxd

@Kybxd Kybxd commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Move ErrorLimitOption from per-module ProtoOption / ConfOption to the top-level Options so that protogen and confgen share a single set of error limits. Configurable via config.yaml under the top-level errorLimits key.

Changes

  • options/options.go: Move ErrorLimits to top-level Options; unify defaults to 20/10/5 (previous confgen values); add ErrorLimits() functional option setter.
  • internal/confgen/confgen.go, internal/protogen/protogen.go: Read opts.ErrorLimits instead of opts.Proto.ErrorLimits / opts.Conf.ErrorLimits.
  • internal/protogen/collector_integration_test.go: Inject explicit limits (10/5/3) as defaults; merge newCollectorTestGenerator and newCollectorTestGeneratorYAML into a single helper with a format parameter.
  • internal/x/xerrors/collector_test.go: Consolidate collector hierarchy + Stringify rendering tests from confgen/collector_test.go and protogen/collector_test.go; delete both domain-specific files.
  • internal/confgen/README.md: Update to 3-level hierarchy (drop deprecated Message level).
  • cmd/tableauc/testdata/config.yaml: Move errorLimits from proto: / conf: to top level.

Test plan

  • go build ./... passes.
  • go test ./... passes.
  • Collector hierarchy tests consolidated under internal/x/xerrors/collector_test.go.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 13, 2026, 12:12 PM

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.31373% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.58%. Comparing base (f42dc67) to head (027b510).

Files with missing lines Patch % Lines
internal/confgen/confgen.go 72.22% 4 Missing and 1 partial ⚠️
options/options.go 62.50% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kybxd
Kybxd requested a review from wenchy August 4, 2026 06:28
Comment thread options/options.go Outdated
Comment thread cmd/tableauc/testdata/config.yaml Outdated
@Kybxd Kybxd changed the title feat: make confgen/protogen error limits configurable feat: unify ErrorLimitOption at top-level Options for confgen and protogen Aug 4, 2026
Comment thread internal/confgen/collector_test.go
Comment thread options/options.go Outdated
Log *log.Options // Log options.

// Error limits for error collection at each level, shared by protogen and confgen.
ErrorLimits *ErrorLimitOption `yaml:"errorLimits"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ErrorLimits -> ErrorLimit

Comment thread internal/protogen/protogen.go Outdated
LocationName string // TZ location name.
InputOpt *options.ProtoInputOption // Input settings.
OutputOpt *options.ProtoOutputOption // Output settings.
ErrorLimits *options.ErrorLimitOption // error collection limits.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Keep naming consistent: ErrorLimits -> ErrorLimitOpt

Comment thread internal/x/xerrors/collector_test.go
@Kybxd
Kybxd force-pushed the feat/error-limits-config branch from 811798a to f153cb8 Compare August 5, 2026 02:49

@Kybxd Kybxd left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

This comment was marked as duplicate.

@Kybxd Kybxd left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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, errorLimits is now a top-level config key shared by both.

Kybxd added 4 commits August 13, 2026 19:35
- 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
@Kybxd
Kybxd force-pushed the feat/error-limits-config branch from 5641eb2 to 027b510 Compare August 13, 2026 12:12
@wenchy
wenchy merged commit 38de0ee into master Aug 13, 2026
9 checks passed
@wenchy
wenchy deleted the feat/error-limits-config branch August 13, 2026 12:33
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.

2 participants