diff --git a/docs/roadmap/future.md b/docs/roadmap/future.md index 2ff9d3ee..56fcbce5 100644 --- a/docs/roadmap/future.md +++ b/docs/roadmap/future.md @@ -5,6 +5,11 @@ configuration, operations, internal, and integration docs. This backlog records proposed extensions to that implementation. Items below are ordered roughly by value and specificity, not as committed release dates. +## Active Implementation Roadmaps + +- [Pipeline Preflight](preflight.md): accepted design and staged implementation + plan for invocation preparation, native provider checks, and readiness reporting. + ## Near-Term D&D Pipeline ### Evaluate Spell Extraction And Normalization diff --git a/docs/roadmap/narratio-feature-request.md b/docs/roadmap/narratio-feature-request.md index 0a7f64eb..12db260c 100644 --- a/docs/roadmap/narratio-feature-request.md +++ b/docs/roadmap/narratio-feature-request.md @@ -1,5 +1,10 @@ # Feature request: pipeline-aware preflight for Narratio +This is the original consumer request, retained as context. The accepted +[Pipeline Preflight Implementation Roadmap](preflight.md) owns the implementation +plan and subsequent design refinements, including native capability handling and +the simplified readiness report. + ## Purpose Provide `notarius preflight` to check whether a selected invocation is ready to diff --git a/docs/roadmap/preflight-discussion.md b/docs/roadmap/preflight.md similarity index 59% rename from docs/roadmap/preflight-discussion.md rename to docs/roadmap/preflight.md index b643c9e2..b3fafceb 100644 --- a/docs/roadmap/preflight-discussion.md +++ b/docs/roadmap/preflight.md @@ -1,18 +1,24 @@ -# Pipeline Preflight Discussion +# Pipeline Preflight Implementation Roadmap ## Purpose And Status -This document records the accepted direction and open decisions for -[Narratio's feature request](narratio-feature-request.md). The request owns the -consumer's requested behavior; this discussion owns Notarius design decisions -before a formal roadmap and implementation plan. Accepted decisions here refine -the original request, including its proposed coverage disclosures. No new preflight -command is implemented by this document. +**Status:** Accepted design; implementation not started. -The overall direction below is accepted. Numbered decision sets remain proposals -until explicitly accepted; their details are not implied implementation approval. -Current behavior belongs in [CLI Reference](../cli.md), -[CLI Internals](../internal/cli.md), and [Operations](../operations.md). +This roadmap is the planning authority for pipeline-aware preflight. It +consolidates all five accepted discussion items, including Item 5's verification, +staged implementation, and documentation handoff, and replaces the retired +discussion document. There are no remaining open product decisions. + +[Narratio's original feature request](narratio-feature-request.md) remains context. +The accepted design here governs implementation where it refines that request, +including the simpler treatment of native capabilities and readiness reporting. +Current behavior remains documented in [CLI Reference](../cli.md), +[CLI Internals](../internal/cli.md), and [Operations](../operations.md); this +roadmap does not claim that the new command is implemented. + +Implement the three stages below in order, with focused tests accompanying each +stage. Private helper types, observer wiring, debug filenames, and exact check +identifiers remain implementation choices within the accepted contracts. ## Accepted Direction @@ -39,8 +45,6 @@ Current behavior belongs in [CLI Reference](../cli.md), ## 1. Required Checks And The Meaning Of Ready -**Status:** Accepted; implementation pending. - Preflight validates that the selected pipeline is coherent and satisfied by the supplied inputs, then runs the available, applicable native PromptKit smoke checks against the backends/profiles implicated by that pipeline. This affirmative @@ -64,8 +68,7 @@ An unavailable backend diagnostic capability is neither a failure nor an omissio For example, absence of a native authentication check needs no compensating proof, warning, or coverage disclaimer. Run the applicable checks PromptKit provides; do not introduce a Notarius capability checklist that a backend must satisfy -beyond those native diagnostics. This supersedes the earlier proposal to disclose -unavailable checks and general execution coverage limits. +beyond those native diagnostics. Cache access problems warn rather than fail preflight, consistent with execution's best-effort cache policy; bypass requires no cache access. Output and requested @@ -75,16 +78,8 @@ Producer strict/permissive mode does not change the smoke-check verdict or turn failed checks into success through fallback. Preflight performs its own defined checks; producer fallback belongs to substantive pipeline execution. -**Decision:** All three recommendations accepted with the clarified rationale: -required checks must complete successfully, cache problems remain warnings, and -producer fallback mode does not alter readiness. Unavailable native diagnostic -capabilities need no failure, omission, or caveat reporting. Target selection -mechanics remain for Item 2; report details remain for Item 4. - ## 2. Effective Target Discovery And Probe Coverage -**Status:** Accepted approach; implementation pending. - Use the effective invocation to identify profiles implicated by selected work, including model-backed chunking, extraction, normalization, validators, and any other selected model roles. Build a deduplicated profile list and a deduplicated @@ -96,7 +91,7 @@ then one native structured-generation test per distinct profile. Do not add a separate text-generation test or run the full smoke suite per operation. Multiple operations sharing a profile share its generation test; profiles sharing a backend share backend access checks. Retain associations to the relevant pipeline bindings -for reporting. Unavailable checks follow Item 1's accepted semantics. +for reporting. Unavailable checks follow Section 1's accepted semantics. Use native PromptKit resolution and smoke APIs. Correction normally inherits its originating execution target and adds no separate profile test; still validate its @@ -111,7 +106,7 @@ current architecture, ConfigKit resolves configuration sources and configuration assignments; ckprompt execution flags such as `--llm-model` and `--llm-endpoint` remain request-scoped overrides, not mutations of that configuration. Forward those same supplied overrides to native smoke requests so tests exercise the -intended invocation. Exact flag mapping belongs with Item 3. +intended invocation. Flag behavior follows Section 3. Verify existing module declarations and selections during implementation. Reuse existing information wherever sufficient; expose a small side-effect-free shared @@ -119,15 +114,8 @@ target-selection operation only for concrete callers needing it. Do not fabricat generated artifacts or execute substantive stages to discover targets. Escalate concrete native target-resolution gaps upstream rather than duplicate resolution. -**Decision:** Accepted: deduplicate profiles and backends, perform backend access -checks once per backend, and one structured-generation test per profile, preserving -native resolution and effective invocation overrides. Exact inventory and API -mechanics remain implementation choices within this approach. - ## 3. Shared Preparation, Input Validation, And Side Effects -**Status:** Accepted; implementation pending. - Share ordinary local preparation between run and preflight: configuration and invocation selection, lane/reference binding and module options, prompt/profile dependency checks, module construction, input reading/parsing through its adapter, @@ -171,15 +159,8 @@ effective selection, useful input/reference diagnostics, native smoke results, and failures. Reuse native observations for usage and preserve cancellation and capture failure causes. Private capture filenames remain implementation choices. -**Decision:** All four recommendations accepted: shared owner-led local -preparation, local checks before paid probes, practical destination effects with -best-effort cache access, and native flag/reporting behavior with the existing -debug lifecycle. Readiness-report details remain for Item 4. - ## 4. Reports, Outcomes, And Consumer Contract -**Status:** Accepted; implementation pending. - Emit one small command-specific readiness report through CommandKit, accompanied by the ordinary process exit status: @@ -220,24 +201,108 @@ serialize the same report value. Quiet mode and diagnostic routing remain native Do not introduce a schema-version envelope, saved receipt, mandatory sidecar, or report-storage option. Consumers can save stdout when they need a record. -**Decision:** All four recommendations accepted: a small scoped readiness report, -straightforward readiness aggregation, useful failed assessments with native -outcomes, and native presentation with a concise human view. - ## 5. Verification And Roadmap Handoff -**Status:** Open after preceding choices. +**Decision:** Item 5 accepted: verify Notarius orchestration with real internal +components and simulated providers, consolidate planning into this staged roadmap, +and update canonical documentation as implementation lands. The discussion +document is retired; the original request remains linked context. -Plan focused offline tests with fake providers and temporary destinations for -run/preflight selection equivalence, reference overrides, target coverage and -native observations, partial/unsupported results, cancellation, failed report or -capture delivery, and absence of extraction/cache mutation. Use independent expected -outcomes; do not duplicate upstream provider suites or require paid inference. +Use existing configuration loading, registries, input adapters, and temporary +files. Simulate external provider contact with a small fake provider or local HTTP +server. Default tests remain deterministic, offline, and credential-free. Optional +live-provider checks are manual verification, not ordinary test or release gates. -Update canonical command/consumer documentation with implemented behavior. Clarify -the architecture's existing offline-preflight boundary while retaining it for -`pipeline validate`; describe the explicit online command separately. Once decisions -are settled, consolidate a formal target roadmap and prepare staged implementation -work. Exact private types and filenames remain implementation choices. +| Behavior | Required evidence | +| --- | --- | +| Selection equivalence | Run and preflight honor the same lane/reference selections, profile defaults, and supplied overrides, including explicit empty values where supported. | +| Target coverage and deduplication | Selected producer and validator profiles are covered; shared profiles/backends are checked once at their respective scope; unused targets are excluded. Unavailable native capabilities add no failure. | +| Native observations | Actual failed or incomplete required observations fail readiness even when the diagnostic returns no Go error. | +| Local preparation | Malformed supplied input or references fail before paid probes; generated dependencies are checked through wiring and compatibility. | +| Destinations and cache | Output/debug failures fail readiness, cache problems warn, bypass avoids cache access, temporary probes are cleaned up, and accepted entries remain unchanged under auto and refresh. No extraction artifacts are published. | +| Consumer outcomes | Successful and failed assessments produce the expected report and process outcome; early native errors, cancellation, and capture/delivery failures retain useful causes. | +| Assembled command | A representative command-level workflow exercises real composition and native rendering with simulated provider contact, including the native alias. | -**Decision:** Pending. +Use independent expected outcomes and existing tests where sufficient. Assert +exact provider call counts where they protect the agreed deduplication of paid +checks. Test observable behavior rather than private helper structure, incidental +wording, or debug filenames. Do not duplicate upstream provider suites or build +an exhaustive matrix of every flag combination. Follow [Testing Policy](../policy/testing.md). + +## Implementation Stages + +### Stage 1: Share Local Preparation + +**Status:** Not started. + +- Extract reusable invocation declarations and local preparation from the run + composition path, retaining existing loading, reference resolution, prepared + module construction, and source/domain validation owners. +- Make source parsing and required external-reference checks reusable by run and + preflight; extract domain-owned checks currently buried in substantive + execution only where necessary. Preserve construction-before-parsing behavior. +- Keep shared loaders free of destination allocation and native smoke calls. + Keep the existing offline `pipeline validate` behavior intact. +- Add focused tests for selection and preparation behavior, retaining existing + run tests as regression coverage. + +**Completion:** Run uses the shared local preparation path with its existing +behavior preserved, and preflight can reuse those checks without invoking +substantive pipeline stages. Relevant focused tests pass. + +### Stage 2: Implement The Preflight Command + +**Status:** Not started; depends on Stage 1. + +- Declare `pipeline preflight` and its native `preflight` alias using the shared + invocation inputs and supplied-value semantics. +- Discover selected profiles/backends from resolved selections and native APIs. + Verify producer and validator coverage, prompt defaults, endpoint-only profiles, + and applicable invocation overrides. Add a small shared target-selection + operation only where an actual caller requires it; raise concrete upstream API + gaps rather than duplicating native resolution. +- Implement local destination probes and then the deduplicated native smoke + checks, interpreting native observations according to Sections 1 and 2. +- Reuse requested debug allocation/finalization and native usage observation. + Preserve cancellation and operation/capture causes. +- Implement the readiness report, native text/JSON/YAML presentation, failed + assessment delivery, and native outcomes from Section 4. +- Add focused orchestration and CLI tests for probe coverage, destination effects, + cache preservation, native observations, reporting, and failure propagation. + +**Completion:** Both command spellings perform the accepted checks against the +effective invocation, produce useful readiness assessments with native outcomes, +and respect the agreed filesystem and cache effects. Focused offline tests pass. + +### Stage 3: Verify Consumer Integration And Document The Feature + +**Status:** Not started; depends on Stage 2. + +- Complete representative command-level verification of the assembled workflow, + including Narratio's ordinary supplied synthetic input and external references. + Use simulated provider contact; no special Narratio fixture mode is needed. +- Update [CLI Reference](../cli.md) with the command, flag effects, small report, + and outcomes, including a concise structured-output example checked against + the implementation. +- Update the [subprocess consumer guide](../consumers/subprocess.md) for the + preflight-then-run workflow and consumption of unsuccessful assessments. +- Update relevant [CLI](../internal/cli.md), [pipeline](../internal/pipeline.md), + and [run-state](../internal/state.md) internals and [Operations](../operations.md) + for shared preparation, native diagnostics, and permitted filesystem effects. +- Clarify the [architecture policy](../policy/architecture.md)'s offline-preflight + boundary: retain it for `pipeline validate` and describe the explicit online + command separately. User documentation describes affirmative behavior without + a capability disclaimer inventory. Canonical documentation changes accompany + the behavior they describe; finish cross-document review in this stage. +- Run the normal repository-wide checks: + + ```sh + go test ./... + go vet ./... + go build ./cmd/notarius + ``` + +**Completion:** The representative consumer workflow is verified, canonical +documentation describes the implemented contract, and repository-wide checks +pass. Review all accepted requirements against implementation and test evidence +before marking this roadmap implemented.