Bound concurrent section work and finalize proposal identities in order

This commit is contained in:
2026-11-16 14:53:14 +00:00
parent 1c43264f6f
commit b98d463958
11 changed files with 739 additions and 240 deletions

View File

@@ -22,3 +22,24 @@ type InteractionArtifacts struct {
ResponsePayloadPath string `json:"response_payload_path,omitempty"`
ErrorPayloadPath string `json:"error_payload_path,omitempty"`
}
// IndexedInteraction builds an artifact after the section's ordered proposal
// indices and paths from earlier interactions are available.
type IndexedInteraction func(offset int, resolvePath func(string) string) Interaction
func WriteIndexedInteraction(sink InteractionSink, build IndexedInteraction) (InteractionArtifacts, error) {
if deferred, ok := sink.(interface {
WriteIndexedInteraction(IndexedInteraction) (InteractionArtifacts, error)
}); ok {
return deferred.WriteIndexedInteraction(build)
}
return sink.WriteInteraction(build(0, func(path string) string { return path }))
}
func OffsetProposalIndex(index *int, offset int) *int {
if index == nil || offset == 0 {
return index
}
next := *index + offset
return &next
}