Problem
Currently, the schema validation only checks individual node properties, not parent-child relationships. This means invalid hierarchies like:
- Solutions with solution parents (should require opportunity parents)
- Experiments with opportunity parents (should require solution parents)
These pass schema validation because the schema only checks that is a valid wikilink, not what type of node it references.
Context
The strict_ost schema (#15) defines a canonical 4-level hierarchy:
- outcome → no parent (root level)
- opportunity → parent must be outcome
- solution → parent must be opportunity
- experiment → parent must be solution
The schema currently cannot enforce these constraints because JSON Schema validates individual objects, not relationships between objects.
Proposed Solution
Add a post-schema validation step that:
- Builds a type index (title → type mapping) for all nodes
- For each node with a parent:
- Resolve the parent reference (using existing logic)
- Check if the parent's type is valid for the child's type
- Report hierarchy violations as validation errors
This would be similar to the existing dangling reference check, but with type-aware validation.
Implementation Notes
- The hierarchy rules should be defined in the schema's
._metadata object (already exists for strict_ost)
- Should work with both
readSpaceDirectory and readSpaceOnAPage
- Rules should be per-schema (general.json allows more flexibility, strict_ost is rigid)
- Could be integrated into the existing
validate command
Acceptance Criteria
Problem
Currently, the schema validation only checks individual node properties, not parent-child relationships. This means invalid hierarchies like:
These pass schema validation because the schema only checks that is a valid wikilink, not what type of node it references.
Context
The strict_ost schema (#15) defines a canonical 4-level hierarchy:
The schema currently cannot enforce these constraints because JSON Schema validates individual objects, not relationships between objects.
Proposed Solution
Add a post-schema validation step that:
This would be similar to the existing dangling reference check, but with type-aware validation.
Implementation Notes
._metadataobject (already exists for strict_ost)readSpaceDirectoryandreadSpaceOnAPagevalidatecommandAcceptance Criteria