Project incoming source destinations through tier operations

This commit is contained in:
2026-10-24 00:05:24 +00:00
parent a035df9845
commit f7624ae92a
6 changed files with 180 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ func projectTierHistoryApplications(applications []historyApplication, operation
projected := cloneHistoryApplications(applications)
for index, original := range applications {
application := &projected[index]
if path, found := projectSequenceHistoryPath(original.path, projections); found {
if path, found := projectSequenceOperationPath(original.path, projections); found {
application.path = path
}
for sequenceIndex, source := range original.sequences {
@@ -55,7 +55,7 @@ func projectTierHistoryApplications(applications []historyApplication, operation
return projected
}
func projectSequenceHistoryPath(path Path, projections map[string]sequenceHistoryContributionIndex) (Path, bool) {
func projectSequenceOperationPath(path Path, projections map[string]sequenceHistoryContributionIndex) (Path, bool) {
projected := path.clone()
for index, segment := range path.segments {
if segment.kind != pathSegmentIndex {
@@ -74,3 +74,34 @@ func projectSequenceHistoryPath(path Path, projections map[string]sequenceHistor
}
return projected, true
}
// Project only incoming sources. Lower/displaced sources retain the coordinates
// of their own historical contribution, rather than becoming incoming survivors.
func projectTierSourceDestinations(sources []SourceInfo, versions []*sourceVersionEvidence, operations []sequenceHistoryContribution) {
if len(operations) == 0 {
return
}
projections := indexSequenceHistoryContributions(operations)
for index := range sources {
if path, found := projectSequenceOperationPath(sources[index].Destination, projections); found {
sources[index].Destination = path
}
}
for _, evidence := range versions {
if evidence == nil {
continue
}
paths := evidence.sensitivityPaths()
projected := make([]Path, len(paths))
for index, path := range paths {
projected[index] = path.clone()
if destination, found := projectSequenceOperationPath(path, projections); found {
projected[index] = destination
}
}
evidence.projectedPaths = projected
if path, found := projectSequenceOperationPath(evidence.destination, projections); found {
evidence.destination = path
}
}
}