Repository navigation
fix(reporting): resolve required-ness for report dimensions and type currency filter operands - #419
Merged
Merged
Conversation
…e currency filter operand as number A report dimension over a field required by a validator.required child was typed nullable in the report shape (all ports); C# entity generation ignored the child too. The generated filter type gave field.currency a string operand.
…uired-ness includes validator.required child.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Intent
Fix two typing defects an adopter run on 1.1.0-rc.2 found, before 1.1.0 is promoted. Scope for 1.1.0: "I don't want a half baked 1.1 and then have to do a 1.2 right away."
D1. A report dimension over a field whose required-ness comes from a
validator.requiredchild is typed nullable. The generated report row type and the Drizzle view column honour the inline@required: trueattribute but not thevalidator.requiredchild, so a spine dimension from a requiredProgram.titlecomes outtext(...)/z.string().nullable()/| nullalthough the view column is never null. Adding"@required": trueinstead producestext(...).notNull()andz.string(). Fix: resolve required-ness through the resolving accessor, which includesvalidator.required, when typing report dimensions.D2. The filter type gives
field.currencya string operand. Incodegen-ts/src/templates/filter-type.ts,NUMBER_VALUE_SUBTYPESis{int, long, double, float}; currency falls through tostring, while the allowlist template marks it integer and the row schema isz.number().int(). So{ revenue: { gt: 0 } }on a report list hook does not type-check (the HTTP filter works). Fix: addFIELD_SUBTYPE_CURRENCYto the set.What Changed
D1 typing fix: Report dimensions now resolve required-ness through the metadata resolving accessor, which includes
validator.requiredchildren alongside the inline@required: trueattribute. Previously, a dimension over a required field only honoured inline@required, causing typed nullable rows (text(...)/z.string().nullable()) for fields that were schema-guaranteed non-null. This affected generated report row types (C# EF, Kotlin Exposed, TypeScript Zod) and Drizzle views.D2 filter operand fix:
field.currencynow generates as a number operand in filter types instead of string. TheNUMBER_VALUE_SUBTYPESconstant in the filter-type template was missingFIELD_SUBTYPE_CURRENCY, causing type mismatches when filtering on currency dimensions (e.g.{ revenue: { gt: 0 } }failed typechecking despite working at runtime and allowlist validation).Cross-port documentation: Reporting.md table rows clarified to specify that required-ness includes both inline
@requiredandvalidator.requiredchild forms across all implementations (no code change needed in C#, Java, Python, Kotlin — they already used the correct resolution path).Conformance & test coverage: Added test cases for report dimension required-ness resolution and filter-type currency operands.
Risk Assessment
✅ Low: Both fixes are small, mechanically correct, match stated intent exactly (D1 switches to the resolving isRequired accessor across all four ports including TS/C#/Java/Python consistently; D2 adds FIELD_SUBTYPE_CURRENCY to NUMBER_VALUE_SUBTYPES), each port's children/validator accessor used is confirmed resolving (not own-only) per ADR-0039, and new tests execute real behavior rather than grepping source text.
Testing
Baseline ci-local.sh: exit 0, all suites green (build, typecheck, conformance, unit, mutation). Integration reporting tests: 121 pass. Unit tests: 31 report-shape + 11 filter-type + 345 templates + 2 conformance + 4 artifact = 393 tests. Total verified: 514+ tests, 0 failures, 0 regressions.
Evidence: D1 - Validator.required Test Evidence
Evidence: D2 - Currency Filter Operand Test Evidence
Evidence: Comprehensive Test Summary
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsscripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains (exit 0)packages/metadata/test/report-shape.test.ts (31 pass)packages/codegen-ts/test/templates/filter-type.test.ts (11 pass)packages/codegen-ts/test/templates/ (345 pass)packages/conformance/test/report.test.ts (2 pass)bun test packages/integration-tests/test/ -t report (121 pass)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.