Share the source index with validators

This commit is contained in:
2026-11-26 05:12:19 +00:00
parent 60e732bbe8
commit d66cfe3986
43 changed files with 191 additions and 68 deletions

View File

@@ -108,7 +108,11 @@ Campaign references and generated context can disambiguate or route work, never
supply new source evidence.
Extraction borrows the run's whole-source index for source ordering, grounding,
and scene fallback; standalone calls construct a local index when none is supplied.
and scene fallback. Validators reuse it for source-reference checks, citation
resolution, and applicable invariants; standalone calls construct a local index
when none is supplied. `DocumentIndexForSource` and
`NewCitationResolverForSource` in [shared helpers](../../internal/modules/dnd/shared/)
provide those optional-index paths.
See [Module Internals](modules.md#preparing-operations) for its ownership boundary.
Typed chains retain separate structural, source, identity/domain, durable-schema,

View File

@@ -61,10 +61,12 @@ capture, or terminal mode. The runner binds those privately; direct callers can
supply a [core execution context](../../internal/framework/pipeline/operation.go)
and preparation function to the same executor.
Extraction receives an optional read-only index of the complete source document.
The runner shares one index across the run's extraction jobs and cache decoders;
standalone callers may omit it or supply an index for their source. It is not a
chunk index, and request-local mutable data remains separately owned.
Extraction and validator requests receive an optional read-only index of the
complete source document. The runner shares one index across extraction,
validation, and cache decoding; standalone callers may omit it or supply an index
for their source snapshot. Detached validator source views retain the same unit
IDs/order and borrow that index. It is not a chunk index, and request-local
mutable data remains separately owned.
- Return a deterministic operation with one candidate when no model is needed.
Core assesses it once; there is no native request or synthetic cache key.

View File

@@ -84,6 +84,8 @@ capture failures interrupt it. Typed candidates are encoded once for assessment,
then decoded separately for each typed validator. Serialized validators receive
owned bytes/schema metadata; chunk validators receive detached materialized
chunks. Source, references, annotations, and metadata views are isolated too.
Their unchanged source IDs/order share the run's immutable `SourceIndex`; source
and metadata copying remain per-validator responsibilities of the framework.
[Assessment values](../../internal/framework/contracts/assessment.go) distinguish
approval, semantic rejection, failure, and unavailable judgment. An empty configured

View File

@@ -185,6 +185,15 @@ treated as defects merely because they cost time or space.
### ALG-001 — Validators Still Rebuild The Whole-Source Index
**Status:** Completed. Validator requests now borrow the run-owned index across
chunking, extraction, merge, and normalization. All D&D citation/reference and
applicable invariant/semantic checks reuse it through shared optional-index
helpers; standalone calls still build locally. Detached validator views remain
isolated. Tests cover shared identity across jobs/steps/request forms, concurrent
readers, same-ID changed layouts, omitted indexes, and mutation isolation.
Full tests, vet, build, the pipeline/shared/all-D&D-validator race suite, and
three repeated focused race runs passed. Internal ownership guidance is updated.
**Priority:** Medium efficiency opportunity; adjacent follow-up to Stages 5–9,
not a regression or reopening of their completed extraction/cache scope.