11 KiB
Standalone Session Preflight
Status: Planned; not implemented.
Goal
Provide narratio preflight SESSION as the operator's prepare-and-check workflow
before starting a long pipeline run. It resolves Narratio configuration, prepares
or reuses real session inputs, checks Narratio's readiness, and invokes the
applicable downstream readiness checks. It replaces session validate.
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
session validatealready checks configuration, stable inputs, local or remote audio availability, previous-session requirements, and publication locks. It runs Audita and Notarius readiness checks and Scriptorium requirements inspection against enabled definitions and their prerequisites.- Validation requires existing prepared inputs for Audita and Notarius. It does not execute preparation or update the manifest, although downstream probes can write diagnostic files and contact providers.
- Automatic preflight runs after selected preparation completes or is reused. It uses the ordinary work projection to check downstream work expected to execute. Fully reused work does not require another downstream check.
internal/preflightsupplies shared checkers. The application layer currently has separate validation and execution orchestration, including duplicated prepared-manifest acquisition and downstream request setup.
The current contracts are described in preflight internals,
preparation, and the
CLI reference. Principal implementation owners are
internal/app/session_inspection_command.go, operator_inspection.go,
runner.go, runner_preflight.go, preflight_targets.go, internal/preflight,
and the existing stage request builders and downstream adapters.
Targeted End State
Command And Selection
narratio preflight SESSION
narratio preflight SESSION --config ./pipeline.yml --session-file ./session.yml
narratio preflight SESSION --format json
Use the same configuration and session acquisition conventions as run,
including applicable campaign, party, overlay, and previous-session selectors.
Use CommandKit's native reporting and visibility controls.
The command checks the configured session's enabled pipeline capabilities, including the existing prerequisite closure for prompt requirements, regardless of whether their processing outputs are reusable. Automatic preflight continues to check only projected execution targets. These are two target-selection policies, not two implementations of readiness checks.
Remove session validate from the command tree and update its callers and
documentation. Native config validation and inspection retain their existing,
narrower purposes. The initial command does not need additional stage-range or
artifact-filtering options to deliver the agreed workflow.
Preparation And State
Acquire configuration through the ordinary ConfigKit integration, then use the
normal invocation lifecycle and session lock to execute or reuse prepare.
Reuse its semantic checks, input projections, downloads, manifest persistence,
and dependent invalidation rather than implementing a preflight-specific
preparation path.
Preflight is consequently not read-only. It can create a session workspace, download audio and previous-session inputs, write prepared documents, and update preparation state. Changed inputs can stale downstream records through the existing rules. These effects must be explicit in help and operator guidance.
Check downstream readiness against the resulting prepared inputs. Use existing request builders and adapters so configuration selections, credentials, references, and applicable execution settings agree with production invocation. Audita retains its synthetic-transcript probe; Notarius uses a suitable verified transcript when available and its existing synthetic fallback otherwise. A stale transcript left by earlier work must not be presented as current input.
The command stops after checking. It does not execute processing, publish, notify, or the pipeline cleanup stage. A readiness failure after successful preparation leaves that preparation available for reuse. The check itself does not mark processing stages successful, invalidate otherwise valid products, or create a persisted preflight stage whose success bypasses future checks.
Check Ownership And Coverage
| Owner | Responsibility |
|---|---|
| ConfigKit integration | Resolve and validate configuration through the existing acquisition path; preserve native error semantics. |
| Narratio | Check its input, workspace, dependency, previous-session, and publication prerequisites using existing domain and adapter machinery. |
| Audita | Run native preflight with the prepared glossary inputs and existing provider smoke checks. |
| Notarius | Run native inspection and preflight with the selected pipeline, prepared reference bindings, and existing execution controls. |
| Scriptorium integration | Retain requirements inspection and Narratio's binding/source checks for enabled trim and analysis definitions and their prerequisites. |
Carry forward the current validation checks and obtain preparation-related evidence from actual preparation where that avoids duplicate work. Check workspace access and dependency availability through ordinary setup or supported adapter operations; identify any remaining concrete gaps during implementation planning. This scope does not require inventing health protocols for every tool, simulating a publish transaction, or making Narratio validate subprocess-owned configuration itself.
Preserve the existing distinction between errors and warnings. For example, missing required prompt bindings and failed inspection are errors; conditional or incomplete Scriptorium discovery and optional-source concerns retain their existing warning treatment. Publication locks retain the current reporting semantics. Merely moving a check into preflight does not make it stricter.
Reporting And Failure Behavior
Return one final readiness report through CommandKit's native text, YAML, JSON, and automatic format selection. Include session identity, preparation outcome, overall readiness, and actionable findings. Distinguish checks that succeeded, failed, or could not run because a prerequisite failed; retain warnings and relevant limitations such as use of a synthetic transcript.
Use ordinary stderr diagnostics and progress for preparation and checks. Report substantive failures regardless of verbosity, preserve underlying error causes, and use the existing ConfigKit/CommandKit outcome classification rather than introducing a preflight-specific exit-code system.
Continue independent checks where practical, while stopping dependent work when its prerequisites fail and honoring cancellation. A required check that fails or cannot run prevents an overall successful readiness result. This does not reclassify an otherwise successful inspection's advisory findings as failures. Configuration acquisition failure may prevent a session-level assessment.
Successful preflight reports what was checked at that time. It does not guarantee future provider availability, publication success, or processing quality with a real transcript. Automatic preflight still runs before applicable processing.
Work To Reach The End State
- Consolidate checks and request construction. Separate existing validation
checks from command wiring. Keep shared checking in
internal/preflight, application acquisition and lifecycle ininternal/app, and downstream invocation in adapters. Reuse production request builders and prepared-input verification. Remove duplicate setup where practical without introducing a generic check framework. - Integrate preparation and readiness in one command lifecycle. Reuse the runner's prepare execution/reuse decisions, locking, persistence, cancellation, and resource release. Avoid calling public CLI commands from inside the new command or loading a second, potentially different configuration. Retain the full-session target selection for standalone checks and projected selection for automatic checks.
- Replace the command and reporting. Register top-level
preflight, removesession validate, and adapt the existing findings report to describe preparation and readiness, including meaningful partial results. Remove obsolete validation-only orchestration and preserve helpers still used by status, planning, or other commands. - Keep probe material within the workspace lifecycle. Use existing probe
path and diagnostic conventions; checking does not promote probe outputs into
canonical products. Coordinate with the cleanup roadmap: probe
evidence under
runs/is disposable at the next authorized cleanup, and preflight does not itself authorize session cleanup. Preparation's durable outputs remain ordinary reusable inputs. - Update current documentation when implementation lands. Update the CLI
tree and report reference, the standard operations workflow, troubleshooting
commands, internal ownership and lifecycle documentation, and the architecture
policy's description of standalone validation. Replace the documented
prepare-then-validate sequence with preflight. Explain state changes, provider
calls, check coverage, and migration from
session validatein release notes.
Verification
Extend existing behavioral tests in internal/app, internal/preflight, and
the affected adapters. Use real temporary workspaces and fakes at external
boundaries; ordinary tests remain offline and credential-independent.
- A fresh session prepares inputs, checks enabled downstream targets, and stops without processing or publishing. A repeated preflight reuses valid prepared inputs while still performing readiness checks.
- Changed inputs follow ordinary prepare invalidation. A downstream readiness failure preserves successfully prepared inputs and does not independently invalidate completed processing results.
- Standalone and automatic checks use the same prepared references and execution configuration. Standalone checks include reusable enabled work; automatic checks retain projected-work selection. Existing prerequisite closure and warning behavior remain covered.
- Preparation failure blocks checks requiring those inputs. Independent findings remain reportable where possible; native check failures and cancellation cannot produce an overall success.
- Native output formats and visibility controls carry the readiness report and failures correctly. Cancellation, persistence failures, and resource release use existing lifecycle behavior.
Revise tests asserting that session validate never creates state or changes
the manifest: that is intentionally replaced by ordinary preparation behavior.
Retain applicable checks for native error handling, findings, and adapter
contracts rather than duplicating them under a new command name. Run focused
tests during implementation and the repository's normal completion checks,
including documentation links, before declaring the work complete.