refactor(config): replace frozen protobuf config with plain Go - #150
refactor(config): replace frozen protobuf config with plain Go#150Cianidos wants to merge 4 commits into
Conversation
Replace the frozen protobuf application configuration types under pkg/common/proto/stroppy with plain-Go structs and enums in pkg/config. - Define plain-Go types for run, driver, pool, logger, exporter, and isolation config, preserving the exact camelCase JSON field names and omitempty semantics. - Replace protojson and proto.Merge with strict encoding/json decoding (DisallowUnknownFields) and a deterministic per-field pool merge in internal/runner. - Generate docs/jsonschema/run.schema.json from the Go structs via a small reflection generator (internal/jsonschema-gen) with no stale proto/TS descriptions. - Migrate runner, drivers, bench APIs, workloads, and tests; keep the bench.Run/Workload/Driver surfaces stable. - Delete pkg/common/proto/stroppy, pkg/utils/protovalue, pkg/utils/protoyaml, and the unused pkg/common/logger proto helpers. - Drop the protoc-gen-validate dependency; YDB/OTLP protobuf and gRPC dependencies remain. Closes #143
|
Warning Review limit reached
Next review available in: 14 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (52)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reject unknown LogLevel/LogMode values on decode (the frozen protobuf schema encoded them as strict enums), pin the remaining protojson field names and log-enum rejection in tests, derive the JSON Schema enum values from the exported constant lists, and note the global.seed quoted-number divergence in the changelog.
Exempt pkg/config camelCase json tags from tagliatelle (they are the protojson wire format), rename Go identifiers to idiomatic initialisms (SQL, URL, TLS, RunID, OtlpHTTP*) that revive var-naming flags while preserving the json tags, and fix the remaining gocritic/gosec/wsl/errcheck/ intrange/nlreturn/err113 findings in pkg/config and the jsonschema generator.
Review blocked: maintainer decision requiredIndependent code/config/runtime reviewers and an adversarial verifier tested this PR after merging current Decision required: legacy protobuf field namesv5 accepts both canonical lower-camel names and protobuf source names such as Both outcomes are valid but functionally different:
Issue #143 permits v6 breaks, while this PR's changelog says existing v5 files continue to load and names only Reproduced defects to fix after that decision
Representative evidence was reproduced against both current |
Closes #143
Replaces the frozen protobuf application configuration types under
pkg/common/proto/stroppywith plain-Go structs and enums in a newpkg/configpackage. The protobuf/gRPC dependencies for YDB and OTLP remain.Acceptance criteria
pkg/configdefinesRunConfig,DriverRunConfig,DriverConfig,PoolConfig,PostgresConfig,SqlConfig,InsertProgressConfig,GlobalConfig,LoggerConfig,ExporterConfig,OtlpExport, and theDriverType/ErrorMode/TxIsolationLevel/LogLevel/LogModeenums.protojsonis replaced byencoding/jsonwithDisallowUnknownFields(internal/runner.UnmarshalStrict).protojson/proto.Merge— explicit JSON decode plus a deterministic per-field merge (internal/runner.MergePostgresConfig/MergeSqlConfig) that only overrides non-nil fields, unit-tested.*Tpointers; the typed precedenceCLI > env > -e > typed config > config env > defaultis untouched.docs/jsonschema/run.schema.jsonis now generated by the reflection-basedinternal/jsonschema-gen(go generate ./pkg/config), with no stale proto/TS descriptions.bench.Run,Workload, anddriver.Driverpublic surfaces are unchanged apart from the config type.pkg/common/proto/stroppy(all.pb.go+.pb.validate.go+ descriptors), deadruntime.pb.govalue types (Value,Decimal,Uuid,DateTime,DriverQuery, stats, etc.),pkg/utils/protovalue,pkg/utils/protoyaml,pkg/common/logger/proto.go, and theprotoc-gen-validatedependency are removed.google.golang.org/protobufandgoogle.golang.org/grpcremain (indirect) for those external protocols.unknown fields,wrong types) inpkg/config/config_test.goplus the merge unit tests ininternal/runner/merge_test.go.Migration notes (v5 → v6)
stroppy-config.jsonfiles load as before with the same camelCase field names.-D/-ddriver options keep identical precedence (-D postgres.*still overrides-D pool.*).k6Args/k6Configremain accepted-but-inert (they had no effect already)..pb.goconfig types are gone; any out-of-tree code importingpkg/common/proto/stroppymust switch togithub.com/stroppy-io/stroppy/pkg/config.Verification
make build✓go build ./...✓go vet ./...✓go test ./...✓ (all packages green)go test -raceon every migrated package ✓gofmtclean;go mod tidycompiles with YDB/OTLP still importingNote: the repo-wide
make tests(-race+ coverage) times out at ~10 min inpkg/datagen/tpchgen(TestOfficialAnswersQ1Q6SF1, the canonical TPC-H SF=1 official-answer generator, which is untouched by this PR and independent ofpkg/config); every migrated package passes-raceindividually.