Files
narratio/docs/internal/stage-extract.md

44 lines
2.1 KiB
Markdown
Raw Normal View History

# Internal: Extract Stage
## Responsibility
The extract stage invokes the configured Notarius pipeline on the verified
final trimmed transcript and prepared references, promotes configured lane
products, and records Narratio-owned content evidence. Notarius owns its
pipeline, cache, validation and completion protocol; see the
[integration contract](../integrations/notarius.md).
## Lifecycle
Disabled extraction records a skip. An execution resolves manifest-backed input
identities, creates immutable content-addressed reference snapshots, and invokes
Notarius with run-local output, log and debug destinations. The adapter accepts a
successful native completion report for the expected pipeline and confined output
directory. The stage reads each configured lane JSON, validates its safe path and
content, then promotes all required products to flat artifact paths before
recording success. The original bundle and optional domain auxiliaries stay in
2026-11-30 14:08:28 +00:00
the producing run until authorized cleanup removes run history. Positive native
fallback counts are recorded and reported.
## Resume Validation
Resume checks the direct transcript identity, configured pipeline and lane
selection, reference identities, and manifest-backed output checksums and sizes.
2026-11-30 14:08:28 +00:00
It does not reopen the original bundle or completion report.
Cache and debug selection, executable version and private downstream config are
not blanket invalidators. Force invokes extraction with cache refresh. A failed
replacement is not represented as a current successful extraction.
## Failure Behavior
Native errors, malformed completion, missing required lanes, unsafe paths, or
invalid JSON fail the attempt while preserving available diagnostics. A partial
report or incidental output is not success. See [operations](../operations.md#extraction-workflow).
## Implementation And Focused Tests
`internal/stage/extract.go`, `extract_preflight.go`, `extract_native_test.go`,
`internal/artifacts/extraction_evidence.go`, and `internal/adapters/notarius/`
own the stage, readiness, evidence and subprocess boundaries. The opt-in
`notarius_cache_integration_test.go` exercises a real executable.