Skip to content

Commit faeac88

Browse files
dmealingclaude
andcommitted
fix(java,python): pre-merge review — own-only vs effective + missing parens
Two surgical correctness fixes caught by the pre-merge code-review gate. Both were latent against the current corpus but real: 1. ValidationPhase.validateDataGridLayout used getChildren(MetaField.class, false) — own-only iteration. TS/C# use effective. A child entity with `layout.dataGrid @defaultSortField: "createdAt"` (inherited from the BaseEntity pattern CLAUDE.md actively recommends) would false-positive ERR_BAD_DEFAULT_SORT_FIELD in Java only. Two-char flip false→true. 2. expected_schema._matching_relationship_actions accessed child.object_ref and child.on_update as ATTRIBUTES, but they're METHODS on MetaRelationship. The bound-method objects are truthy, so the subsequent _strip_pkg(ref) would call .rfind on a method object and AttributeError. The corpus never reaches this branch today (relationships sit on parent entities, references on children), so the bug is dormant — but blows up on the first same-entity relationship+reference fixture. Add missing parens. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c43e15c commit faeac88

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

server/java/metadata/src/main/java/com/metaobjects/loader/ValidationPhase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static void validateDataGridLayouts(MetaRoot root) {
798798
private static void validateDataGridLayout(MetaObject obj, DataGridLayout grid) {
799799
java.util.Map<String, MetaField> fieldsByName = new java.util.HashMap<>();
800800
java.util.Set<String> filterable = new java.util.HashSet<>();
801-
for (MetaField f : obj.getChildren(MetaField.class, false)) {
801+
for (MetaField f : obj.getChildren(MetaField.class, true)) {
802802
fieldsByName.put(f.getShortName(), f);
803803
if (f.hasMetaAttr("filterable", false)) {
804804
Object v = f.getMetaAttr("filterable", false).getValue();

server/python/src/metaobjects/migrate/expected_schema.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _build_indexes(entity: MetaObject):
177177
if not fields:
178178
continue
179179
cols = tuple(_column_for(entity, n) for n in fields)
180-
unique_attr = child.attr("unique")
180+
unique_attr = child.attr(ic.IDENTITY_ATTR_UNIQUE)
181181
unique = unique_attr is not False # secondary is unique by default
182182
yield IndexDescriptor(name=child.name, columns=cols, unique=unique)
183183

@@ -247,11 +247,11 @@ def _matching_relationship_actions(entity: MetaObject, target_entity: str) -> tu
247247
for child in entity.children():
248248
if not isinstance(child, MetaRelationship):
249249
continue
250-
ref = child.object_ref
250+
ref = child.object_ref()
251251
if ref is None:
252252
continue
253253
if _strip_pkg(ref) == _strip_pkg(target_entity):
254-
return child.on_delete(), child.on_update
254+
return child.on_delete(), child.on_update()
255255
return None, None
256256

257257

@@ -274,7 +274,7 @@ def _identity_fields(identity: MetaIdentity) -> tuple[str, ...]:
274274

275275
def _column_of(field: MetaField) -> str:
276276
"""@column override else field name (matches C# Literal default; cross-port)."""
277-
col = field.attr("column")
277+
col = field.attr(fc.FIELD_ATTR_COLUMN)
278278
return col if isinstance(col, str) and col else field.name
279279

280280

0 commit comments

Comments
 (0)