Commit ba869c2
fix(#214): Kotlin write-through — exclude derived value-object columns; document re-read scope
Cross-port divergence audit follow-ups for the #214 fan-out (Kotlin).
- D3 (latent bug): KotlinExposedTableGenerator.buildObjectColumns iterated the
object/map fields with no derived filter, and its output was emitted for BOTH
the write `<Short>Table` and the read `<Short>View`, so a DERIVED (origin.*)
`field.object` / `field.map` became a phantom column on the write table —
declared but never written (create/patch skip derived) and never selected
(reads use the view). Latent for a nullable derived VO; a @required one would
break Exposed insert. Thread `excludeDerived` through buildObjectColumns
(mirroring the scalar-column loop's existing guard) so the write table drops
derived VO/map columns; the read view keeps them. Byte-identical for a vanilla
entity and the view (the guard is a no-op without a derived VO field).
- D1/D4 (documentation): the by-PK re-read keys on the SINGLE primary key (a
composite-PK write-through entity is out of scope — this repository already
skips composite PKs, matching the other ports) and uses Exposed `.single()`,
which assumes the replica view surfaces the just-written row (true for a plain
`@kind:view`; a `@kind:materializedView`/filtered replica throws — the data-
oriented ports degrade to the write row). Both noted in the generator and in
KNOWN_GAPS.
The remaining audit findings are architecture-driven, not bugs: a guaranteed-
non-null aggregate-derived field reads as nullable on the single-shape ports
(Java/Kotlin) vs non-null on the two-shape ports (TS/C#/Python) — the documented
cost of the shared read/create DTO; and Java's read→view routing lives in the
consumer repository (SQL-free port, ADR-0015). Recorded, not changed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGQ7oSuNcjhsMHWwZzhBwr1 parent b905527 commit ba869c2
3 files changed
Lines changed: 31 additions & 1 deletion
File tree
- server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
| 413 | + | |
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
| |||
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
709 | 715 | | |
710 | 716 | | |
711 | 717 | | |
| 718 | + | |
712 | 719 | | |
713 | 720 | | |
714 | 721 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
171 | 179 | | |
172 | 180 | | |
173 | 181 | | |
| |||
0 commit comments