Skip to content

fix(java): M:N resolvers resolve FQN exactly (ADR-0041 follow-up)#175

Merged
dmealing merged 1 commit into
mainfrom
fix/xpkg-m2n-java
Jul 5, 2026
Merged

fix(java): M:N resolvers resolve FQN exactly (ADR-0041 follow-up)#175
dmealing merged 1 commit into
mainfrom
fix/xpkg-m2n-java

Conversation

@dmealing

@dmealing dmealing commented Jul 5, 2026

Copy link
Copy Markdown
Member

Follow-up to #173. A cross-port code review found the Java M:N runtime/derivation resolvers still carried the exact bare-tail FQN mis-bind bug ADR-0041 closes — the same class as the confirmed bug, in the M:N path, Java-only (TS/Kotlin/C#/Python M:N were already FQN-safe).

  • M2MFields (the cross-port FK-derivation SSOT): findObject stripped an FQN to its bare tail; isSelfJoin/findRefToEntity compared stripped tails → a cross-package hetero M:N with a same-named entity mis-classified as a self-join / bound the wrong junction reference.
  • omdb runtime M2MResolver.mustGetEntity: same stripPackage-then-short-name match on the FQN @objectRef/@through.

Fix (mirrors the SpringM2mSupport fix from #173): resolve to an object FQN-exact, classify self-join / match junction references by resolved object identity, never a stripped tail. Bare/same-package behavior unchanged (broader bare-collision same-package preference stays #174).

Gated: new xpkg-m2n-collision conformance fixture (loads + round-trips the cross-package same-named M:N cross-port — TS 422 / Java 422 / Python 324 / C# 712) plus Java unit tests in M2MSlimVocabularyTest (16/0) that assert M2MFields.derive binds the correct package — because the canonical serializer doesn't surface derive's result, the unit tests are the actual derive gate. ADR-0041 Consequences corrected.

🤖 Generated with Claude Code

…ollision fixture

Follow-up to PR #173. A code review found the Java M:N runtime/derivation
resolvers still carried the exact bare-tail FQN mis-bind bug ADR-0041 closes
(the same class as the confirmed bug, in the M:N path, Java-only — TS/Kotlin/C#/
Python M:N were already FQN-safe):
- metadata M2MFields (the cross-port FK-derivation SSOT): findObject stripped an
  FQN to its bare tail and matched getShortName(); isSelfJoin / findRefToEntity
  compared stripped bare tails — so a cross-package hetero M:N with a same-named
  entity mis-classified as a self-join / bound the wrong junction reference.
- omdb runtime M2MResolver.mustGetEntity: same stripPackage-then-short-name match
  on the FQN @objectRef/@through at runtime traversal.

Fix (mirrors the SpringM2mSupport fix from #173): resolve the @objectRef/@through
to an object FQN-exact (an FQN matches getName() exactly, never a bare-tail
fallback), and classify self-join / match junction references by RESOLVED object
identity, never a stripped tail. Bare-name/same-package behavior unchanged (the
broader bare-collision same-package preference stays #174).

Gated: new conformance fixture xpkg-m2n-collision (a cross-package M:N where the
target + junction share a bare name with entities in other packages, referenced
by FQN) — a bare-tail match would bind the wrong package. Expected generated from
the TS oracle. Green in all metamodel-conformance ports: TS 422, Java 422,
Python 324, C# 712 (Kotlin rides the shared Java loader). ADR-0041 Consequences
corrected to name the files actually changed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ew1XfYSbEAezxjs9opynAe
@dmealing
dmealing merged commit 2bb188c into main Jul 5, 2026
1 check passed
@dmealing
dmealing deleted the fix/xpkg-m2n-java branch July 5, 2026 17:23
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