Commit 7609c87
* test(gate): RED tripwires for inherit-without-restate codegen bug (#56)
Two failing gates (RED until #56 is fixed) asserting codegen reads INHERITED attrs via
the effective accessor, not own-only:
- TS (codegen-ts): an identity.primary that inherits @fields via node-level extends
without restating it must still yield a primary key. pk-resolver reads
primary.ownAttr(@fields) → undefined → the entity is dropped from the PK map → no PK.
- Python (codegen): a field that inherits @required via extends (abstract-field reuse)
must generate as a REQUIRED Pydantic field, not Optional. entity_model reads
field.attr(@required) — which in this port is OWN-ONLY despite the name — so the
inherited @required is invisible and `label: str | None = None` is wrongly emitted.
Both assert the CORRECT behavior and turn green when the ownAttr→attr fix lands (see #56
for the full cross-port inventory). Intentional RED tripwire PR — do not merge until #56
is fixed; then these become the permanent regression gate.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(gate): add Kotlin tripwire for inherit-without-restate (#56)
Kotlin (codegen-kotlin): a field that inherits @maxlength via extends (abstract-field
reuse) without restating it must emit varchar with the inherited length, but
KotlinTypeMapper reads @maxlength own-only → falls back to the 255 default. Confirmed
RED: emits varchar("label", 255) for an inherited @maxlength=80.
Completes the confirmed-port coverage (Python + Kotlin) alongside the latent TS edge.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(codegen): read inherited attributes via the effective accessor, not own-only (#56)
Completes the #56 fix across the three affected ports (the gates in this PR now pass).
Builds on #55, which fixed the TS *field*-attr reads.
- TS (codegen-ts): identity @fields/@generation/@unique reads switched ownAttr → attr
(pk-resolver, drizzle-schema, zod-validators, queries, docs-data-builder). #55 fixed
field reads but not identity reads, so a BaseEntity-inherited PK was still dropped.
- Python (codegen): ~17 field-attr reads switched field.attr(X) → field.attrs().get(X).
Python's attr() is OWN-ONLY despite the name (the footgun); attrs() is the effective
map. Covers @required/@maxLength/@objectRef/@default/@values/@isArray/@filterable/
@enumAlias/@enumDoc/@column. (Validator/origin/template reads left own — correct as-is.)
- Kotlin (codegen-kotlin): field-attr reads switched getMetaAttr/hasMetaAttr(..., false)
→ (..., true) for @maxLength/@storage/@objectRef/@filterable (TypeMapper,
ExposedTableGenerator, EntityGenerator, RenderHelperGenerator, FilterAllowlist).
Node-level reads (identity/relationship via effective iterators) and the validation
reference-walk (validate-at-declaration) are deliberately left own-only.
Gates green: TS codegen-ts 883 + react/tanstack 69 + whole-workspace typecheck clean;
Python 1207; Kotlin codegen-kotlin 35. C# and Java codegen need no change (their attr
accessors already default effective / inherit whole nodes).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0e8af0c commit 7609c87
23 files changed
Lines changed: 205 additions & 43 deletions
File tree
- server
- java/codegen-kotlin/src
- main/kotlin/com/metaobjects/generator/kotlin
- test/kotlin/com/metaobjects/generator/kotlin
- python
- src/metaobjects/codegen
- generators
- tests/codegen
- typescript/packages/codegen-ts
- src
- generators
- templates
- test
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | | - | |
| 224 | + | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
489 | | - | |
490 | | - | |
| 489 | + | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
495 | | - | |
496 | | - | |
| 495 | + | |
| 496 | + | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
| 170 | + | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
| 257 | + | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| |||
Lines changed: 47 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 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
0 commit comments