Index explanation selections once per query

This commit is contained in:
2026-10-27 03:15:01 +00:00
parent 1448f9b19d
commit b281adb751
4 changed files with 68 additions and 43 deletions

View File

@@ -2,7 +2,7 @@ package engine
import "gitea.maximumdirect.net/eric/ConfigKit/internal/document"
func appendInheritanceExplanation(explanation *Explanation, working **document.Node, query Path, model *historyModel, selections []historySelection, secrets map[string]bool) {
func appendInheritanceExplanation(explanation *Explanation, working **document.Node, query Path, model *historyModel, selections historyReplaySelections, secrets map[string]bool) {
if model == nil {
return
}
@@ -10,7 +10,7 @@ func appendInheritanceExplanation(explanation *Explanation, working **document.N
for operationIndex, operation := range payload.operations {
if operation.control != nil {
ref := historyPayloadRef{phase: historyPhaseInheritance, id: 0, substep: operationIndex * 2}
selection, selected := historySelectionForPayload(selections, ref)
selection, selected := selections.byPayload[ref]
if !selected {
continue
}
@@ -25,8 +25,8 @@ func appendInheritanceExplanation(explanation *Explanation, working **document.N
}
parentRef := historyPayloadRef{phase: historyPhaseInheritance, id: 0, substep: operationIndex * 2}
childRef := historyPayloadRef{phase: historyPhaseInheritance, id: 0, substep: operationIndex*2 + 1}
parentSelection, hasParent := historySelectionForPayload(selections, parentRef)
childSelection, hasChild := historySelectionForPayload(selections, childRef)
parentSelection, hasParent := selections.byPayload[parentRef]
childSelection, hasChild := selections.byPayload[childRef]
before := valueSnapshot(*working, query, secrets)
replaceHistoryPath(working, operation.transfer.to, operation.parent)
// A record keeps its own identity throughout inheritance. Restore it