From f069a10c780c4b479df3e5e61fb152f8b590f155 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sun, 22 Nov 2026 09:49:08 +0000 Subject: [PATCH] Assemble lane results in chunk order without sorting --- docs/roadmap/remediation.md | 32 ++++++++++++++++++- .../framework/pipeline/runner_concurrent.go | 9 ++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index f2c5b78d..283d5684 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -21,7 +21,8 @@ is substantially complete. Findings 1–2 come from the initial review. Findings Finding 1 come from a stage-ordered algorithmic pass. The latter are refactoring opportunities for consideration, not measured production bottlenecks or new performance guarantees. None calls for another compatibility layer or application -execution abstraction. This document records findings, not implemented fixes. +execution abstraction. The evidence below describes the reviewed baselines; +per-finding completion markers record the subsequent remediation work. ## Finding 1: Retain Genuine Native Timeouts During Concurrent Error Selection @@ -460,6 +461,11 @@ add a mixed-resource case only if needed to verify equivalent mask routing. ## Finding 9: Traverse Dense Chunk Results Without Sorting Their Keys +**Status: Complete.** Lane assembly traverses the materializer's dense ordinals +directly, retaining artifact/diagnostic order, fallback counts, and reuse +eligibility without allocating or sorting a temporary key slice. Pipeline +concurrency/ready-job tests and race checks pass. + Priority: P3. Relevant stages: 11, 25, and 37. ### Evidence And Complexity @@ -575,3 +581,27 @@ production model quality or performance. Intentional changes such as the hard configuration/CLI cutover, native retry ownership, content-only cache identity, no semantic reassessment on hits, explicit permissive fallback, and native diagnostic visibility are part of the agreed target, not regressions. + +## Remediation Completion + +All nine findings are addressed in focused commits, with completion markers at +their owning findings above. Final verification after the code changes passed: + +- `GOWORK=off GOPROXY=off go test ./...`. +- `GOWORK=off GOPROXY=off go vet ./...`. +- A fresh `GOWORK=off GOPROXY=off go build` to a temporary binary. +- Race tests for `internal/framework/pipeline`, `internal/framework/chunkmap`, + `internal/core/source`, `internal/cli`, and + `internal/modules/dnd/extract/scenedescriptions`. +- Executable `version`, offline pipeline validation of both maintained D&D + examples, and native spell prompt-requirements inspection. +- `git diff --check`, this document's local link destinations, and the affected + configuration-reference anchors. + +The scene-cache regression covers both repartitioning directions, bypass +controls, current IDs, actual reuse without reassessment, and unusable hits. +The fallback regression exercises a real typed spell pipeline with a fake long +provider failure; focused checks retain full causes and module diagnostics. +Source/cache/capture regressions cover nonmonotonic unit order, concurrent hits, +and exact sensitivity routing without native snapshot mutation. No production +inference, new permanent validation gate, or performance guarantee was added. diff --git a/internal/framework/pipeline/runner_concurrent.go b/internal/framework/pipeline/runner_concurrent.go index f0e60fab..6c88861d 100644 --- a/internal/framework/pipeline/runner_concurrent.go +++ b/internal/framework/pipeline/runner_concurrent.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "path" - "sort" "strings" "sync" "time" @@ -333,12 +332,8 @@ func (r *Runner) runExtractJob(ctx context.Context, input RunInput, doc *source. } func finalizeLaneExtract(state *laneExtractState) { - indexes := make([]int, 0, len(state.results)) - for index := range state.results { - indexes = append(indexes, index) - } - sort.Ints(indexes) - for _, index := range indexes { + // Materialization assigns dense ordinals; finalization follows all lane jobs. + for index := 0; index < len(state.results); index++ { result := state.results[index] state.values = append(state.values, result.value) state.diagnostics = append(state.diagnostics, result.diagnostics...)