Repository navigation
feat: add exactlyOne validator, int-backed enum arrays and naming strategies - #554
Merged
Merged
Conversation
…onto main Brings the work from a downstream C# application session onto main, minus the reserved-vocabulary changes (they land separately, with the Java, Kotlin and Python registry catch-up): - C# EF model fixes: @default, assigned keys, TPH subtype fields and references, nested value objects, constraint names and principal keys, the int-backed enum write refusal, -sis plurals, a thread-safe node cache, a split OnModelCreating, the index vocabulary and @description, and @sequenceStart with a start-only change that never restarts. - C# generator hooks: one protected virtual per emitted line on the DbContext, entity and names generators. The golden files are main's pre-hook output plus only the lines the EF model fixes add, each named in the test. - The pascal column rule and application-registered naming strategies in every port (ADR-0058 Amendment 1), with a test-only reset. - Int-backed enum arrays load in every port. - An enum's @default on an untouched record; generated-name collisions scoped to what carries them; doc pages keyed by package; @Schema in the Python runtime; Kotlin index @using/@where; Java create defaults. - Port-scoped registry attrs ("ports"), with @dbSetName C#-only. Completed on main for every port: - @sequenceStart never moves the counter: meta migrate writes ALTER SEQUENCE ... START WITH n only (no setval). New persistence migration scenario sequence-start-change-keeps-counter. - @Schema reaches every mapping: TS Kysely and Drizzle, Java OMDB, Kotlin Exposed tables. The canonical model gains LedgerEntry and an archive-schema ArchivedLedgerEntry of the same table name; new query scenario schema-qualified-same-name (Postgres). - Java and Kotlin create defaults: a string default is a literal unless it is a database expression (shared isSqlExpressionDefault), escaped correctly; the Java switch uses the subtype constants. - New api-contract sub-corpus enum-default/, generated lane in all five ports. - Java/Kotlin api docs default to the package layout in the eject test. - Kotlin compile gates leave out the IntEnumArray controller and repository until enum arrays get an Exposed array column (KNOWN_GAPS.md). - Docs: CHANGELOG upgrade notes, CONFORMANCE counts and per-port status, api-contract "Defaults on create", regenerated metamodel docs. Conflicts resolved toward main's reworks: validator.exactlyOne, the native duration wire default with wire.durations "iso", the provider field in meta types JSON, and MappedBaseClause for the entity base class (the duplicate helper is dropped, the DbContext half is kept). The C# generator that wrote expression indexes as SQL is left out: schema DDL stays with meta migrate (ADR-0015).
…lePath A CI build (CI=true turns on ContinuousIntegrationBuild) maps source paths to /_/, so the [CallerFilePath]-based golden directory did not exist on the runner and the three golden tests failed with DirectoryNotFoundException. Use CorpusPaths.RepoRoot() like the other tests in this project.
…m new C# doc comments.
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.
What Changed
validator.exactlyOne,@constraintName,@condition,field.duration,@sequenceStart(the counter is never moved on an existing sequence),@dbSetName(C#-only, via a new port-scopedportsfield in the registry), and thepascalcolumn rule.validator.atLeastOneno longer takes@max; upgrading adopters must switch tovalidator.exactlyOneand remove the@max.@intValueMapenum be an array (ERR_ENUM_INT_VALUE_MAP_ARRAYremoved). TypeScript and Python map elements on write and read; C# emits working array converters; Java and Kotlin refuse or defer the case, recorded inKNOWN_GAPS.md. C# durations need"wire": { "durations": "iso" }to keep ISO-8601 output."naming": { "columns": "<name>" }) that each port's application can register, plus shared conformance fixtures and persistence/api-contract scenarios for these changes.Known limits
IntEnumArrayController.ktand its repository files. This gap predates this PR; seeKNOWN_GAPS.md.Gate
Validated in 2 no-mistakes runs. Run 1 passed. After it, the hosted csharp check failed: the golden tests found their files through
[CallerFilePath], and a CI build (CI=trueturns onContinuousIntegrationBuild) maps source paths to/_/. Run 2 validated that fix (the golden files are now found from the repo root). Run 2's test step ended with an approved exception. Its live scenarios drove TypeScript only. Every port's full suite, including the integration suites, ran to completion locally before the pipeline. Hosted CI re-runs every port on this push.Validation
Risk Assessment
Testing
Baseline ts-fast and ts-unit passed earlier. Live Postgres scenarios pass in TypeScript: enum @default on create, int-backed enum array round-trip, @Schema on reads and writes (with the same-name table scenario), and @sequenceStart never moving the counter. A runtime mutation dropping @Schema on insert was caught and reverted. Not finished: the full integration-tests regression was stopped before it reported, and C#, Java, Kotlin and Python ports were not driven live. Verdict is inconclusive.
Evidence: PG scenario run 1 (enum default, int enum array, api-contract enum default, query)
Evidence: PG scenario run 2 (sequence-start migration, schema-qualified query)
Evidence: Mutation: schema dropped on insert fails schema-qualified-same-name
Evidence: Full integration-tests run, killed before completion (exit=143)
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KNOWN_GAPS.md:231- Admitting@intValueMap+isArrayin every port leaves Kotlin with a build-time failure in place of the old load-time error.KotlinExposedTableGenerator.enumColumnSpecemits a scalar column for any enum array, string-backed or int-backed. The generated controller then fails to compile, and the fitness corpus'IntEnumArrayController.ktis left out of the compile gates. Java OMDB refuses an int-backed array at runtime on write and read.KNOWN_GAPS.mdanddocs/ports/kotlin.mddescribe this honestly. The CHANGELOG line "Kotlin's Exposed generator emits no enum array column" is looser: it emits a scalar column and the build fails. Fixing it means adding an Exposed array column, which is a feature beyond this replay. Recorded as a known, documented gap, not a blocker.🔧 Fix applied.
1 info still open:
server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KNOWN_GAPS.md:231- Admitting@intValueMap+isArrayin every port leaves Kotlin with a build-time failure in place of the old load-time error.KotlinExposedTableGenerator.enumColumnSpecemits a scalar column for any enum array, string-backed or int-backed. The generated controller then fails to compile, and the fitness corpus'IntEnumArrayController.ktis left out of the compile gates. Java OMDB refuses an int-backed array at runtime on write and read.KNOWN_GAPS.mdanddocs/ports/kotlin.mddescribe this honestly. The CHANGELOG line "Kotlin's Exposed generator emits no enum array column" is looser: it emits a scalar column and the build fails. Fixing it means adding an Exposed array column, which is a feature beyond this replay. Recorded as a known, documented gap, not a blocker.server/typescript/packages/integration-tests- Full integration-tests regression (bun test in server/typescript/packages/integration-tests) never completed. I stopped it, so the log has no pass/fail summary and ends with exit=143. A later task notification reported the wrapper as exit code 0, but that is the wrapper's status after the kill, not a test result. Rerun it to a finished summary before deciding.scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsbun test test/enum-default-pg.test.ts test/enum-intvaluemap-array.test.ts test/api-contract-enum-default.test.ts test/query.test.ts (server/typescript/packages/integration-tests, Postgres via Docker testcontainers): 70 pass, 0 failbun test test/migration.test.ts --test-name-pattern 'sequence|bootstrap': 2 passbun test test/query.test.ts --test-name-pattern 'schema-qualified': 1 passMutation: runtime-ts src/drivers/kysely-driver.ts insert path forced to undefined schema; query.test.ts schema-qualified fails (expected {memo: archived-new}, actual null). Reverted with git checkout; worktree clean.Full regression: bun test in server/typescript/packages/integration-tests, started in background, killed before completion (log ends exit=143, no summary).CHANGELOG.md upgrade note read: atLeastOne to exactlyOne with @max removed; wire.durations iso note present. Fixture count 451 in docs/CONFORMANCE.md, CLAUDE.md, AGENTS.md matches 451 directories.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.