Skip to content

feat(metadata): read and enforce the reference facet in the Java loader - #696

Merged
dmealing merged 4 commits into
mainfrom
fm/mo-140-w1-b1-java
Dec 3, 2026
Merged

dmealing merged 4 commits into
mainfrom
fm/mo-140-w1-b1-java

Conversation

@dmealing

@dmealing dmealing commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • The Java loader, which Kotlin runs on, now reads, validates and enforces the ref facet on provider-definition attributes. This covers target type and subtypes, fieldPath, sameSystem, System.child and pkg::System.child lookups, bare values found in the referrer's containers first, canonical rewriting, and writing ref to the registry manifest only when present. ReferenceFacetTest is added, and the spec's list of enforcing ports now includes Java and Kotlin. No shipped definition file uses the facet yet.
  • Existing reference behavior changes: parent-relative @references values now resolve, and a dotted extends can target a non-object top-level owner. An @objectRef or @references value that climbs above the root package now raises ERR_BAD_ATTR_VALUE, and an inherited reference is checked in its declaring node's package. A provider's custom error code is preserved through MetaDataException.getProviderCode() and getCodeName().
  • Breaking Java API changes: ReferenceDescriptor is now (attr, ReferenceFacet), and SymbolTable loses its public no-argument constructor (use SymbolTable.build(root)). SymbolTable gains typed resolve and lookup methods, and SpecMetamodelReader.fromJson parses provider definitions from JSON text. A changelog fragment includes upgrade notes.
Validation

Risk Assessment

✅ Low: The change mirrors the merged TypeScript reference closely. No shipped definition uses the facet, so registry and manifest output do not change. Each behavior change to the four core references is deliberate, matches TypeScript and is recorded in the changelog. New JUnit cases built on the spec cover them.

Testing

The baseline scripts/ci-local.sh --affected --strict-toolchains had already passed at this commit and supplies broad regression. I ran the focused ReferenceFacetTest and metadata-ktx tests, then drove 23 synthetic models with a test provider through the Java loader, the TypeScript loader and the Kotlin loadString facade. Java and TypeScript reported identical codes on every case and byte-identical canonical output on every clean load. Kotlin matched too, except that its facade throws a single exception, so the two-bad-entries list case surfaced only ERR_REF_WRONG_KIND. The code sits on that exception's cause, under a MetaDataLoadingException wrapper from fromString, which this change does not modify. An empty-string reference value loads clean in all three. The change has no UI, so the evidence is CLI transcripts and serialized output. The temporary harness was removed and the worktree is clean.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
A provider declares reference attributes and the Java loader enforces them: a role and an app both named api bind by kind; unresolved, wrong-kind, wrong-subtype and cross-system values are refused w… ✅ pass live parity-transcript.txt cases 01-17 and java-errors.txt: Java and TypeScript codes are identical, including ERR_REF_UNRESOLVED, ERR_REF_WRONG_KIND, the facet's own cross-system codes, ERR_BAD_ATTR_VALUE…
A user loads and re-serializes a model: System.child, pkg::System.child, root-absolute, field-path and parent-relative @references values canonicalize as in TypeScript; the manifest writes ref… ✅ pass live parity-transcript.txt: canonical output of cases 01, 07, 18-21 is byte-identical between Java and TypeScript; the 7 manifest ref entries match including key order; the shipped Java manifest has no ref…
A Kotlin user passes the provider to metadata-ktx loadString and gets the same enforcement and canonical output, and the existing metadata-ktx tests still pass ✅ pass live kotlin.tsv, kotlin-chain.txt, parity-transcript.txt (canonical output byte-identical to TypeScript; refused models carry the matching code on the thrown exception's cause) and junit-reference-facet-an…
Evidence: Java vs TypeScript vs Kotlin parity transcript (codes, canonical output, manifest ref entries)
case | Java loader | TS loader | Kotlin metadata-ktx (first code)
01-valid-role-and-app-both-api | [] | [] | []
02-unresolved | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED]
03-wrong-kind | [ERR_REF_WRONG_KIND] | [ERR_REF_WRONG_KIND] | [ERR_REF_WRONG_KIND]
04-wrong-subtype-queue | [ERR_REF_WRONG_KIND] | [ERR_REF_WRONG_KIND] | [ERR_REF_WRONG_KIND]
05-crosses-system | [ERR_GRANT_CROSSES_SYSTEM] | [ERR_GRANT_CROSSES_SYSTEM] | [ERR_GRANT_CROSSES_SYSTEM]
06-runsAs-other-system | [ERR_RUNSAS_OTHER_SYSTEM] | [ERR_RUNSAS_OTHER_SYSTEM] | [ERR_RUNSAS_OTHER_SYSTEM]
07-system-child-and-pkg-system-child | [] | [] | []
08-bare-from-outside | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED]
09-pinned-from-outside | [ERR_TEST_OUTSIDE] | [ERR_TEST_OUTSIDE] | [ERR_TEST_OUTSIDE]
10-ambiguous-intermediate | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED]
11-over-climb | [ERR_BAD_ATTR_VALUE] | [ERR_BAD_ATTR_VALUE] | [ERR_BAD_ATTR_VALUE]
12-facet-code-replaces-defaults | [ERR_TEST_ROLE] | [ERR_TEST_ROLE] | [ERR_TEST_ROLE]
13-list-two-bad-entries | [ERR_REF_UNRESOLVED, ERR_REF_WRONG_KIND] | [ERR_REF_UNRESOLVED, ERR_REF_WRONG_KIND] | [ERR_REF_WRONG_KIND]
14-trailing-dot | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED]
15-leading-dot | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED]
16-wrong-package | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED]
17-too-deep | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED] | [ERR_REF_UNRESOLVED]
18-empty-string | [] | [] | []
19-root-absolute | [] | [] | []
20-field-path | [] | [] | []
21-core-parent-relative-references | [] | [] | []
22-core-over-climb-references | [ERR_BAD_ATTR_VALUE] | [ERR_BAD_ATTR_VALUE] | [ERR_BAD_ATTR_VALUE]
23-core-unresolved-references | [ERR_INVALID_REFERENCE] | [ERR_INVALID_REFERENCE] | [ERR_INVALID_REFERENCE]

canonical output of clean loads:
01-valid-role-and-app-both-api java==ts:yes kotlin==ts:yes
07-system-child-and-pkg-system-child java==ts:yes kotlin==ts:yes
18-empty-string java==ts:yes kotlin==ts:yes
19-root-absolute java==ts:yes kotlin==ts:yes
20-field-path java==ts:yes kotlin==ts:yes
21-core-parent-relative-references java==ts:yes kotlin==ts:yes

java ref entries: 7 ts: 7 identical incl. key order: True
('app', 'service', 'calls') {"targetType": "app"}
('app', 'service', 'reads') {"targetType": "resource", "fieldPath": true}
('app', 'service', 'runsAs') {"targetType": "role", "sameSystem": true, "wrongSystemCode": "ERR_RUNSAS_OTHER_SYSTEM"}
('deployment', 'test', 'anyRole') {"targetType": "role", "errorCode": "ERR_TEST_ROLE"}
('deployment', 'test', 'app') {"targetType": "app"}
('deployment', 'test', 'pinnedRole') {"targetType": "role", "sameSystem": true, "wrongSystemCode": "ERR_TEST_OUTSIDE"}
('grant', 'rdb', 'resource') {"targetType": "resource", "targetSubTypes": ["rdb"], "sameSystem": true, "wrongSystemCode": "ERR_GRANT_CROSSES_SYSTEM"}
shipped manifest contains ref key: false
Evidence: Java loader error messages per refused model
02-unresolved: ERR_REF_UNRESOLVED: app.service "Parcels.worker" @runsAs "nobody" does not resolve to a role.
03-wrong-kind: ERR_REF_WRONG_KIND: app.service "Parcels.worker" @runsAs "db" names resource.rdb "db", not a role.
04-wrong-subtype-queue: ERR_REF_WRONG_KIND: grant.rdb "x.g9" @resource "jobs" resolves to resource.queue "jobs" in system "acme::Parcels", not resource.rdb.
05-crosses-system: ERR_GRANT_CROSSES_SYSTEM: grant.rdb "x.g9" @resource "Ledger.books" resolves to resource.rdb "books" in system "acme::Ledger", but it must be in the same system as the node that declares it, which is in system "acme::Parcels".
06-runsAs-other-system: ERR_RUNSAS_OTHER_SYSTEM: app.service "Parcels.worker" @runsAs "Ledger.clerk" resolves to role.service "clerk" in system "acme::Ledger", but it must be in the same system as the node that declares it, which is in system "acme::Parcels".
08-bare-from-outside: ERR_REF_UNRESOLVED: deployment.test "d1" @app "web" does not resolve to a app.
09-pinned-from-outside: ERR_TEST_OUTSIDE: deployment.test "d1" @pinnedRole "Parcels.api" resolves to role.service "api" in system "acme::Parcels", but it must be in the same system as the node that declares it, which is in a node outside any system.
10-ambiguous-intermediate: ERR_REF_UNRESOLVED: deployment.test "d1" @app "Parcels.api.g1" does not resolve to a app.
11-over-climb: ERR_BAD_ATTR_VALUE: deployment.test "d1" @app "..::..::Parcels.api" climbs above the root package — each '..::' drops one segment of the declaring package.
12-facet-code-replaces-defaults: ERR_TEST_ROLE: deployment.test "d1" @anyRole "Parcels.db" names resource.rdb "db", not a role.
13-list-two-bad-entries: ERR_REF_UNRESOLVED: app.service "Parcels.worker" @calls "nobody" does not resolve to a app.
13-list-two-bad-entries: ERR_REF_WRONG_KIND: app.service "Parcels.worker" @calls "db" names resource.rdb "db", not a app.
14-trailing-dot: ERR_REF_UNRESOLVED: deployment.test "d1" @app "Parcels." does not resolve to a app.
15-leading-dot: ERR_REF_UNRESOLVED: deployment.test "d1" @app ".api" does not resolve to a app.
16-wrong-package: ERR_REF_UNRESOLVED: deployment.test "d1" @app "nope::Parcels.api" does not resolve to a app.
17-too-deep: ERR_REF_UNRESOLVED: deployment.test "d1" @app "Parcels.api.zzz.yyy" does not resolve to a app.
22-core-over-climb-references: ERR_BAD_ATTR_VALUE: identity.reference "Order.address" @references "..::..::..::Address.id" climbs above the root package — each '..::' drops one segment of the declaring package.
23-core-unresolved-references: ERR_INVALID_REFERENCE: identity.reference "Order.address" @references "Nope.id" does not resolve to an object.
shipped manifest contains ref key: false
Evidence: TypeScript loader error messages for the same models
02-unresolved: ERR_REF_UNRESOLVED: app.service "Parcels.worker" @runsAs "nobody" does not resolve to a role.
03-wrong-kind: ERR_REF_WRONG_KIND: app.service "Parcels.worker" @runsAs "db" names resource.rdb "db", not a role.
04-wrong-subtype-queue: ERR_REF_WRONG_KIND: grant.rdb "x.g9" @resource "jobs" resolves to resource.queue "jobs" in system "acme::Parcels", not resource.rdb.
05-crosses-system: ERR_GRANT_CROSSES_SYSTEM: grant.rdb "x.g9" @resource "Ledger.books" resolves to resource.rdb "books" in system "acme::Ledger", but it must be in the same system as the node that declares it, which is in system "acme::Parcels".
06-runsAs-other-system: ERR_RUNSAS_OTHER_SYSTEM: app.service "Parcels.worker" @runsAs "Ledger.clerk" resolves to role.service "clerk" in system "acme::Ledger", but it must be in the same system as the node that declares it, which is in system "acme::Parcels".
08-bare-from-outside: ERR_REF_UNRESOLVED: deployment.test "d1" @app "web" does not resolve to a app.
09-pinned-from-outside: ERR_TEST_OUTSIDE: deployment.test "d1" @pinnedRole "Parcels.api" resolves to role.service "api" in system "acme::Parcels", but it must be in the same system as the node that declares it, which is in a node outside any system.
10-ambiguous-intermediate: ERR_REF_UNRESOLVED: deployment.test "d1" @app "Parcels.api.g1" does not resolve to a app.
11-over-climb: ERR_BAD_ATTR_VALUE: deployment.test "d1" @app "..::..::Parcels.api" climbs above the root package — each '..::' drops one segment of the declaring package.
12-facet-code-replaces-defaults: ERR_TEST_ROLE: deployment.test "d1" @anyRole "Parcels.db" names resource.rdb "db", not a role.
13-list-two-bad-entries: ERR_REF_UNRESOLVED: app.service "Parcels.worker" @calls "nobody" does not resolve to a app.
13-list-two-bad-entries: ERR_REF_WRONG_KIND: app.service "Parcels.worker" @calls "db" names resource.rdb "db", not a app.
14-trailing-dot: ERR_REF_UNRESOLVED: deployment.test "d1" @app "Parcels." does not resolve to a app.
15-leading-dot: ERR_REF_UNRESOLVED: deployment.test "d1" @app ".api" does not resolve to a app.
16-wrong-package: ERR_REF_UNRESOLVED: deployment.test "d1" @app "nope::Parcels.api" does not resolve to a app.
17-too-deep: ERR_REF_UNRESOLVED: deployment.test "d1" @app "Parcels.api.zzz.yyy" does not resolve to a app.
22-core-over-climb-references: ERR_BAD_ATTR_VALUE: identity.reference "Order.address" @references "..::..::..::Address.id" climbs above the root package — each '..::' drops one segment of the declaring package.
23-core-unresolved-references: ERR_INVALID_REFERENCE: identity.reference "Order.address" @references "Nope.id" does not resolve to an object.
Evidence: Kotlin facade exception cause chain per refused model
02-unresolved: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_UNRESOLVED]
03-wrong-kind: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_WRONG_KIND]
04-wrong-subtype-queue: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_WRONG_KIND]
05-crosses-system: MetaDataLoadingException[-] <- MetaDataException[ERR_GRANT_CROSSES_SYSTEM]
06-runsAs-other-system: MetaDataLoadingException[-] <- MetaDataException[ERR_RUNSAS_OTHER_SYSTEM]
08-bare-from-outside: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_UNRESOLVED]
09-pinned-from-outside: MetaDataLoadingException[-] <- MetaDataException[ERR_TEST_OUTSIDE]
10-ambiguous-intermediate: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_UNRESOLVED]
11-over-climb: MetaDataLoadingException[-] <- MetaDataException[ERR_BAD_ATTR_VALUE]
12-facet-code-replaces-defaults: MetaDataLoadingException[-] <- MetaDataException[ERR_TEST_ROLE]
13-list-two-bad-entries: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_WRONG_KIND]
14-trailing-dot: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_UNRESOLVED]
15-leading-dot: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_UNRESOLVED]
16-wrong-package: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_UNRESOLVED]
17-too-deep: MetaDataLoadingException[-] <- MetaDataException[ERR_REF_UNRESOLVED]
22-core-over-climb-references: MetaDataLoadingException[-] <- MetaDataException[ERR_BAD_ATTR_VALUE]
23-core-unresolved-references: MetaDataLoadingException[-] <- MetaDataException[ERR_INVALID_REFERENCE]
  • Evidence: Canonical JSON written by Java, TypeScript and Kotlin for clean loads, plus manifests with the provider (evidence: canonical)
  • Evidence: Input models (evidence: cases)
  • Evidence: Disposable drivers and facet definition (evidence: harness)
Evidence: Focused JUnit log: ReferenceFacetTest and metadata-ktx
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] MetaObjects Core                                                   [pom]
[INFO] MetaObjects :: MetaData                                            [jar]
[INFO] MetaObjects :: Render                                              [jar]
[INFO] MetaObjects :: Metadata Kotlin Facade                              [jar]
[INFO] 
[INFO] --------------------< com.metaobjects:metaobjects >---------------------
[INFO] Building MetaObjects Core 8.3.1                                    [1/4]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- jacoco:0.8.13:prepare-agent (prepare-agent) @ metaobjects ---
[INFO] argLine set to -javaagent:{maven-repo}/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile={run-worktree}/server/java/target/jacoco.exec,excludes=**/*Test*:**/test/**:**/*Exception*
[INFO] 
[INFO] --- jacoco:0.8.13:report (report) @ metaobjects ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO] 
[INFO] --- dependency:3.7.0:build-classpath (default-cli) @ metaobjects ---
[INFO] Wrote classpath file '{run-worktree}/server/java/target/refcp.txt'.
[INFO] 
[INFO] ----------------< com.metaobjects:metaobjects-metadata >----------------
[INFO] Building MetaObjects :: MetaData 8.3.1                             [2/4]
[INFO]   from metadata/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO] 
[INFO] --- jacoco:0.8.13:prepare-agent (prepare-agent) @ metaobjects-metadata ---
[INFO] argLine set to -javaagent:{maven-repo}/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile={run-worktree}/server/java/metadata/target/jacoco.exec,excludes=**/*Test*:**/test/**:**/*Exception*
[INFO] 
[INFO] --- resources:3.3.1:copy-resources (bundle-spec-metamodel) @ metaobjects-metadata ---
[INFO] Copying 22 resources from ../../../spec/metamodel to target/classes/spec/metamodel
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ metaobjects-metadata ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] 
[INFO] --- compiler:3.13.0:compile (default-compile) @ metaobjects-metadata ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ metaobjects-metadata ---
[INFO] Copying 25 resources from src/test/resources to target/test-classes
[INFO] 
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ metaobjects-metadata ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- surefire:3.5.2:test (default-test) @ metaobjects-metadata ---
[INFO] Using auto detected provider org.apache.maven.surefire.junit4.JUnit4Provider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.metaobjects.validation.ReferenceFacetTest
[INFO] Tests run: 33, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.519 s -- in com.metaobjects.validation.ReferenceFacetTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 33, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco:0.8.13:report (report) @ metaobjects-metadata ---
[INFO] Loading execution data file {run-worktree}/server/java/metadata/target/jacoco.exec
[INFO] Analyzed bundle 'MetaObjects :: MetaData' with 388 classes
[INFO] 
[INFO] --- dependency:3.7.0:build-classpath (default-cli) @ metaobjects-metadata ---
[INFO] Wrote classpath file '{run-worktree}/server/java/metadata/target/refcp.txt'.
[INFO] 
[INFO] -----------------< com.metaobjects:metaobjects-render >-----------------
[INFO] Building MetaObjects :: Render 8.3.1                               [3/4]
[INFO]   from render/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- jacoco:0.8.13:prepare-agent (prepare-agent) @ metaobjects-render ---
[INFO] argLine set to -javaagent:{maven-repo}/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile={run-worktree}/server/java/render/target/jacoco.exec,excludes=**/*Test*:**/test/**:**/*Exception*
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ metaobjects-render ---
[INFO] skip non existing resourceDirectory {run-worktree}/server/java/render/src/main/resources
[INFO] 
[INFO] --- compiler:3.13.0:compile (default-compile) @ metaobjects-render ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ metaobjects-render ---
[INFO] Copying 26 resources from src/test/resources to target/test-classes
[INFO] 
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ metaobjects-render ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- surefire:3.5.2:test (default-test) @ metaobjects-render ---
[INFO] 
[INFO] --- jacoco:0.8.13:report (report) @ metaobjects-render ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO] 
[INFO] --- dependency:3.7.0:build-classpath (default-cli) @ metaobjects-render ---
[INFO] Wrote classpath file '{run-worktree}/server/java/render/target/refcp.txt'.
[INFO] 
[INFO] --------------< com.metaobjects:metaobjects-metadata-ktx >--------------
[INFO] Building MetaObjects :: Metadata Kotlin Facade 8.3.1               [4/4]
[INFO]   from metadata-ktx/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- jacoco:0.8.13:prepare-agent (prepare-agent) @ metaobjects-metadata-ktx ---
[INFO] argLine set to -javaagent:{maven-repo}/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile={run-worktree}/server/java/metadata-ktx/target/jacoco.exec,excludes=**/*Test*:**/test/**:**/*Exception*
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ metaobjects-metadata-ktx ---
[INFO] skip non existing resourceDirectory {run-worktree}/server/java/metadata-ktx/src/main/resources
[INFO] 
[INFO] --- compiler:3.13.0:compile (default-compile) @ metaobjects-metadata-ktx ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- kotlin:2.0.21:compile (compile) @ metaobjects-metadata-ktx ---
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ metaobjects-metadata-ktx ---
[INFO] Copying 1 resource from src/test/resources to target/test-classes
[INFO] 
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ metaobjects-metadata-ktx ---
[INFO] Recompiling the module because of changed dependency.
[INFO] 
[INFO] --- kotlin:2.0.21:test-compile (test-compile) @ metaobjects-metadata-ktx ---
[INFO] 
[INFO] --- surefire:3.5.2:test (default-test) @ metaobjects-metadata-ktx ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.metaobjects.metadata.ktx.ReadmeSamplesTest
01:56:53.043 WARN  c.metaobjects.loader.MetaDataLoader - No .metaobjects/config.json found above the metadata sources of loader 'demo': using the default physical naming (columns snake_case, tables snake_case). If your database columns are named like the fields, set "naming": { "columns": "literal" } in the project's .metaobjects/config.json and, for a classpath runtime, point the Spring property metaobjects.physical-naming-config at it.
01:56:53.065 WARN  c.metaobjects.loader.MetaDataLoader - No .metaobjects/config.json found above the metadata sources of loader 'demo': using the default physical naming (columns snake_case, tables snake_case). If your database columns are named like the fields, set "naming": { "columns": "literal" } in the project's .metaobjects/config.json and, for a classpath runtime, point the Spring property metaobjects.physical-naming-config at it.
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.592 s -- in com.metaobjects.metadata.ktx.ReadmeSamplesTest
[INFO] Running com.metaobjects.metadata.ktx.RenderTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.069 s -- in com.metaobjects.metadata.ktx.RenderTest
[INFO] Running com.metaobjects.metadata.ktx.ProviderVocabularyTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.053 s -- in com.metaobjects.metadata.ktx.ProviderVocabularyTest
[INFO] Running com.metaobjects.metadata.ktx.AttrsTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s -- in com.metaobjects.metadata.ktx.AttrsTest
[INFO] Running com.metaobjects.metadata.ktx.IdentityTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 s -- in com.metaobjects.metadata.ktx.IdentityTest
[INFO] Running com.metaobjects.metadata.ktx.FieldsTest
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 s -- in com.metaobjects.metadata.ktx.FieldsTest
[INFO] Running com.metaobjects.metadata.ktx.MetaObjectsTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 s -- in com.metaobjects.metadata.ktx.MetaObjectsTest
[INFO] Running com.metaobjects.metadata.ktx.MetaEndpointKtxTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 s -- in com.metaobjects.metadata.ktx.MetaEndpointKtxTest
[INFO] Running com.metaobjects.metadata.ktx.LoaderTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 s -- in com.metaobjects.metadata.ktx.LoaderTest
[INFO] Running com.metaobjects.metadata.ktx.RelationshipsTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.019 s -- in com.metaobjects.metadata.ktx.RelationshipsTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 39, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco:0.8.13:report (report) @ metaobjects-metadata-ktx ---
[INFO] Loading execution data file {run-worktree}/server/java/metadata-ktx/target/jacoco.exec
[INFO] Analyzed bundle 'MetaObjects :: Metadata Kotlin Facade' with 10 classes
[INFO] 
[INFO] --- dependency:3.7.0:build-classpath (default-cli) @ metaobjects-metadata-ktx ---
[INFO] Wrote classpath file '{run-worktree}/server/java/metadata-ktx/target/refcp.txt'.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for MetaObjects Core 8.3.1:
[INFO] 
[INFO] MetaObjects Core ................................... SUCCESS [  0.712 s]
[INFO] MetaObjects :: MetaData ............................ SUCCESS [  2.921 s]
[INFO] MetaObjects :: Render .............................. SUCCESS [  0.026 s]
[INFO] MetaObjects :: Metadata Kotlin Facade .............. SUCCESS [  5.423 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.255 s
[INFO] Finished at: 2026-12-03T01:56:53-05:00
[INFO] ------------------------------------------------------------------------

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.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
A provider declares reference attributes and the Java loader enforces them: a role and an app both named api bind by kind; unresolved, wrong-kind, wrong-subtype and cross-system values are refused w… ✅ pass live parity-transcript.txt cases 01-17 and java-errors.txt: Java and TypeScript codes are identical, including ERR_REF_UNRESOLVED, ERR_REF_WRONG_KIND, the facet's own cross-system codes, ERR_BAD_ATTR_VALUE…
A user loads and re-serializes a model: System.child, pkg::System.child, root-absolute, field-path and parent-relative @references values canonicalize as in TypeScript; the manifest writes ref… ✅ pass live parity-transcript.txt: canonical output of cases 01, 07, 18-21 is byte-identical between Java and TypeScript; the 7 manifest ref entries match including key order; the shipped Java manifest has no ref…
A Kotlin user passes the provider to metadata-ktx loadString and gets the same enforcement and canonical output, and the existing metadata-ktx tests still pass ✅ pass live kotlin.tsv, kotlin-chain.txt, parity-transcript.txt (canonical output byte-identical to TypeScript; refused models carry the matching code on the thrown exception's cause) and junit-reference-facet-an…
  • scripts/ci-local.sh --affected --strict-toolchains
  • Broad regression came from the configured test command scripts/ci-local.sh --affected --strict-toolchains, which already passed at target commit e5b4c43f36; it was not re-run, and no source or test files were changed.
  • mvn -o -pl metadata,metadata-ktx -am test -Dtest=&#39;ReferenceFacetTest,com.metaobjects.metadata.ktx.**.*&#39;: ReferenceFacetTest and the metadata-ktx tests passed.
  • Disposable Java driver (Drive.java) against the built metadata classes, with a test provider read through SpecMetamodelReader, over 23 synthetic YAML models.
  • The same 23 models and facet definition through the TypeScript MetaDataLoader (bun drive.ts) as the independent reference; compared error codes, canonical JSON bytes and registry-manifest ref entries.
  • Temporary Kotlin test calling metadata-ktx loadString(..., providers = listOf(...)) over the same 23 models; the test file and its build outputs were removed afterwards.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

The spec reader validates `ref` on an attr entry (refusing a bad facet, or one on a
structural child) and carries it onto the attr's ChildRequirement / CommonAttributeDef; the
registry-derived walk enforces it through a kind-typed symbol table (System.child,
pkg::System.child, bare values found in the referrer's containers first, untyped lookup only
for the wrong-kind code, sameSystem judged on the walked path); the reference pass binds
facet attributes to the walked path and keeps a value as written when its canonical spelling
would not reload to the same target; the registry manifest writes `ref` only when present.
A provider's own code keeps its spelling (MetaDataException.getProviderCode / getCodeName).
A parent-relative `..::` owner now resolves (the walk no longer cuts at the first dot), and a
dotted `extends` whose owner is a non-object top-level node resolves, as in TS and C#.
Kotlin runs on it. No definition file uses the facet, so no registry, manifest or generated
output changes. Mirrors the C# loader (#694) case for case.
Keep main's single copy of ERR_REF_UNRESOLVED/ERR_REF_WRONG_KIND and list Java and Kotlin on the reference-facet Status line.
@dmealing
dmealing merged commit cedf0a2 into main Dec 3, 2026
11 checks passed
@dmealing
dmealing deleted the fm/mo-140-w1-b1-java branch December 3, 2026 07:12
dmealing added a commit that referenced this pull request Dec 3, 2026
…697)

The spec reader in providers.rs validates `ref` on an attr entry (refusing a bad facet, or
one on a structural child) and carries it to AttrSchema::reference. The registered walk
enforces it through a kind-typed symbol table: System.child and pkg::System.child, bare values
found in the referrer's containers first, an untyped lookup only for the wrong-kind code, and
sameSystem judged on the walked path. The reference pass writes the walked path and keeps a
value as written when its canonical spelling would not look up the same target. The registry
manifest writes `ref` only when present. A provider's own code keeps its spelling in
MetaError::provider_code. A parent-relative `..::Owner.field` value resolves its owner.

A same-document root-level node and a same-named packaged node are no longer merged, which
closes yaml-ref-root-escape: yaml-conformance is 19 of 19 with an empty ledger. No definition
file uses the facet, so no registry, manifest or generated output changes. Mirrors the
TypeScript (#695), C# (#694) and Java (#696) loaders.
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.

1 participant