Commit 61dee8e
committed
fix(metadata): ADR-0039 — resolving accessors are the default (Python port)
extends is a super-REFERENCE, not a flatten: inherited attrs/children/isArray
live on the parent, reachable only through the resolving accessors. Reading an
effective property or member set through an own-only accessor silently dropped
everything inherited via extends. Python's naming is INVERTED vs TS/Java —
attr(name) is OWN-ONLY, attrs().get(name) resolves — so this port both fixes the
own reads and makes the resolving form the obvious/default-named call.
Naming (the durable hardening): a full attr()->own_attr() rename was too invasive
(148 call sites, many legitimately own-only in the loader-validation of authored
declarations, plus the own-mode serializer/merge which already use own_meta_attrs/
own_children — NOT attr()). Instead:
- added MetaData.get_meta_attr(name) — the RESOLVING attr read (own + inherited
via the super chain); the default read to prefer for any effective property.
- added MetaData.resolved_is_array() — isArray is a native boolean property (not
an attr), so it resolves the native flag through the super chain OR the loaded
@isarray attr. Mirrors the TS resolvedIsArray().
- re-documented attr() LOUDLY as OWN-ONLY, calling out the TS/Java inversion and
naming the only sanctioned own uses (own-mode serialize, overlay/merge + super
walks, validating the own declaration, @dbColumnType).
Fixed effective-property reads (own -> resolving):
- meta_field.object_ref: attr()->get_meta_attr (unifies with codegen attrs().get
@objectref — both now resolve).
- codegen fr010_field_mapping: is_array->resolved_is_array; coerceDefault/default/
normalize (_attr_string) -> get_meta_attr.
- codegen type_map.field_is_array + template_codegen/template_data (isArray/
required/maxLength) -> resolving.
- codegen fr019_shared_enum.is_provided (@provided) -> get_meta_attr.
- runtime object_manager: identity @fields (PK lookup), @localTime, @column,
field-is-array -> resolving; @dbColumnType kept own-only (commented — the one
deliberately never-inherited attribute).
- loader validation_passes: field.object @objectRef/@storage/isArray + field.map
@valueType/@objectref + effective-children iteration -> resolving (a concrete
field.object inheriting @objectref from an abstract parent no longer falsely
trips ERR_OBJECT_FIELD_WITHOUT_OBJECT_REF). The own-declaration validators
(@values / @default / @dbColumnType membership) stay own-only, commented.
- serializer_json: EFFECTIVE mode now resolves isArray through the super chain;
own mode still emits the authored flag (round-trips the extends tree).
KEPT own-only (each commented): the sanctioned emit-declared-here case
(EntityModelGenerator.own_fields, pinned by test_entity_model.py — a Contact
subclass extends the generated BaseEntity and does NOT re-emit inherited id/
createdAt); the own-mode canonical serializer; overlay/merge + TPH discriminator
super-resolution walks; the loader's validate-the-own-declaration passes; and the
physical @dbColumnType.
The shared cross-port fixture fixtures/conformance/extends-abstract-field-
inheritance (unchanged) now passes — the effective serializer previously dropped
the inherited isArray:true on tags/addresses. New Python codegen gate
(test_extends_abstract_field_inheritance.py) asserts a concrete field extending an
abstract array/decimal/object field, and an entity inheriting fields via
BaseEntity, generate correctly (list[str] / list[Address] / Decimal / subclass-
emit). Existing goldens unchanged for non-abstract-extends inputs (full non-
integration suite green except 2 pre-existing, unrelated staleness-nudge failures).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GF9xLEQZaPus5Y6opk398n1 parent d62aab5 commit 61dee8e
10 files changed
Lines changed: 212 additions & 40 deletions
File tree
- server/python
- src/metaobjects
- codegen
- generators
- template_codegen
- loader
- meta
- core/field
- runtime
- tests/codegen
Lines changed: 18 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | | - | |
74 | | - | |
| 78 | + | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | | - | |
79 | | - | |
| 83 | + | |
| 84 | + | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
86 | | - | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
90 | | - | |
| 95 | + | |
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2108 | 2108 | | |
2109 | 2109 | | |
2110 | 2110 | | |
2111 | | - | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
2112 | 2115 | | |
2113 | 2116 | | |
2114 | 2117 | | |
| |||
2120 | 2123 | | |
2121 | 2124 | | |
2122 | 2125 | | |
2123 | | - | |
| 2126 | + | |
2124 | 2127 | | |
2125 | 2128 | | |
2126 | | - | |
| 2129 | + | |
2127 | 2130 | | |
2128 | 2131 | | |
2129 | 2132 | | |
| |||
2163 | 2166 | | |
2164 | 2167 | | |
2165 | 2168 | | |
2166 | | - | |
2167 | | - | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
2168 | 2174 | | |
2169 | 2175 | | |
2170 | 2176 | | |
2171 | | - | |
| 2177 | + | |
2172 | 2178 | | |
2173 | | - | |
| 2179 | + | |
2174 | 2180 | | |
2175 | 2181 | | |
2176 | 2182 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
47 | 52 | | |
48 | | - | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
125 | 139 | | |
126 | 140 | | |
127 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
128 | 173 | | |
129 | 174 | | |
130 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
563 | 562 | | |
564 | 563 | | |
565 | 564 | | |
566 | | - | |
| 565 | + | |
567 | 566 | | |
568 | 567 | | |
569 | 568 | | |
| |||
645 | 644 | | |
646 | 645 | | |
647 | 646 | | |
648 | | - | |
649 | | - | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
650 | 651 | | |
651 | 652 | | |
652 | 653 | | |
653 | 654 | | |
654 | 655 | | |
655 | 656 | | |
| 657 | + | |
| 658 | + | |
656 | 659 | | |
657 | 660 | | |
658 | 661 | | |
| |||
684 | 687 | | |
685 | 688 | | |
686 | 689 | | |
687 | | - | |
| 690 | + | |
688 | 691 | | |
689 | 692 | | |
690 | 693 | | |
| |||
718 | 721 | | |
719 | 722 | | |
720 | 723 | | |
721 | | - | |
| 724 | + | |
722 | 725 | | |
723 | 726 | | |
724 | 727 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| |||
0 commit comments