Clarify filesystem directive and override ownership

This commit is contained in:
2026-09-07 01:10:21 +00:00
parent 1cc645f30f
commit 75a5829132
13 changed files with 657 additions and 610 deletions

View File

@@ -64,3 +64,23 @@ func documentAtPath(root *document.Node, path Path) (*document.Node, bool) {
}
return current, true
}
// countInputNodes includes mapping-key nodes, unlike walkDocument's value-only
// traversal. Aggregate source budgets charge every input occurrence.
func countInputNodes(node *document.Node) int {
if node == nil {
return 0
}
count := 1
if node.Kind == document.Mapping {
count += len(node.Mapping)
for _, entry := range node.Mapping {
count += countInputNodes(entry.Value)
}
} else if node.Kind == document.Sequence {
for _, child := range node.Sequence {
count += countInputNodes(child)
}
}
return count
}