Repository navigation
Commit bb4cac2
fix(codegen-kotlin): #368 — port the referential-action correlation fix
KotlinExposedTableGenerator still had the defect migrate-ts/referential-actions.ts
and the C# ReferentialActions port were fixed for, so this branch left the ports
DISAGREEING where they had previously been consistently wrong.
Tier 2 matched a sibling relationship on the TARGET ALONE
(`firstOrNull { resolveObjectByShortOrFqn(...) === target }`), so with
Match.homeTeamRef (@onDelete: restrict) and Match.awayTeamRef (@onDelete: cascade)
both FKs were emitted with the FIRST relationship's action. Tier 3 took
`firstOrNull` on the reverse relationship where TS/C# now fail closed.
The port is a direct inversion, not a parallel rule: Kotlin is on the JVM and
RelationshipReferences.resolveRelationshipReference is already on the classpath, so
tier 2 now asks whether the ladder applied to `rel` resolves back to `ref` ITSELF,
and tier 3 returns `singleOrNull()` over the reverse candidates.
KotlinExposedTableTwoRefsTest covers both tiers and was verified to FAIL on the
pre-fix generator (both tests red, with the wrong ReferenceOption in the emitted
MatchTable). Full codegen-kotlin suite: 377 tests, 0 failures.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lfd8nat1WcSpXffd8YetiC1 parent 423959e commit bb4cac2
2 files changed
Lines changed: 166 additions & 8 deletions
File tree
- server/java/codegen-kotlin/src
- main/kotlin/com/metaobjects/generator/kotlin
- test/kotlin/com/metaobjects/generator/kotlin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
1576 | 1577 | | |
1577 | 1578 | | |
1578 | 1579 | | |
1579 | | - | |
1580 | | - | |
1581 | | - | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
1582 | 1587 | | |
1583 | 1588 | | |
1584 | 1589 | | |
| |||
1609 | 1614 | | |
1610 | 1615 | | |
1611 | 1616 | | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1612 | 1630 | | |
1613 | 1631 | | |
1614 | | - | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
1615 | 1635 | | |
1616 | 1636 | | |
1617 | 1637 | | |
| |||
1651 | 1671 | | |
1652 | 1672 | | |
1653 | 1673 | | |
1654 | | - | |
| 1674 | + | |
1655 | 1675 | | |
1656 | 1676 | | |
1657 | | - | |
| 1677 | + | |
| 1678 | + | |
1658 | 1679 | | |
1659 | 1680 | | |
1660 | 1681 | | |
| |||
1670 | 1691 | | |
1671 | 1692 | | |
1672 | 1693 | | |
1673 | | - | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
1674 | 1703 | | |
1675 | 1704 | | |
1676 | | - | |
| 1705 | + | |
1677 | 1706 | | |
1678 | 1707 | | |
1679 | 1708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
0 commit comments