You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
validate_no_field_redeclaration always blames the immediate extends parent, not the true declaring ancestor #2871
Surfaced during review of PR #2866 (core#2829 — ADR-078 extends-chain shadowing enforcement).
Problem
validate_no_field_redeclaration (packages/core/src/schema/mod.rs) resolves the full effective field set via resolve_effective_fields, which returns only a flat Vec<SchemaField> with no per-field ownership tracking. When a field collision is found, the error unconditionally names parent_id (the immediate extends parent passed into the function) as the schema that "already declared" the field — even when the actual declaring schema is a grandparent or further ancestor.
Example: Task declares status. Mid extends Task (no own fields). Leaf extends Mid and tries to declare status. The error says "already declared by 'mid'" when Mid doesn't declare it at all — it's declared two levels up, on Task.
This is the same defect class that was just fixed on the relationship side in PR #2866 (validate_no_relationship_redeclaration, which now uses NodeService::resolve_relationships's owner map to name the true declaring schema).
Suggested approach
NodeService::resolve_field_owners (packages/core/src/services/node_service/schema.rs) already exists and returns (effective_fields, field_name -> owning_schema_id, chain) — the field-side analog of resolve_relationships's owner map. validate_no_field_redeclaration currently goes through the package-local resolve_effective_fields (which discards ownership) instead. Switching it to use resolve_field_owners's owner map, mirroring the relationship-side fix, would close this gap.
Impact
Cosmetic/diagnostic only — the redeclaration is still correctly rejected either way, just with a misleading "which schema owns this" detail in the error message. Not a correctness or security issue.
Activity
mstomar125 commentedon Sep 23, 2026
Frontend: 5264 passed
Fix validate_no_field_redeclaration blaming the wrong ancestor
Fix validate_no_field_redeclaration blaming the wrong ancestor (#2906)