Replay explanations through shared history selections

This commit is contained in:
2026-10-26 17:01:32 +00:00
parent 4b4e15fc58
commit 738c8a9cc7
12 changed files with 386 additions and 135 deletions

View File

@@ -76,14 +76,17 @@ func (builder *historyBuilder) observeCLIEvidence(applications []historyApplicat
}
index := new(mappingIndex)
for item := 0; item < count; item++ {
var applicationRef historyPayloadRef
hasApplication := false
if item < len(applications) {
application := applications[item]
payload := builder.addCLIPayload(&application, nil)
applicationRef = builder.addCLIPayload(&application, nil)
hasApplication = true
walkHistoryApplication(application, func(_, effective Path, node *document.Node) {
origin := sourceApplicationOrigin(application, node)
attribution := builder.addAttribution(origin, nil, nil)
builder.addObservation(historyObservation{
path: effective, phase: historyPhaseCLI, payload: payload,
path: effective, phase: historyPhaseCLI, payload: applicationRef,
reportedPath: effective, role: historyRoleContribution,
afterPresent: true, sensitive: node.Sensitive,
attributionRef: attribution,
@@ -94,6 +97,11 @@ func (builder *historyBuilder) observeCLIEvidence(applications []historyApplicat
if item < len(records) {
record := records[item]
payload := builder.addCLIPayload(nil, &record)
if hasApplication {
owned := &builder.model.cliPayloads[payload.id]
owned.applicationRef = applicationRef
owned.hasApplicationRef = true
}
attribution := builder.addAttribution(record.change.Origin, nil, nil)
for _, displaced := range record.displaced {
builder.addObservation(historyObservation{