Commit 46d8e54
The shipped Kotlin generated Spring controller did its own inline Exposed writes
with zero @autoset awareness — so an adopter deploying it silently lost the
timestamp-stamping FR (#203 shipped it only in KotlinRepositoryGenerator, which
the controller never uses). Surfaced while scoping the cross-port @autoset gate.
ADR-0045 records the durable rule: the generated API surface (the controller/routes
an adopter deploys) must itself guarantee every metamodel write semantic — no
consumer-supplied seam may sit between the guarantee and the wire. Persistence-layer
stamping stays as defense-in-depth for non-HTTP writes.
KotlinSpringControllerGenerator now:
- insert stamps BOTH onCreate + onUpdate columns from ONE captured now()-val per
temporal type (a fresh row's createdAt == updatedAt exactly), ignoring the caller;
- @autoset columns are excluded from the PATCH-settable set (a caller can no longer
overwrite createdAt/updatedAt);
- a patch bumps every onUpdate column on EVERY request (even an empty body) and never
rewrites onCreate;
- byte-identical output for entities with no @autoset field (snapshot suite 14/14).
nowExpr hoisted to KotlinTypeMapper (the type->"Type.now()" mapping's natural home;
no circular dep, unlike KotlinGenUtil). New controller-level @autoset tests in
KotlinAutoSetStampingTest (11/11). TPH+@autoset controller stamping is a documented
follow-up (not exercised by the corpus; no existing test covers it).
This is the Kotlin leg of the ADR-0045 rollout; the Python router leg and the shared
api-contract @autoset gate follow (no scenario lands here, so no lane reds).
Refs #203, #229.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XeGSV3StPCcJGZNNJ4ZfAb
1 parent e34d371 commit 46d8e54
4 files changed
Lines changed: 156 additions & 2 deletions
File tree
- server/java/codegen-kotlin/src
- main/kotlin/com/metaobjects/generator/kotlin
- test/kotlin/com/metaobjects/generator/kotlin
- spec/decisions
Lines changed: 50 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
186 | 209 | | |
187 | 210 | | |
188 | 211 | | |
| |||
398 | 421 | | |
399 | 422 | | |
400 | 423 | | |
| 424 | + | |
| 425 | + | |
401 | 426 | | |
402 | 427 | | |
403 | 428 | | |
| |||
412 | 437 | | |
413 | 438 | | |
414 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
415 | 446 | | |
416 | 447 | | |
417 | 448 | | |
| |||
449 | 480 | | |
450 | 481 | | |
451 | 482 | | |
| 483 | + | |
452 | 484 | | |
453 | 485 | | |
454 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
455 | 490 | | |
456 | 491 | | |
457 | 492 | | |
| |||
502 | 537 | | |
503 | 538 | | |
504 | 539 | | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
505 | 545 | | |
506 | 546 | | |
507 | 547 | | |
| |||
516 | 556 | | |
517 | 557 | | |
518 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
519 | 567 | | |
520 | 568 | | |
521 | 569 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
657 | 671 | | |
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
173 | 223 | | |
174 | 224 | | |
175 | 225 | | |
| |||
Lines changed: 42 additions & 0 deletions
| 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 | + | |
0 commit comments