Document standalone preflight and complete verification

This commit is contained in:
2026-11-30 15:42:21 +00:00
parent 727ed783d1
commit b2877c1ea0
17 changed files with 276 additions and 97 deletions

View File

@@ -5,13 +5,13 @@
```text
narratio
├── run SESSION
├── preflight SESSION
├── artifacts
│ ├── list
│ └── regenerate SESSION
├── session
│ ├── init SESSION
│ ├── plan SESSION
│ ├── validate SESSION
│ ├── status SESSION
│ ├── restore SESSION
│ ├── clean [SESSION | --all]
@@ -94,7 +94,7 @@ reruns selected work; dependent invalidation can extend beyond that range.
Bounded starts require valid preceding manifest state. Ordinary execution uses
semantic resume checks rather than rerunning all selected work.
After preparation, `run` checks projected Audita and Scriptorium work before
After preparation, `run` checks projected Audita, Notarius, and Scriptorium work before
processing continues. Failed checks stop the invocation; prompt warnings alone
do not. `artifacts regenerate` uses the same check.
See [operations](operations.md#prompt-requirements-preflight) for recovery.
@@ -143,22 +143,21 @@ without creating a workspace, changing manifests, acquiring execution locks, or
initializing stage adapters or invoking requirements inspection. It does not
predict unknown output identities.
## Session validate
## Preflight
```sh
narratio session validate SESSION --session-file ./session.yml
narratio preflight SESSION --session-file ./session.yml
narratio preflight SESSION --format json
```
Validation checks configuration and required input, audio, previous-session,
publication, and lock readiness. Audita preflight uses existing prepared inputs,
probes temporary destinations under `runs/.validation`, and may contact configured
providers. It also inspects enabled trim
and analysis definitions and their configured prerequisites, regardless of
output reuse. Missing prompt requirements or unsuccessful inspection invalidate
the report; incomplete or conditional discovery alone is a warning. Material
findings remain in the report regardless of diagnostic visibility. Invalid
configuration uses the native input classification; readiness failures are
operational failures.
Preflight resolves the same session and configuration selectors as `run`,
prepares or reuses inputs, and checks enabled downstream capabilities and
prompt prerequisites even when their processing outputs are reusable. It may
create a workspace, download inputs, update the manifest, and contact providers.
It stops before processing and publication. Required failures or blocked
checks prevent readiness; conditional or incomplete prompt discovery can warn
without failing. Preparation remains reusable after a later readiness failure.
See [operations](operations.md#prompt-requirements-preflight) for details.
## Session status
@@ -337,13 +336,19 @@ manifests, resolved credentials, or internal dependency containers.
| Run/regenerate | `campaign`, `session_id`, `run_id`, `stages`, `executed`, `skipped`, `stage_results`, `available_artifacts`, `artifact_targets`, `complete` |
| Plan | `campaign`, `session_id`, `stages` with `name`, `action`, `reason`, optional `analysis`; `publication_actions` |
| Catalog | `artifacts` with source, producer, output, enabled state, dependencies, optional concrete key and family/member/source provenance |
| Validation | `campaign`, `session_id`, `session_source`, `valid`, `findings` with severity, category, message |
| Preflight | `campaign`, `session_id`, optional `session_source` and `run_id`, `preparation` with outcome and optional reason, `ready`, `checks` with group, outcome and optional message, `findings` with severity, category and message |
| Status/artifacts | Identities/source, `local_manifest`, `stages`, `artifacts`, optional `remote`, configuration provenance, audio/previous-artifact readiness, `findings` |
| Init | `campaign`, `session_id`, `destination`, `remote`, `written` |
| Locks | Identities, `operation`, `result`, `complete`, optional `source`, `locks` |
| Restore | Identities/run, `dry_run`, `complete`, `status`, `downloaded`, `conflicts`, `actions` |
| Clean | Optional identities, `all`, `dry_run`, `complete`, `cache`, `actions`, optional `error` |
Preflight preparation outcomes are `completed`, `reused`, `failed`, or
`not_attempted`. Check outcomes are `succeeded`, `failed`, or `blocked`;
inapplicable groups may be omitted. Findings include errors, warnings, and
information where available. Quiet mode suppresses the report and retains
failure diagnostics on stderr.
Run `stages` is the complete selection. `executed` includes attempted work,
including failures and self-skips. `skipped` includes reuse and self-skips.
Each `stage_results` entry has `name`, `attempted`, `outcome`

View File

@@ -19,9 +19,10 @@ After preparation, Narratio runs native Audita preflight when projected polish
work needs execution. The adapter supplies the same selections and prepared
files with a synthetic transcript. Audita's provider smoke checks remain enabled;
they can contact providers and destination probes can create directories.
`session validate` uses existing prepared records and a validation probe
namespace. A successful check is not a guarantee about later real-transcript
processing or editorial quality. See [operations](../operations.md#prompt-requirements-preflight)
Standalone `preflight` prepares or reuses inputs and checks Audita regardless
of output reuse, using invocation-scoped probe destinations. A successful check
does not guarantee later real-transcript processing or editorial quality. See
[operations](../operations.md#prompt-requirements-preflight)
and [Audita preflight](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/cli.md#preflight).
Each `pipeline.audita.credentials` value is an exact ConfigKit secret reference.

View File

@@ -62,9 +62,10 @@ command configuration loader may still use object storage to retrieve a missing
remote session file before planning begins.
After preparation, the application projects remaining selected work and uses
invocation-owned Audita, Notarius, and Scriptorium runners for applicable readiness checks.
The same runners are available to processing. Explicit session validation uses
existing prepared inputs and invocation-owned factories. See
invocation-owned Audita, Notarius, and Scriptorium runners for applicable
readiness checks. The same runners are available to processing. Standalone
preflight prepares inputs through the same lifecycle and uses invocation-owned
factories for all enabled readiness checks. See
[preflight internals](preflight.md).
Notarius is composed only when extraction is enabled. The stage resolves

View File

@@ -36,6 +36,8 @@ cancellation; active work retains the canceled operation context. Cleanup, when
selected, is the ordinary final stage rather than runner finalization work.
The lock remains held from manifest initialization through finalization, and a
failed stage or required manifest save prevents later stages from starting.
Standalone preflight shares that lifecycle, runs only preparation, and checks
enabled capabilities while holding the same lock.
## Components
@@ -46,7 +48,7 @@ failed stage or required manifest save prevents later stages from starting.
| Configuration | [`internal/config`](configuration.md) | Typed ConfigKit results and lifecycle defaults, imports/overlays, canonical party loading, separate catalog/player/publication derivation, session templating, and validation. |
| Pipeline stages | `internal/stage` | Canonical stage registry, shared stage contract, execution dependencies, and implemented stage behavior. |
| Glossaries | `internal/glossary` | Native vocabulary resolution, schema validation, party projection, and deterministic documents. |
| Downstream preflight | [`internal/preflight`](preflight.md) | Assess Audita readiness and native prompt requirements for execution and validation. |
| Downstream preflight | [`internal/preflight`](preflight.md) | Assess Audita, Notarius, and prompt requirements for execution and standalone preflight. |
| External boundaries | `internal/adapters`, `internal/audio` | WhisperX HTTP, downstream subprocesses, notification, object storage, and S3 audio materialization behind Narratio contracts. |
| Manifests | `internal/manifest` | Durable session progress, stage transitions, validation, and atomic persistence. |
| Artifacts and paths | `internal/artifacts`, `internal/pathsafe` | Artifact identities and resolution, local and remote path/key models, current-state discovery, and confined relative destinations. |
@@ -119,7 +121,7 @@ so any earlier replacement can stale a prior cleanup result.
- [Adapter Internals](adapters.md): external adapter boundaries, composition,
failure behavior, and test surfaces.
- [Preflight Internals](preflight.md): projected target selection and shared
requirements assessment.
requirements assessment and standalone preparation.
- [Artifact Internals](artifacts.md): source identities, runtime catalog,
resolution, previous requirements, and current-state helpers.
- [Manifest Internals](manifest.md): session records, persistence, and execution

View File

@@ -1,44 +1,41 @@
# Internal: Downstream Preflight
The application performs downstream checks after selected preparation completes
or is reused and before remaining selected processing. It projects remaining
work against a clone of the locked manifest using the same stage decisions and
analysis planner as `session plan`. Projected polish selects Audita; projected
enabled extraction selects Notarius inspection and preflight; enabled trim and
analysis select Scriptorium requirements. A projection is not
an execution commitment. Empty target sets invoke no checker.
The application runs automatic downstream checks after selected preparation and
before selected processing. It projects remaining work against a clone of the
locked manifest, using the stage decisions and analysis planner shared with
`session plan`. Projected polish selects Audita; projected enabled extraction
selects Notarius; projected trim and analysis select Scriptorium requirements.
A projection is not an execution commitment, and an empty target set invokes no
checker.
Audita receives the verified four prepared glossary files and the same
processing selectors and destinations, with an embedded synthetic transcript.
The adapter runs native preflight with provider smoke enabled, captures its
transient diagnostics, and preserves exit classification. No preflight result
is cached as a stage. A failure stops later processing without presenting it as
complete.
Standalone `preflight` acquires configuration once and uses the runner's locked
invocation lifecycle to execute or reuse `prepare`. Within that same lock it
selects all enabled capabilities and prompt prerequisites regardless of reuse,
then invokes the shared downstream request builders and checkers. A preparation
failure blocks probes requiring prepared inputs but permits independent prompt
and remote-lock inspection while the context remains active. Preparation success
is persisted even when later readiness fails; readiness itself creates no stage
or reusable success record.
Notarius uses the same execution controls and verified reference snapshots. It
checks an available verified transcript or reports that a synthetic one was used.
Readiness warnings and native failures remain visible; checks do not publish work.
For `session validate`, the application selects enabled downstream definitions
independently of reuse and checks the existing prepared manifest. It does not
resolve live files into candidate glossary projections or run prepare. The
Audita probe under `runs/.validation` can create or probe directories and contact
providers; it does not update the session manifest. Discovery and provider
checks do not establish real-transcript feasibility or editorial quality.
Standalone validation acquires the context-aware session lock before reading
prepared evidence for Audita or Notarius probes. It holds the lock through probe
execution, report consumption and reference verification, serializing these
files with runner cleanup and restore. Missing preparation is reported without
creating a workspace. Automatic preflight uses the runner's existing lock.
Audita receives verified prepared glossary files and production selections with
an embedded synthetic transcript. Its adapter performs native provider smoke
checks and retains failure causes. Notarius receives production controls and
verified reference snapshots, which are checked again after its native call.
The application projects transcript-producing work before allowing a verified
current transcript; otherwise it reports the synthetic fallback. Neither probe
publishes work, and the synthetic input cannot establish real-transcript
feasibility or editorial quality.
Scriptorium input-map keys remain binding names distinct from Narratio source
IDs. Missing required bindings or variables and inspection failures are errors;
optional sources for required inputs, conditional requirements, incomplete
discovery, and discovery issues produce warnings. The checker preserves earlier
findings and stops on cancellation. Actual input resolution remains authoritative.
discovery, and discovery issues produce warnings. Findings survive independent
failures and cancellation stops new work.
See [Audita](../integrations/audita.md), [Scriptorium](../integrations/scriptorium.md),
[CLI](../cli.md#session-validate), and [operations](../operations.md#prompt-requirements-preflight).
Implementation and tests are in `internal/preflight`, `internal/app/runner_preflight.go`,
`internal/app/session_inspection_command.go`, and `internal/adapters/audita/preflight.go`.
Probe files use invocation-scoped destinations under `runs/`, protected by the
session lock through report consumption, reference verification, and terminal
persistence. A later authorized cleanup can remove those files without removing
durable prepared inputs. See [workspace internals](workspace.md),
[CLI](../cli.md#preflight), and [operations](../operations.md#prompt-requirements-preflight).
Implementation is in `internal/preflight`, `internal/app/downstream_readiness.go`,
`internal/app/runner_preflight.go`, and `internal/app/session_readiness.go`.

View File

@@ -51,14 +51,15 @@ operating-system lock held on `.lock` (`ErrLockConflict` on contention). The
file retains owner metadata after release or process death; its existence is
not evidence that a lock is active. Command and restore flows wait for this
lock only while their context remains active, and report a release failure.
Standalone validation uses the same lock for its prepared-state reads and
session-local readiness probes, keeping active probe files outside concurrent
cleanup. Validation leaves stage progress unchanged.
Standalone preflight holds the same lock through preparation, readiness probes,
and finalization, keeping active probe files outside concurrent cleanup.
Preparation uses ordinary manifest transitions and invalidation.
The runner assigns every invocation a run-workspace identity but creates the
physical run directory and its `runs/` parent only when an executing stage
requires them. Fully reused invocations and cleanup-only invocations therefore do not accumulate
empty run directories.
physical stage run directory only when an executing stage requires it. Fully
reused pipeline invocations and cleanup-only invocations do not accumulate
empty run directories. Readiness probes create their separate invocation-scoped
diagnostic directories when checks run, including during a reused preparation.
## Cleanup Semantics

View File

@@ -72,11 +72,10 @@ This guidance does not create a release or publish any changes.
## Standard Session Workflow
1. Select pipeline/campaign/session config.
2. Prepare inputs, then validate session readiness:
2. Prepare inputs and check session readiness:
```bash
narratio run 2026-04-04 --stage prepare
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
3. (Optional) inspect stage decisions:
@@ -124,16 +123,24 @@ required binding or failed check stops the invocation; incomplete or conditional
prompt discovery can produce warnings. Already completed work remains recorded.
`session plan` does not invoke these downstream checks.
`session validate` checks enabled downstream definitions against existing
prepared glossary records. It does not prepare inputs. Its Audita probe uses a
`runs/.validation` destination namespace, may create or probe directories and
may contact configured providers. The synthetic check establishes readiness for
that probe, not feasibility for a real transcript or editorial quality. See
[Audita](integrations/audita.md) and [Scriptorium](integrations/scriptorium.md).
Session-local Audita and Notarius probes share the session lock with pipeline
runs and restore. Validation waits while that lock is held, honors cancellation,
and leaves stage progress unchanged. Cleanup can remove finished probe files
after validation releases the lock.
Standalone `preflight` prepares or reuses the session's real inputs before
checking every enabled downstream capability and prompt prerequisite, including
work whose outputs could be reused. It may create workspace state, download
inputs, update the manifest, and contact providers. Changed inputs can stale
dependent stage records through ordinary preparation rules. Preparation remains
available for reuse if a later readiness check fails. Preflight stops before
processing, publishing, notification, or cleanup.
Audita checks a synthetic transcript. Notarius uses a verified trimmed
transcript only when the normal work projection indicates its producers will
not rerun; otherwise it uses a synthetic input. These checks do not establish
real-transcript feasibility, editorial quality, or future provider availability.
See [Audita](integrations/audita.md) and [Scriptorium](integrations/scriptorium.md).
The session lock covers preparation, probes, and finalization. Probe diagnostics
under `runs/` are disposable and can be removed by a later authorized cleanup;
prepared inputs remain durable. Preflight itself does not run cleanup or rotate
processing-stage diagnostic views. See [cleanup](#cleanup).
## Stage Execution and Continuation Behavior

View File

@@ -130,8 +130,9 @@ not configurable.
Downstream readiness is an invocation check after selected preparation and
before the selected processing work. It does not create a stage success.
Session validation uses existing prepared inputs; its downstream checks may
probe destinations and contact configured providers.
Standalone preflight prepares or reuses session inputs and checks enabled
capabilities under the same session lock; its checks may probe destinations and
contact configured providers.
A stage may explicitly self-skip with a stable reason and no outputs. That
outcome is persisted, clears older outputs owned by the stage, and is

View File

@@ -1,6 +1,6 @@
# Standalone Session Preflight Implementation Plan
Status: In progress.
Status: Complete.
## Scope And Working Instructions
@@ -310,7 +310,7 @@ duplicating the suite or introducing stricter readiness rules.
## Stage 7: Update Canonical Documentation And Verify The Sprint
Status: Pending.
Status: Complete. Verified with Go 1.27.4: `go test ./...`, `go test -race ./...`, `go vet ./...`, `go build ./...`, `go test ./internal/doccheck`, and `git diff --check`.
Read the affected sections of [CLI](../cli.md), [Operations](../operations.md),
[Troubleshooting](../troubleshooting.md), [Internal Overview](../internal/overview.md),

View File

@@ -1,6 +1,7 @@
# Standalone Session Preflight
Status: Planned; not implemented.
Status: Implemented. The next release notes must identify the migration from
`session validate` to `preflight`.
## Goal
@@ -13,7 +14,7 @@ Build this command from existing production paths. Automatic preflight and the
standalone command should share checking machinery, while retaining their
different rules for selecting what to check.
## Current Baseline
## Baseline Before Implementation
- `session validate` already checks configuration, stable inputs, local or remote
audio availability, previous-session requirements, and publication locks. It
@@ -29,11 +30,11 @@ different rules for selecting what to check.
has separate validation and execution orchestration, including duplicated
prepared-manifest acquisition and downstream request setup.
The current contracts are described in [preflight internals](../internal/preflight.md),
The current contracts are now described in [preflight internals](../internal/preflight.md),
[preparation](../internal/stage-prepare.md), and the
[CLI reference](../cli.md#session-validate). Principal implementation owners are
`internal/app/session_inspection_command.go`, `operator_inspection.go`,
`runner.go`, `runner_preflight.go`, `preflight_targets.go`, `internal/preflight`,
[CLI reference](../cli.md#preflight). Principal implementation owners are
`internal/app/session_readiness.go`, `downstream_readiness.go`, `runner.go`,
`runner_preflight.go`, `preflight_targets.go`, `internal/preflight`,
and the existing stage request builders and downstream adapters.
## Targeted End State

View File

@@ -39,7 +39,7 @@ Likely cause:
Diagnostics:
```bash
narratio session validate 2026-04-04 --session-file /path/session.yml
narratio preflight 2026-04-04 --session-file /path/session.yml
```
Safe fix:
@@ -150,7 +150,7 @@ Likely cause:
Diagnostics:
```bash
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
Safe fix:
@@ -348,12 +348,12 @@ Relevant references: [Secrets](./config.md#secrets-handling) and
## Prepared glossary is unavailable or invalid
If validation or downstream work reports missing, changed, or invalid prepared
If preflight or downstream work reports missing, changed, or invalid prepared
glossary evidence, check the selected catalog IDs, source-relative files, and
campaign inline contribution. Re-run `prepare` after correcting the source;
use `--force` when an explicit refresh is needed. Update old monolithic source
bindings and glossary files using the [glossary input guidance](config.md#glossary-inputs).
Validation uses existing prepared inputs and does not regenerate them.
Preflight runs or reuses preparation; after correcting the source, retry it.
## Audita configuration or credential failure
@@ -451,7 +451,7 @@ Diagnostics:
```bash
narratio session status 2026-04-04
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
Safe fix:
@@ -701,7 +701,7 @@ and [Manifest Internals](./internal/manifest.md#transcribe-owned-speaker-state).
## Prompt requirements fail during preflight
If a run or `session validate` reports a missing prompt input, compare the exact
If a run or `preflight` reports a missing prompt input, compare the exact
input name in the finding with the configured binding key, not just the source
ID. Supply a missing required variable, or correct the selected prompt and
profile. An optional source warning means the source may be omitted later; make
@@ -771,7 +771,7 @@ Likely causes:
Diagnostics:
```bash
narratio session validate 2026-04-04
narratio preflight 2026-04-04
narratio session status 2026-04-04
```
@@ -968,7 +968,7 @@ Likely causes:
Diagnostics:
```bash
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
Safe fix: