diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index d25a080c2c..06fda1ea0d 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -20,13 +20,15 @@ name: conformance # ts-fast — workspace build + typecheck, TS conformance, completeness (mutation) gate # (the FULL pass here: MO_CI_MUTATION_SCOPE=full on that job) # csharp / java-fast (java + kotlin) / python — each port's conformance corpora -# java-reactor — full-reactor `mvn clean install`, tests on (`--only java-slow`) -# The Java lanes point the script's Maven repository at ~/.m2/repository so setup-java's -# maven cache applies; the script's own default (~/.m2-ci) protects a developer's ~/.m2, -# which an ephemeral hosted runner does not have. +# java-reactor — full-reactor `mvn clean verify`, tests on (`--only java-slow`) +# The Java lanes make ~/.m2/repository the script's per-run Maven repository +# (METAOBJECTS_CI_M2_RUN_REPO) so setup-java's maven cache applies. That is safe only because +# a hosted runner is ephemeral: the script's own default is a private repository under +# $DEV_SCRATCH in front of a read-only shared cache, so a developer's or a self-hosted +# runner's shared repository is never written (scripts/lib/maven-private-repo.sh). # # WHY A SCHEDULE, given local-ci already runs nightly: local-ci's `java-slow` lane runs -# the same full reactor (`gate_java_reactor`, `mvn clean install`) — so "it does not run +# the same full reactor (`gate_java_reactor`, `mvn clean verify`) — so "it does not run # the reactor" is NOT the gap. The gap is environmental, and it is measured. Two Java # test defects (a test asserting on an NPE message HotSpot's fast-throw is entitled to # stop producing once the path is hot; two test classes sharing files with nothing @@ -134,7 +136,7 @@ jobs: # changed ones ts-fast mutates elsewhere (see gate_completeness_diff). MO_CI_MUTATION_SCOPE: full run: | - METAOBJECTS_CI_M2_REPO="$HOME/.m2/repository" \ + METAOBJECTS_CI_M2_RUN_REPO="$HOME/.m2/repository" \ scripts/ci-local.sh --only "$LANE" --no-integration --strict-toolchains java-reactor: @@ -157,5 +159,5 @@ jobs: env: MO_CI_JACOCO: '1' run: | - METAOBJECTS_CI_M2_REPO="$HOME/.m2/repository" \ + METAOBJECTS_CI_M2_RUN_REPO="$HOME/.m2/repository" \ scripts/ci-local.sh --only java-slow --no-integration --strict-toolchains diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 48d92dfe15..937869a975 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -149,5 +149,5 @@ jobs: MIGRATE_TS_PG_EXPECT: '1' RUNTIME_TS_PG_EXPECT: '1' run: | - METAOBJECTS_CI_M2_REPO="$HOME/.m2/repository" \ + METAOBJECTS_CI_M2_RUN_REPO="$HOME/.m2/repository" \ scripts/ci-local.sh --only "$LANE" --integration-only --strict-toolchains diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index b6422a3246..7e30d2ce37 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -142,7 +142,7 @@ jobs: env: LANE: ${{ matrix.lane }} run: | - METAOBJECTS_CI_M2_REPO="$HOME/.m2/repository" \ + METAOBJECTS_CI_M2_RUN_REPO="$HOME/.m2/repository" \ scripts/ci-local.sh --only "$LANE" --no-integration --strict-toolchains python: diff --git a/CHANGELOG.md b/CHANGELOG.md index 534327d4c4..664bd0207b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,6 +103,28 @@ here.** TypeScript passes both. The other ports take them on in their 1.3.0 REST-standard work. The decision is [ADR-0068](spec/decisions/ADR-0068-list-query-cross-port-contract.md). A scenario can now send a body that is not JSON with `rawBody`. +- **Java: the Spring controller generator writes through the code writer (ADR-0063).** + `SpringControllerGenerator` writes through `SpringJavaWriter`, a `JavaWriter` that adds the two + layouts Spring source uses and a block does not: a continuation line (two indents deeper) and an + indented `case` body. Every member of the generated controller comes from its own protected + `write*` method, so an owned copy changes one handler by overriding one method; the `append*` + helpers that took a `StringBuilder` are gone. The shared validator members and the decimal and + duration import lists in `SpringGeneratorSupport` are written through the writer too + (`writeCrossFieldValidationMembers`; `decimalAnnotationImports` and `durationAnnotationImports` + now return qualified names). A generated controller changes in two layout details only, checked + on 1,512 controllers from every fixture model: its imports are sorted, and the blank line after + `public class ... {` is gone. + + The DTO, value-object and shared-enum generators follow (`SpringDtoGenerator`, + `SpringValueObjectGenerator`, `Fr019SharedEnum`). A record, patch class, stamping helper and + enum declaration each come from a protected method, and the string-returning helpers they used + are replaced by writer ones: `SpringTypeMapper.enumDeclaration` by `writeEnumDeclaration`, + `SpringRecordBuilder.members` by `writeMembers` (with `applies` to ask first), and an owned DTO + generator customizes every file it writes by overriding `newWriter`. Their output changes in + layout only, checked on every fixture model in two wire and API configurations: sorted imports + with no blank between groups, no blank line after `public final class ...Patch {` or a doubled + one in a patch with no settable fields, no trailing indent on the blank lines of a nested enum, + and no leading blank line in a file with no package. - **runtime-ts: one list-query parse for every mount.** `parseListQuery` (exported from `@metaobjectsdev/runtime-ts`; it does not depend on Drizzle) reads a list request into a port-neutral `ListQuery`, and each mount compiles that for its own query library. The Drizzle @@ -112,6 +134,28 @@ here.** and refuses what the Drizzle mount refuses, with the same bodies; - `pagination`: the `api.pagination` page size. + The names, repository and report-export generators follow (`SpringNamesGenerator`, + `SpringRepositoryGenerator`, `SpringReportExportGenerator`), each finder, constant block and + writer section from its own protected method; the one layout change in their output is that + the blank line after the class or interface opener is gone. So does the output-parser generator + (`SpringOutputParserGenerator`), whose `StringBuilder` seams (`emitMapperMethods`, `emitMapper`, + `appendMapperHelpers`) now take the writer, and whose parsers gain a blank line after the + leading `// GENERATED` comment besides sorted imports. The filter-allowlist, response-format and + render-helper generators follow: the allowlist output is unchanged, and the other two gain the + same blank after the leading comment, sorted imports and no blank after the class opener. + `SpringNaming.packageHeader` is removed; the writer's `packageName` replaces it. The LLM-trace + helper and the `requirement-tests` generator follow with the same layout changes, and the + witness-key collision error now lists its colliding pairs on one line, separated by `; `. + In `codegen-base`, the entity extractor (`ExtractorCodeGenerator`, whose `write*` seams now take + a `JavaWriter`, and whose `writeHeader` no longer takes the extractor name or writes the class + opener) and the generated `ObjectClassBindingProvider` move to the writer too, with sorted imports + and no blank after the class opener; the older object code writers take their indentation unit + from `WriterOptions` (`JAVA`, and the new two-space `DIRECT`) instead of a typed string. Every + Java generator now writes through the code writer, so the layout ratchet's `unconverted` list + is empty. `CodeWriter`, `JavaWriter`, `WriterOptions` and `SpringJavaWriter` join the Java + engine surface (`eject.engineSurface.java.engine`), so an ejected generator imports them from + the package rather than copying them. + With no sort, the `ObjectManager` mount now orders by the primary key. The `ObjectManager` `Filter` gains `$or` and a case-insensitive `$ilike`, and the class gains `keyFields()` and `fieldNames()`. diff --git a/docs/RELEASING-java.md b/docs/RELEASING-java.md index 99e8281767..a9c94e0886 100644 --- a/docs/RELEASING-java.md +++ b/docs/RELEASING-java.md @@ -172,11 +172,12 @@ git push origin main ### 3. Local smoke build ```bash -cd server/java && mvn clean install +cd server/java && mvn clean verify ``` -All 14 publishable modules should reach SUCCESS with the full test suite green. The build also installs -locally into `~/.m2/repository/com/metaobjects/*/7.X.Y/`. +All 14 publishable modules should reach SUCCESS with the full test suite green. Use `verify`, not +`install`: a reactor build needs no installed artifacts, and installing writes this version into the +shared `~/.m2`, where every other checkout building the same number then resolves it. ### 4. Tag the release diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 5793e78d22..321e05c8e3 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -929,7 +929,7 @@ versioned on its own major line — npm major + 7, so `7.x` while npm was `0.x` that happens to share the number.) Then assert the excluded modules are in sync: `scripts/check-pom-versions.sh` (also enforced on every push by `.githooks/pre-push` and by `scripts/ci-local.sh`). -2. **Validate locally:** `cd server/java && mvn -q clean install -DskipTests` (or with tests / `scripts/integration-test.sh java` if runtime changed). +2. **Validate locally:** `cd server/java && mvn -q clean verify -DskipTests` (or with tests / `scripts/integration-test.sh java` if runtime changed). Use `verify`, not `install`: installing writes this unreleased version into the shared `~/.m2` ([RELEASING-java.md](RELEASING-java.md#3-local-smoke-build)). 3. **Deploy — ONE of two routes, never both** (a second deploy of a published version fails with `Component … already exists`): push a `java-v` tag, and `publish-java.yml` runs the deploy below in CI with the signing secrets (how `8.0.4` diff --git a/docs/features/own-your-codegen.md b/docs/features/own-your-codegen.md index 94bd9be9a3..9777cb5bfd 100644 --- a/docs/features/own-your-codegen.md +++ b/docs/features/own-your-codegen.md @@ -1264,8 +1264,9 @@ flavor, so the writers come with it: | `JavaCodeWriter` | The Java type of each field; accessor, parameter, class and package names; the body of the interface flavor. | | `PojoAwareCodeWriter`, `ValueObjectCodeWriter` | The fields, the constructor and the accessor bodies of the two concrete flavors. | -All seven land in one package and use one another, never the packaged classes: eject -rewrites the package line of each and, where one imports another, that import. To change a +All seven land in one package and use one another, never the packaged copies: eject +rewrites the package line of each and, where one imports another, that import. They do call +the code writer (`JavaWriter`, `WriterOptions`), which is engine and stays in the package. To change a field, a constructor or an accessor, edit the writer. You subclass nothing. `-Dlist` gives `entity` one verdict over all seven files. @@ -1327,7 +1328,9 @@ the packaged sibling classes they still call, so they compile from any package. **What stays in the package is the engine**, public and unchanged: the generator base and runner types, the naming and type-mapping tables (`SpringNaming`, `SpringTypeMapper`, `KotlinNaming`, `KotlinTypeMapper`), the questions a generator asks of the model -(`FindInbound`, `TphPlan`, the M:N support, `RestSurfaceGate`), and the Kotlin +(`FindInbound`, `TphPlan`, the M:N support, `RestSurfaceGate`), the code writer the Java +generators lay their output out with (`CodeWriter`, `JavaWriter`, `WriterOptions`, and +`SpringJavaWriter` for Spring source), and the Kotlin `Fr019SharedEnum`. Anything that returns emitted text is handed over; a table or a model question is not. The Kotlin `Fr019SharedEnum` writes no output. It answers where a shared or `@provided` enum lives, and the type mapper and the generator utilities take its diff --git a/docs/ports/java.md b/docs/ports/java.md index 3e9858e8f2..75b753685f 100644 --- a/docs/ports/java.md +++ b/docs/ports/java.md @@ -884,11 +884,11 @@ engine, `com.metaobjects.config.SharedModel`, stays in the package, so the owned **Own a generator.** `mvn metaobjects:eject -Dnames=` copies a reference generator into a `codegen/` Maven module under your own package, and prints the module, dependency and `` to wire. See [Own your codegen → Java and Kotlin](../features/own-your-codegen.md#java-and-kotlin-mvn-metaobjectseject). Every generator in the table above can be ejected except `template` and the deprecated `mustache` (see [the primitive](../features/own-your-codegen.md#java-and-kotlin-mvn-metaobjectseject)). -**`entity` and `extractor` eject from `metaobjects-codegen-base`, each with the rest of its emit.** `mvn metaobjects:eject -Dnames=entity,extractor -Dport=java` (pass `-Dport`: both names are ejectable on both JVM ports). `entity` copies seven files into one package: `JavaObjectCodeGenerator`, the bases it extends (`JavaCodeGenerator`, `BaseObjectCodeGenerator`) and the four writers that emit each class body (`BaseObjectCodeWriter`, `JavaCodeWriter`, `PojoAwareCodeWriter`, `ValueObjectCodeWriter`). The copies use one another, never the packaged classes, so you change a field, a constructor or an accessor by editing the writer. `extractor` copies `ExtractorCodeGenerator` with `JavaCodeWriter` and `BaseObjectCodeWriter`, where it reads class names from; in the same package as `entity` the two share those writers. The file-by-file table is in [Own your codegen → Java `entity` and `extractor`](../features/own-your-codegen.md#java-entity-and-extractor). +**`entity` and `extractor` eject from `metaobjects-codegen-base`, each with the rest of its emit.** `mvn metaobjects:eject -Dnames=entity,extractor -Dport=java` (pass `-Dport`: both names are ejectable on both JVM ports). `entity` copies seven files into one package: `JavaObjectCodeGenerator`, the bases it extends (`JavaCodeGenerator`, `BaseObjectCodeGenerator`) and the four writers that emit each class body (`BaseObjectCodeWriter`, `JavaCodeWriter`, `PojoAwareCodeWriter`, `ValueObjectCodeWriter`). The copies use one another, never the packaged copies, so you change a field, a constructor or an accessor by editing the writer. (The code writer they call, `JavaWriter` and `WriterOptions`, is engine and comes from the package.) `extractor` copies `ExtractorCodeGenerator` with `JavaCodeWriter` and `BaseObjectCodeWriter`, where it reads class names from; in the same package as `entity` the two share those writers. The file-by-file table is in [Own your codegen → Java `entity` and `extractor`](../features/own-your-codegen.md#java-entity-and-extractor). **Class headers changed once, and `mvn metaobjects:verify` no longer depends on the clock.** The header comment of every class `entity` writes used to carry an `ObjectCodeWriter:` line (the writer's class name) and a `Generated On:` line (the wall-clock second of the run). Both are gone, so the first regeneration after upgrading changes every generated class file in its header comment and nowhere else. Because of the timestamp, `mvn metaobjects:verify` reported `[content-differs]` for every one of those files unless it ran in the same second as the generate it was checking. Output now holds nothing that varies between runs: regenerating an unchanged model writes the same bytes, and verify passes whenever it runs. -**Ejecting hands over the shared emit rules.** The `routes`, `dto`, `repository` and `value-object` generators apply rules they share (which fields a DTO and a patch carry, validation annotations, M:N finder names) through `SpringGeneratorSupport`. Ejecting any of them writes one copy of that class beside the owned generators, in their package, and points each owned generator's import at it, so an owned generator never calls the packaged rules and you can change them. The engine classes the copies still import (`SpringNaming`, `SpringTypeMapper`, `SpringM2mSupport`, `AutoSetSupport`, `TphPlan`) never call `SpringGeneratorSupport`; `SpringTypeMapper.mapValueObjectRefOf` is a type-mapping fact and stays engine. The copy is left alone without `-Dforce`, `-Dlist` marks it `identical` or `DIFFERS`, and `mvn metaobjects:verify` does not report it as stale output. +**Ejecting hands over the shared emit rules.** The `routes`, `dto`, `repository` and `value-object` generators apply rules they share (which fields a DTO and a patch carry, validation annotations, M:N finder names) through `SpringGeneratorSupport`. Ejecting any of them writes one copy of that class beside the owned generators, in their package, and points each owned generator's import at it, so an owned generator never calls the packaged rules and you can change them. The engine classes the copies still import (`SpringNaming`, `SpringTypeMapper`, `SpringM2mSupport`, `AutoSetSupport`, `TphPlan`, and the code writer `SpringJavaWriter` with `JavaWriter`) never call `SpringGeneratorSupport`; `SpringTypeMapper.mapValueObjectRefOf` is a type-mapping fact and stays engine. The copy is left alone without `-Dforce`, `-Dlist` marks it `identical` or `DIFFERS`, and `mvn metaobjects:verify` does not report it as stale output. **Ejecting hands over the helper runtime too.** The `routes`, `dto` and `repository` output imports helper classes from `com.metaobjects.generator.spring.runtime` (`FilterParser`, `FilterParseResult`, `FilterPredicate`, `PatchValidationException`, `ConstraintErrors`, `RecordComponentNames`). These are helpers, not core. Ejecting one of those generators copies the classes its output imports into `src/main/java//` (default `.runtime`) of the module that compiles the generated code, and the owned generator's output imports that copy. The copies are JDK-only. The owned web tier then builds with no MetaObjects artifact on the application classpath, and you can fix a helper bug in your copy without waiting for a release. A packaged generator that must use the same copy takes `…`. What stays core: the loader and registry, render and extract, OMDB and `metaobjects-om`. `mvn metaobjects:verify` treats the copies as owned code, not stale output. The table, the aggregator rule and a diff recipe for pulling an upstream fix are in [Own your codegen → What eject hands over](../features/own-your-codegen.md#what-eject-hands-over-and-what-stays-core). diff --git a/examples/showcase/.metaobjects/.gen-state/.hashes/acme.json b/examples/showcase/.metaobjects/.gen-state/.hashes/acme.json index 774179acca..2d0a306469 100644 --- a/examples/showcase/.metaobjects/.gen-state/.hashes/acme.json +++ b/examples/showcase/.metaobjects/.gen-state/.hashes/acme.json @@ -6,7 +6,7 @@ "generated/csharp/SubscriberRoutes.g.cs": "2a217ff5a37674ce5038802631b1d8fd90b22b9849e0288f7daf3bba7f9e862f", "generated/python/Subscriber.py": "9dd4c0acea47f99d1daf79930f9de2e400f30780ebce6c63f023be528a72b762", "generated/python/SubscriberBlurbPayload.py": "a5ef8a08e63efbe0f73e39a21a368cff5150c68cc8beeea6e8aab0c755f8bbdd", - "generated/python/subscriber_filter_allowlist.py": "b0414cc95ff3982c80a0e1a06839f090c0b423e41f5a94275df93426cea09df5", + "generated/python/subscriber_filter_allowlist.py": "1762fb8b41516c9ca4d4384563046b73c25ed681e4e5da3db19d7d290f9e8b25", "generated/python/subscriber_names.py": "269637a02bf9b46f55658b58cb42f83196c03a877e1e2101337847fd406c1561", "generated/python/subscriber_router.py": "16502ff815bf9ae29c7dba4700d0465d06058a9fd7ea8db5f98334d52d284851", "generated/ts/Subscriber.queries.ts": { diff --git a/examples/showcase/generated/java/acme/SubscriberPatch.java b/examples/showcase/generated/java/acme/SubscriberPatch.java index aeeb00156f..6b416fda76 100644 --- a/examples/showcase/generated/java/acme/SubscriberPatch.java +++ b/examples/showcase/generated/java/acme/SubscriberPatch.java @@ -11,7 +11,6 @@ /** GENERATED — presence-tracked partial-update (PATCH) shape for Subscriber. Do not hand-edit; regenerated from metadata. */ public final class SubscriberPatch { - private final Map assigned; private SubscriberPatch(Map assigned) { this.assigned = assigned; } diff --git a/examples/showcase/generated/python/subscriber_filter_allowlist.py b/examples/showcase/generated/python/subscriber_filter_allowlist.py index 81f4389fec..136a15cbf7 100644 --- a/examples/showcase/generated/python/subscriber_filter_allowlist.py +++ b/examples/showcase/generated/python/subscriber_filter_allowlist.py @@ -4,7 +4,8 @@ """GENERATED — per-entity FR-009 filter allowlist for Subscriber. SUBSCRIBER_FILTER_FIELDS lists the filterable field names; SUBSCRIBER_FILTER_OPS_BY_FIELD -constrains the operator vocabulary for each field by its subtype.""" +constrains the operator vocabulary for each field by its subtype. +""" from __future__ import annotations diff --git a/examples/showcase/jvm/.metaobjects/.gitignore b/examples/showcase/jvm/.metaobjects/.gitignore new file mode 100644 index 0000000000..8c12b0baef --- /dev/null +++ b/examples/showcase/jvm/.metaobjects/.gitignore @@ -0,0 +1,10 @@ +# Gen-state bodies are a second full copy of all generated output — not worth +# committing. The MANIFEST is: the `.hashes/` directory (one file per model +# package) is the only thing that lets `meta gen` tell "this file is exactly +# what I wrote" from "somebody edited this" on a machine that did not +# generate it (CLAUDE.md, Storage format). +# +# The glob matters. Git will not descend into an excluded DIRECTORY, so a +# negation under `.gen-state/` can never apply — it has to be `.gen-state/*`. +.gen-state/* +!.gen-state/.hashes/ diff --git a/fixtures/generator-registry-conformance/registry.json b/fixtures/generator-registry-conformance/registry.json index 3326538dd9..2608e5aee6 100644 --- a/fixtures/generator-registry-conformance/registry.json +++ b/fixtures/generator-registry-conformance/registry.json @@ -508,6 +508,7 @@ "com.metaobjects.generator.requirement.RequirementTestRenderer", "com.metaobjects.generator.spring.AutoSetSupport", "com.metaobjects.generator.spring.FindInbound", + "com.metaobjects.generator.spring.SpringJavaWriter", "com.metaobjects.generator.spring.SpringM2mSupport", "com.metaobjects.generator.spring.SpringNaming", "com.metaobjects.generator.spring.SpringTypeMapper", @@ -515,7 +516,10 @@ "com.metaobjects.generator.util.GeneratedFileWriter", "com.metaobjects.generator.util.GeneratorUtil", "com.metaobjects.generator.util.JavaIdentifiers", - "com.metaobjects.generator.util.RestSurfaceGate" + "com.metaobjects.generator.util.RestSurfaceGate", + "com.metaobjects.generator.writer.CodeWriter", + "com.metaobjects.generator.writer.JavaWriter", + "com.metaobjects.generator.writer.WriterOptions" ] }, "kotlin": { diff --git a/scripts/ci-local.sh b/scripts/ci-local.sh index 08c2971735..b5488748b9 100755 --- a/scripts/ci-local.sh +++ b/scripts/ci-local.sh @@ -232,16 +232,25 @@ step_passed() { # step_passed "" — true when a step of that name has PAS cat "$CI_TMP"/*.tsv 2>/dev/null | awk -F'\t' -v n="$1" '$1 == "PASS" && $3 == n { f = 1 } END { exit !f }' } -# Every Maven call a gate makes — here and in the scripts it spawns (integration-test.sh, -# fatjar-smoke.sh) — resolves and INSTALLS into a CI-owned local repository, never the -# developer's ~/.m2. The Java lanes `mvn install` the tree at the CURRENT version, and on the -# shared ~/.m2 that silently replaced what Maven Central published under that number: an -# estate pinned to the current release, or a showcase regen resolving the plugin by version, -# then built against unreleased main (found cutting 1.0.2 — the "8.0.1" codegen-kotlin jar held -# a builder 8.0.1 never shipped). MAVEN_ARGS (Maven 3.9+) reaches every `mvn`, spawned -# scripts included, without touching a call site. The repository persists between runs, so -# only the first run downloads. Override with METAOBJECTS_CI_M2_REPO. -export MAVEN_ARGS="${MAVEN_ARGS:+$MAVEN_ARGS }-Dmaven.repo.local=${METAOBJECTS_CI_M2_REPO:-$HOME/.m2-ci/repository}" +# No Maven call a gate makes — here or in the scripts it spawns (integration-test.sh, +# regen-showcase.ts) — writes a repository anyone else reads: not ~/.m2, and not the shared +# ~/.m2-ci this script once installed into. Every worktree builds the same unreleased version, +# so a shared install silently replaced what other checkouts resolved under that number (found +# cutting 1.0.2, when the "8.0.1" codegen-kotlin jar held a builder 8.0.1 never shipped, and +# again in 1.3.0, when branch-built 8.3.0 jars in ~/.m2 had other lanes testing code they did +# not have). So the conformance and reactor gates are reactor builds that install nothing +# (`mvn -pl X -am test`, `mvn verify`), and the one step that needs installed artifacts — the +# out-of-reactor JVM integration modules — installs into THIS run's private repository: a +# small head under $DEV_SCRATCH in front of the shared cache, which is read only +# (scripts/lib/maven-private-repo.sh). ci_cleanup deletes the head. MAVEN_ARGS (Maven 3.9+) +# carries it to every `mvn`, spawned scripts included, without touching a call site. +# Override the cache with METAOBJECTS_CI_M2_REPO; METAOBJECTS_CI_M2_RUN_REPO names a head to +# keep (an ephemeral hosted runner passes ~/.m2/repository so setup-java can cache it). +# shellcheck source=scripts/lib/maven-private-repo.sh +. "$(dirname "${BASH_SOURCE[0]}")/lib/maven-private-repo.sh" +mo_maven_private_repo +CI_M2_OWNED="$MO_M2_OWNED" +trap 'rm -rf "$CI_TMP" ${CI_M2_OWNED:+"$CI_M2_OWNED"}' EXIT # replaced by ci_cleanup below # bun exits 1 when an OPTIONAL native dep fails its install script (the # ssh2/cpu-features chain needs node-gyp on the machine — `npm i -g node-gyp` @@ -800,14 +809,23 @@ gate_conf_csharp() { # eject goal and the only one that sees every codegen module, so that module is built here # for the one test. Kotlin's runs in its own lane below. gate_conf_java() { + # ONE reactor build, so every module tests against this tree's upstream modules and nothing + # is installed. Names are fully qualified: the same simple name exists in more than one + # module (ObjectModelConformanceTest is in metadata and codegen-kotlin). + local t=com.metaobjects tests + tests="$t.conformance.ConformanceTest,$t.conformance.YamlConformanceTest" + tests+=",$t.object.ObjectModelConformanceTest,$t.registry.RegistryManifestConformanceTest" + tests+=",$t.render.RenderCrossPortReportTest,$t.render.VerifyConformanceTest" + tests+=",$t.render.extract.ExtractConformanceTest,$t.render.prompt.OutputPromptConformanceTest" + tests+=",$t.generator.util.GeneratedFileWriterTest,$t.generator.direct.object.JavaCodegenWriteGuardTest" + tests+=",$t.generator.direct.object.JavaAccessorNameCollisionTest" + tests+=",$t.generator.spring.ValidationConformanceTest,$t.generator.GeneratorRegistryConformanceTest" + tests+=",$t.generator.spring.NoMagicPhysicalNamesTest,$t.generator.spring.CodegenCompileConformanceTest" + tests+=",$t.generator.spring.IllegalRecordComponentNameTest,$t.generator.spring.SpringIllegalNameCompileRunTest" + tests+=",$t.mojo.EjectContractTest" ( cd server/java \ - && mvn -pl metadata,render,codegen-base,codegen-spring -am install -DskipTests -q \ - && mvn -pl metadata test -Dtest='ConformanceTest,YamlConformanceTest,ObjectModelConformanceTest,RegistryManifestConformanceTest' -q \ - && mvn -pl render test -Dtest='RenderCrossPortReportTest,VerifyConformanceTest,ExtractConformanceTest,OutputPromptConformanceTest' -q \ - && mvn -pl codegen-base test -Dtest='GeneratedFileWriterTest,JavaCodegenWriteGuardTest,JavaAccessorNameCollisionTest' -q \ - && mvn -pl codegen-spring test -Dtest='ValidationConformanceTest,GeneratorRegistryConformanceTest,NoMagicPhysicalNamesTest,CodegenCompileConformanceTest,IllegalRecordComponentNameTest,SpringIllegalNameCompileRunTest' -q \ - && mvn -pl maven-plugin -am install -DskipTests -q \ - && mvn -pl maven-plugin test -Dtest='EjectContractTest' -q ) + && mvn -pl metadata,render,codegen-base,codegen-spring,maven-plugin -am test -q \ + -Dsurefire.failIfNoSpecifiedTests=false -Dtest="$tests" ) } gate_conf_python() { # FULL suite, not cherry-picked paths. Until 2026-07-19 this ran only @@ -878,9 +896,11 @@ gate_rust_gen_bench() { cargo run --release --locked -q -p metaobjects-codegen --example gen_bench -- 20 9 } gate_conf_kotlin() { + # A reactor build, like gate_conf_java: nothing installed, every name fully qualified. + local k=com.metaobjects.generator.kotlin ( cd server/java \ - && mvn -pl codegen-kotlin -am install -DskipTests -q \ - && mvn -pl codegen-kotlin test -Dtest='ObjectModelConformanceTest,OutputPromptConformanceTest,ValidationConformanceTest,GeneratorRegistryConformanceTest,RegistryManifestConformanceTest,NoMagicPhysicalNamesTest,CodegenCompileConformanceTest,EjectContractTest' -q ) + && mvn -pl codegen-kotlin -am test -q -Dsurefire.failIfNoSpecifiedTests=false \ + -Dtest="$k.ObjectModelConformanceTest,$k.OutputPromptConformanceTest,$k.ValidationConformanceTest,$k.GeneratorRegistryConformanceTest,$k.RegistryManifestConformanceTest,$k.NoMagicPhysicalNamesTest,$k.CodegenCompileConformanceTest,$k.EjectContractTest" ) } # ── conformance.yml — full reactor + drift/mutation gates ───────────────────── @@ -892,11 +912,13 @@ gate_conf_kotlin() { gate_java_reactor() { local jacoco="-Djacoco.skip=true" [ "${MO_CI_JACOCO:-0}" = "1" ] && jacoco="" - ( cd server/java && mvn -q clean install $jacoco ) + ( cd server/java && mvn -q clean verify $jacoco ) } -# The full run's JVM integration lanes need the reactor installed and must not install it -# themselves (two concurrent `mvn install`s clobber the shared module jars). When the reactor -# step is not selected — `--integration-only` — this installs it without its tests. +# The full run's JVM integration modules live outside the reactor, so they — alone — need +# the tree installed. This installs it without tests into THIS run's private repository +# (MAVEN_ARGS, above), never a shared one, and only the java lane runs it: the two JVM +# integration lanes read it side by side, and installing there too would race them over +# the same jars. No `clean`: it reuses the reactor step's compiled classes. gate_java_install() { ( cd server/java && mvn -q -DskipTests -Djacoco.skip=true install ); } # ── The mutation (completeness) gate: two scopes over ONE file list ─────────── # Stryker mutates the files listed in `mutate` in server/typescript/packages/metadata/ @@ -1231,8 +1253,9 @@ run_integration_for() { # run_integration_for "