Repository navigation
fix(metadata): accept parent-relative origin paths in every port - #700
Merged
Merged
Conversation
…ypeScript loader Split origin paths at the first dot after the last :: (ADR-0059 §2) so ..::Entity.field resolves exactly as its pkg:: twin. Adds the shared conformance fixtures origin-parent-relative-refs and two negatives.
…ava, Python and Rust Each loader now splits an origin path at the first dot after the last :: (ADR-0059 §2) through its existing splitChildTail equivalent, so ..::Entity.field resolves exactly as the pkg:: form. The C# deprecation lint had the same first-dot split and is fixed with a test. Rust's minPassing and the corpus counts move to 587; one changelog fragment.
…ALUE in every port A ..:: origin @from/@of/@via with more parent steps than the referrer's package has segments now reports ERR_BAD_ATTR_VALUE (ADR-0059 §2), the code the reference readers use for over-drop, through each port's existing owner-candidate check. Shared fixture error-origin-parent-relative-over-drop; corpus counts move to 588.
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
@from,@ofand@viavalues written..::Entity.fieldnow load in the TypeScript, C#, Java (and Kotlin), Python and Rust loaders. Each splits at the first.after the last::(ADR-0059 §2 and §4) and resolves like the qualifiedpkg::Entity.fieldform. Before, these failed withERR_INVALID_ORIGIN...::origin that climbs above the root package now fails withERR_BAD_ATTR_VALUE, the code other references use for that case.@viawithERR_INVALID_ORIGINand reports one error per broken origin instead of only the first.origin-parent-relative-refs(loads to the same model as itspkg::twin), plus error fixtures for unresolved, wrong-kind, over-drop and trailing-dot origins. Also adds a changelog fragment and updates docs and the Rust expected-failures list.Validation
Risk Assessment
✅ Low: The change is a bounded fix that splits origin paths at the ADR-0059 owner boundary and reports over-drops consistently in the TypeScript, C#, Java, Python and Rust loaders; the round 1 lint revert matches the recorded decision, and I found no material defect in the paths I traced (tests were not run in this phase).
Testing
The baseline
scripts/ci-local.sh --affected --strict-toolchainshad already passed at this commit and was not repeated. I drove the real loaders of all five ports, plus the Kotlin facade, on disposable synthetic models: the valid..::model loads everywhere and gives byte-identical TypeScript view SQL to itspkg::twin (SQL and generated output of other ports were not compared in this round). Over-climbing paths fail withERR_BAD_ATTR_VALUE; unresolved, malformed and trailing-dot paths fail withERR_INVALID_ORIGIN, including in Java and Kotlin. Two broken origins yield two errors in the TypeScript, Java, Python, C# and Rust loaders, althoughmeta schemaprints only the first. This is a loader change with no UI, so the evidence is CLI and loader transcripts. Scratch files were removed and the worktree is clean. Earlier-round files in the evidence directory (without ther2marker in their names) describe the state before the trailing-dot fix...::Entity.field(including a multi-hop path), and it loads like the qualifiedpkg::form in TypeScript, Python, C#, Rust, Java…relativeandqualifiedcases load clean on all six surfaces; r2-relative-schema.sql: TypeScript view SQL is byte-identical between the two..::andpkg::, on passthrough and aggregate) is refused with ERR_INVALID_ORIGIN in every port including Java and Kotlin, and two broken origins are…Evidence: Per-case loader results at the target commit: TypeScript, Python, C#, Rust, Java and Kotlin
Evidence: CLI transcripts with error messages, and full error lists for the two-broken-origins models
Evidence: Trailing-dot @via, Java and Kotlin after the fix
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/typescript/packages/cli/src/lib/deprecation-lint.ts:152- Simplification: the new split logic in both deprecated-reference lints is not needed. Sites: deprecation-lint.ts:150-154 (headOf) and :224-225 (checkViaPath, which also rebuilds_splitViaPathinline), DeprecationLint.cs:105-109 (HeadOf) and :140 (CheckVia). The lints read the loaded model, andresolveReferences/ResolveReferences.Runhas already rewritten every resolvable..::Entity.memberto itspkg::form. An unresolved one is a load error, and C#ModelLintsruns this lint only when there are no load errors. So the old first-dot split never sees a resolvable..::value. The new tests (deprecation-lint.test.ts:456, DeprecationLintParentRelativeTests.cs) would also pass with the old lint code, so they do not cover these edits. The intent listedHeadOf/CheckViaonly as "not probed". Recommended remedy: revert the lint edits, drop the two tests or keep them only as end-to-end loader coverage, and remove the sentence "The TypeScript and C# deprecated-reference lints split the same way" from changelog.d/origin-parent-relative-paths.md:6.NamingRefs.SplitViaPathstays, because the C# loader uses it.server/csharp/MetaObjects/Loader/ValidationPasses.cs:1146- Fixed inline:ReportOverDrophad been inserted betweenValidateFromPath's doc comment and its declaration, so the two comments merged onto the wrong method. Moved theValidateFromPathcomment back aboveValidateFromPath. No code changed.🔧 Fix applied.
2 issues (1 warning, 1 info) still open:
server/typescript/packages/cli/src/lib/deprecation-lint.ts:152- Simplification: the new split logic in both deprecated-reference lints is not needed. Sites: deprecation-lint.ts:150-154 (headOf) and :224-225 (checkViaPath, which also rebuilds_splitViaPathinline), DeprecationLint.cs:105-109 (HeadOf) and :140 (CheckVia). The lints read the loaded model, andresolveReferences/ResolveReferences.Runhas already rewritten every resolvable..::Entity.memberto itspkg::form. An unresolved one is a load error, and C#ModelLintsruns this lint only when there are no load errors. So the old first-dot split never sees a resolvable..::value. The new tests (deprecation-lint.test.ts:456, DeprecationLintParentRelativeTests.cs) would also pass with the old lint code, so they do not cover these edits. The intent listedHeadOf/CheckViaonly as "not probed". Recommended remedy: revert the lint edits, drop the two tests or keep them only as end-to-end loader coverage, and remove the sentence "The TypeScript and C# deprecated-reference lints split the same way" from changelog.d/origin-parent-relative-paths.md:6.NamingRefs.SplitViaPathstays, because the C# loader uses it.server/csharp/MetaObjects/Loader/ValidationPasses.cs:1146- Fixed inline:ReportOverDrophad been inserted betweenValidateFromPath's doc comment and its declaration, so the two comments merged onto the wrong method. Moved theValidateFromPathcomment back aboveValidateFromPath. No code changed.🔧 **Test** - 1 issue found → auto-fixed ✅
server/java/metadata/src/main/java/com/metaobjects/loader/ValidationPhase.java:5208- Java (and so Kotlin, which shares the loader) loads an origin @via with a trailing dot, such as..::..::Week.days.oracme::Week.days., while TypeScript, Python, C# and Rust refuse it (the..::form with ERR_INVALID_ORIGIN in all four; the qualified form was checked on TypeScript only).String.splitdrops trailing empty segments, both in the newsplitViaPathand in the oldviaAttr.splitit replaced, so the leniency for the qualified form predates this change. The..::form now inherits it, which leaves the ports behaving differently on this malformed input. Proposed repair: split the hops with limit -1 insplitViaPathand add an error fixture. It is not applied because it would also stop Java loading the qualified form that loads today, which is a compatibility decision beyond this change...::..::Entity.member(including a two-hop @via, with a same-named decoy entity nearer) and it loads in TypeScript, Python, C#, Java and Rust, producing the…relativehas no error codes in any port); twin-comparison.txt (TypeScript view SQL, Rust and Python generated output identical)..::path in @from, @Of, aggregate @via or passthrough @via that climbs above the root package is refused with ERR_BAD_ATTR_VALUE in all five portsoverdrop-*cases); overdrop-messages.txt..::paths (unknown field, unknown hop, binding the nearer decoy, missing field, owner or hop, trailing dot in @from, bare..::) are refused with ERR_INVALID_ORIGIN in all five ports; the t…scripts/ci-local.sh --affected --strict-toolchainsBaseline: broad regression came from the configured test commandscripts/ci-local.sh --affected --strict-toolchains, which already ran and passed at the target commit. It was not re-run because no source or test files were changed in this turn.Wrote a fresh multi-package model with the projection inacme::shop::views, two-level..::..::references, a two-hop@via, and a same-named decoy entity one package nearer, plus apkg::twin and 13 broken variants (gen-fixtures.py)Loaded all 15 cases in five ports: TypeScriptmeta schema --dialect postgres, Pythonmetaobjects verify --templates, C#dotnet meta verify --templates, JavaMetaDataLoader.fromDirectorythrough a throwaway probe, Rustcargo meta verifyCompared..::andpkg::output: TypeScriptmeta schemaview SQL, Rustcargo meta gen, Pythonmetaobjects genwith entity, names, filter-allowlist and routes (decoy package removed for Python)Loaded the qualifiedacme::Week.days.trailing-dot variant in Java and TypeScript to see whether the Java leniency also affects the qualified form🔧 Fix applied.
✅ Re-checked - no issues remain.
..::Entity.field(including a multi-hop path), and it loads like the qualifiedpkg::form in TypeScript, Python, C#, Rust, Java…relativeandqualifiedcases load clean on all six surfaces; r2-relative-schema.sql: TypeScript view SQL is byte-identical between the two..::andpkg::, on passthrough and aggregate) is refused with ERR_INVALID_ORIGIN in every port including Java and Kotlin, and two broken origins are…scripts/ci-local.sh --affected --strict-toolchainsBroad regression came from the configured test commandscripts/ci-local.sh --affected --strict-toolchains, which had already passed at this target commit; it was not re-run, and no source or test files changed in this turnGenerated synthetic multi-package models withgen-fixtures-r2.py(a nearer-package decoyProgram, a..::model, itspkg::twin and malformed variants), plus the input offixtures/conformance/error-origin-via-trailing-dotmeta schema --dialect postgres(TypeScript source CLI) on every casemetaobjects verify --templates(Python) on every casedotnet MetaObjects.Cli.dll verify <dir> --templates(C#) on every casecargo build --offline -p metaobjects-cli, thencargo-meta verify --templates(Rust) on every caseA disposable Java probe callingMetaDataLoader.fromDirectoryand the Kotlinmetadata-ktxloadDirectoryagainst the built classes, on every generated caseFull error lists for the two-broken-origins models through the Java loader and TypeScriptMetaDataLoader.fromDirectory; the Python, C# and Rust CLIs print both errors themselvesByte comparison of themeta schemaview SQL from the..::model and itspkg::twindocs/llms/llms-full.txt:136- docs/llms/llms-full.txt still says 'metamodel (conformance/, 584 fixtures)'. The file is regenerated by the release flow (scripts/finish-release.mjs), not by this change, so it is left for that flow.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.