From 8c09077def1acb1365c766d5dfc01e6a1d6e3404 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sat, 28 Nov 2026 04:00:34 +0000 Subject: [PATCH] Plan pipeline preflight implementation --- docs/roadmap/implementation.md | 534 +++++++++++++++++++++++++++++++++ docs/roadmap/preflight.md | 99 +----- 2 files changed, 543 insertions(+), 90 deletions(-) create mode 100644 docs/roadmap/implementation.md diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md new file mode 100644 index 00000000..98fe08fd --- /dev/null +++ b/docs/roadmap/implementation.md @@ -0,0 +1,534 @@ +# Pipeline Preflight Implementation Plan + +## Purpose And Execution Instructions + +Implement the accepted [Pipeline Preflight Feature Roadmap](preflight.md). +That document owns product scope, readiness semantics, side effects, and consumer +policy. This document owns the implementation sequence. The original +[Narratio request](narratio-feature-request.md) is background; the accepted feature +roadmap governs where it refines that request. + +Each numbered stage is one implementation prompt for a Luna coding agent. +Execute stages in order as one end-to-end sprint. Intermediate stages may leave +incomplete wiring or compilation errors; do not add temporary compatibility +layers or duplicate implementations merely to make an intermediate stage green. +Attach focused behavioral tests to their owning stage, and run them as soon as +the affected code is executable. The final stage requires a coherent, verified +repository. Follow the repository's commit discipline for completed units. + +Before implementation, read [Development](../development.md), +[Agent Policy](../policy/agents.md), [Architecture](../policy/architecture.md), +and [Testing Policy](../policy/testing.md). Read +[Documentation Policy](../policy/documentation.md) before canonical documentation +changes. Prefer graph-based code discovery as directed by `AGENTS.md`. + +This is application orchestration work, not a kit upgrade. Use the selected +PromptKit v0.25.0, CommandKit v0.8.0, ckprompt v0.12.0, and ConfigKit v1.4.0 APIs. +Do not change dependency versions or implement provider mechanics locally. +If a required native operation proves unavailable, describe the concrete API gap +before expanding scope; do not silently replace native resolution with a private +resolver or weaken the accepted preflight behavior. + +## Current Baseline And Intended Seams + +The reviewed baseline is commit `714d4456d9e8cb36fd3e039cdadb7ae7f23f568b`. +Verify current source before editing; names below locate owners, not required new +filenames or private helper names. + +| Area | Current implementation and intended change | +| --- | --- | +| Command composition | `internal/cli/application.go` installs pipeline commands and the native `run` alias. Add another domain command and native alias, retaining lazy help/version construction. | +| Invocation selection | `run_input.go`, `execution_overrides.go`, and `pipeline_run.go` contain run flags, supplied values, configuration selection, reference selectors, resolution, and construction. Share these rather than copy the run handler. | +| Offline validation | `internal/preflight/preflight.go` inspects known dependencies of resolved modules and validators without input reads, construction, or network activity. Preserve `pipeline validate` at that boundary. | +| Domain preparation | `MaterializeReferences` and `pipeline.Prepare` materialize references and construct the complete typed implementation set. Constructors already validate many domain references. Keep those checks with their owners. | +| Source parsing | `prepareRunSource` in `runner_boundaries.go` parses through the prepared adapter, validates the generic document, and builds the run's source index inside execution. Extract the parsing/validation portion for preflight reuse without chunking. | +| Native resource declarations | `ModuleSpec.Prompts` lists initial and correction dependencies together; validator specs list assessment prompts. Resource existence is not the same as execution-target selection. Distinguish continuation-only dependencies when discovering targets. | +| Capture and outcomes | `run_debug.go`, `run_capture.go`, `pipeline_run.go`'s `finish`, and `run_result.go` implement early capture, retained causes, and native reporting. Reuse lifecycle mechanisms, not artifact-publication state. | + +Use the selected native [smoke API][smoke-api], [inspection API][inspection-api], +[consumer guide][promptkit-consumer], and [CommandKit reporting guide][reporting] +as upstream contracts. Native `SmokeTestRequest` accepts profile/prompt/backend +selection, an execution override, and an optional transient-retry count. +`SmokeTestReport` retains support/applicability, completion, effective target, +facts, failure, attempts, and usage. A nil Go error is not a positive verdict. +Smoke evidence is separate from ordinary execution-observer totals. + +## Cross-Stage Decisions + +- Share ordinary helpers with explicit arguments/results. Keep configuration + loaders free of destination allocation and provider calls. Do not create a + generic preparation framework, persisted prepared-invocation record, or new + execution ledger. +- Keep all source/domain validation with the input adapter, pipeline framework, + or owning module. The CLI coordinates checks and presents their results. +- Local preparation and destination checks finish before paid diagnostics. + Construction failures still precede source parsing. Run does not acquire an + implicit online preflight or parse its source twice. +- Readiness covers the supplied input. A synthetic transcript is not a special + mode or proof about a future real transcript. +- Cache auto/refresh never read or alter accepted entries during preflight. + Bypass needs no access; cache problems only warn. Deterministic selected work + does not acquire provider checks or unnecessary cache probes. +- Preserve native supplied-value semantics, provider defaults, failure causes, + cancellation, diagnostic routing, and report-delivery outcomes. No new retry + loop, exit-code family, capability checklist, or readiness guarantee is added. +- Use stable resolved traversal order for checks. Stop on a dependency-blocking + local failure or failed required smoke check; retain performed results. Cache + warnings do not stop checks. No exhaustive/unperformed-check inventory is + required. Check counts on the successful path protect paid-probe deduplication. + +## Stage 1: Share Invocation Selection And Local Composition + +**Goal:** Run and the future preflight handler can select exactly the same work. + +**Inspect:** `internal/cli/{run_input,execution_overrides,pipeline_run,configkit_load, +reference_selectors}.go`, +`internal/core/config`, and the existing pipeline-run/reference/override tests. + +**Work:** + +1. Reuse the typed run input, flag declarations, required pipeline operand, and + input checker for both commands. Rename private helpers only where clarity + warrants it. Retain native resource/execution flag builders. +2. Factor the run prefix into small invocation-local helpers: load the selected + application result/runtime settings, then resolve reference actions, effective + pipeline, shared engine when required, and offline resource dependencies. + Keep a handoff between loading and later preparation so each caller can start + requested capture before resolution/engine failures. +3. Reuse materialization, complete typed construction, input byte reading, and + session selection through the same local preparation path. Pass a capture + collaborator/context explicitly where needed. Do not allocate output/cache + state or run smoke tests in these helpers. +4. Keep run-specific cache creation, runner execution, domain publication, and + completion reporting in the run owner. Preserve existing error categories, + paths, diagnostics, supplied empties, and reference precedence. +5. Retain current loader/result/engine reuse. Do not re-load configuration or + mutate it to apply request-scoped execution overrides. + +**Evidence and acceptance:** Existing run selection, explicit-empty session and +profile behavior, CLI/config reference origins, binding/unbinding, generated +reference conflicts, and lazy help/inspection behavior remain intact. Add only +missing behavioral coverage; do not test private helper arrangement. + +**Validation:** `go test ./internal/cli ./internal/core/config ./internal/preflight` +when the refactor compiles. This stage fits one prompt; defer parsing/domain +extraction to Stage 2. + +## Stage 2: Expose Shared Source And External-Reference Checks + +**Goal:** Preflight can validate actual local inputs without running a pipeline. + +**Inspect:** `internal/framework/pipeline/{prepare,references,runner_boundaries}.go`, +input contracts, the Seriatim adapter, production module constructors and registry +resolvers, and preparation/source/reference tests. + +**Work:** + +1. Extract the adapter parse plus `source.ValidateDocument` work from + `prepareRunSource` into a small pipeline-owned operation accessible through + the already constructed `PreparedPipeline`. Accept the existing parse data + and context; return the generic source document. Keep the adapter private. +2. Make the runner use that operation, retaining source debug evidence and one + source-index construction. Preflight will call the same operation after + module construction. Do not add a second parse to the run CLI or a new + persistent prepared-source object. +3. Review every selected production reference consumer. Reuse domain constructor + checks already reached by `pipeline.Prepare`, including registry decoding and + effective spell catalog validation. Where a required external-reference + check only occurs inside substantive execution, extract that specific pure + check into its domain owner and call it from shared preparation and execution. + Do not add a universal validator interface without a demonstrated need. +4. Preserve binding/unbinding and media/type requirements. Validate generated + dependencies using existing wiring/order/kind compatibility, not fabricated + generated content or empty stand-in artifacts. Generated content validation + remains at execution time. +5. Preserve caller cancellation and adapter/domain error causes. Shared checking + must not call chunk/extract/merge/normalize operations, configured candidate + validators, or output encoding to simulate preparation. + +**Evidence and acceptance:** Invalid transcript data and malformed required +external references are rejected locally; valid generated handoffs need no +same-run artifacts yet. Complete module construction precedes parsing. Standalone +runner and CLI run paths keep their existing source behavior and index sharing. + +**Validation:** `go test ./internal/framework/pipeline ./internal/modules/seriatim/...` +and focused tests for changed D&D reference owners. This stage is one prompt; +limit domain changes to checks needed by the accepted local-preparation contract. + +## Stage 3: Discover Selected Initial Targets Without Executing Work + +**Goal:** Produce scoped, deduplicated profile/backend selections for preflight. + +**Inspect:** `ModuleSpec`, `ValidatorSpec`, resolved pipeline/validator structures, +`internal/preflight/preflight.go`, all production model declarations and their +initial request builders, and native inspection/requirements APIs. + +**Work:** + +1. Add a domain-neutral target inventory operation under `internal/preflight` + using the resolved selection, catalog, and shared engine. Reuse the existing + traversal of input, chunk, ordered extract/merge/normalize roles, output, and + all selected validator chains. Skip deterministic roles, unused profiles, + and unselected lanes, not selected roles whose results may be cached. +2. Distinguish initial execution prompts from continuation-only dependencies. + The current flat module `Prompts` list is insufficient to infer that role. + Add a small declarative initial-prompt selection to module specs, reusing the + constants used by request builders, and carry it only where discovery needs + it. Validator `Prompts` already denotes assessment requests. Preserve the + complete existing prompt dependency list for offline validation. Do not infer + roles from slice position, filename, or a correction prompt's default profile. +3. Resolve the actual profile through native inspection: a resolved binding's + profile selection wins; otherwise use its initial prompt's native default. + Use exact native identities. Continuation inherits its origin's target and + adds no probe; keep checking its prompt dependency. Verify the production + request builders match these declarations. A concrete custom independent + target, if present, must be represented rather than silently omitted. +4. Deduplicate by exact profile identity, retaining all associated pipeline + binding scopes. Inspect profiles for their associated backend IDs; deduplicate + those IDs and retain a first-use representative profile for native access + checks. Native smoke calls, not local merging, complete target settings. +5. For an endpoint-only profile, retain that profile as its own access-check + scope and use native profile-targeted diagnostics. Do not invent a backend ID, + group endpoints heuristically, compare credentials, or build fingerprints. +6. Return selection failures with their original native causes and meaningful + binding scope. Do not reject partial profiles in ordinary offline validation + just because online preflight will require a concrete usable target. + An unresolved model target cannot silently disappear from online readiness: + report that required check as unsuccessful. This does not make dynamic + selection invalid for ordinary run or offline dependency inspection. + +**Evidence and acceptance:** A real catalog/engine fixture covers initial prompt +defaults, explicit run-wide profile selection, selected validator profiles, +shared profiles/backends, endpoint-only profiles, and an unused profile. +A correction-only different default is inspected as a dependency but not probed. +No input fabrication or provider call is needed to discover targets. + +**Validation:** `go test ./internal/preflight ./internal/framework/pipeline` and +focused changed module registration tests. This stage fits one prompt; resource +metadata edits are mechanical, and smoke execution belongs to Stage 4. + +## Stage 4: Orchestrate Native Smoke Checks And Interpret Observations + +**Goal:** Convert applicable native diagnostics into a correct readiness decision. + +**Inspect:** Native `SmokeTestRequest`, `SmokeTestReport`, facts and reason GoDoc, +and the Stage 3 inventory. Use a local HTTP server for built-in HTTP behavior; +an injected client alone cannot exercise native reachability/authentication. + +**Work:** + +1. Add a small orchestration operation under `internal/preflight`. Run + reachability and available authentication once per backend/access scope, + using its representative selected profile and supplied execution overrides. + Then request one `SmokeTestStructuredInference` per distinct profile. + Use a sequential loop; no new scheduler is needed. Do not add text inference, + full suites per operation, or a Notarius retry/admission layer. +2. Forward the same request-scoped execution override used by run. In particular, + backend probes must retain representative profile-level settings rather than + only passing `BackendID`. Every profile generation test uses its own profile, + so differing profile settings still reach native resolution. +3. Preserve omitted transient retries as nil, retaining native smoke defaults. + Forward an explicitly supplied supported count, including zero, to + `SmokeTestRequest.TransientRetries`. Producer turn, mode, structural repair, + and other execution-only controls do not manufacture smoke work. +4. Interpret returned observations, including partial reports on errors: + + | Observation | Readiness treatment | + | --- | --- | + | Native operation error, cancellation, or reported execution failure | Failed required check; preserve the cause and any gathered evidence. | + | Diagnostic unsupported or known inapplicable, without an independent execution error | No readiness check entry, warning, missing-coverage claim, or replacement test. | + | Supported/applicable check unfinished, or its required result is unknown | Failed required check, not success based on nil error. | + | Reachability | Requires completed diagnostic and affirmative `EndpointReachable`. An HTTP response is reachability, not authentication success. | + | Available authentication | Requires completed diagnostic and affirmative `CredentialsAccepted`. Merely supplying credentials is insufficient. | + | Structured generation | Requires completed generation and affirmative `GenerationCompleted`, `ValidJSON`, and `SchemaMatched`. Do not require unrelated HTTP or text-inference facts. | + +5. Keep native reports/attempts/usage available for debug capture separately from + the small public checks. Preserve native typed error identity. A negative + factual result with nil Go error needs an application outcome cause/message, + not provider-response prose parsing. Strict/permissive mode never changes + these verdicts. + +**Evidence and acceptance:** Native HTTP/client fixtures prove successful probe +deduplication, actual request override propagation, nil-error negative/unknown +facts, unavailable capability handling, and cancellation with partial evidence. +Use independent literal verdicts and exact paid call counts where contractual; +do not reproduce PromptKit's provider test suite. + +**Validation:** `go test ./internal/preflight`. This stage fits one prompt and +does not include filesystem destinations or command/report wiring. + +## Stage 5: Implement Destination Access Probes + +**Goal:** Check only invocation-relevant filesystem access, without cache effects. + +**Inspect:** Existing output/file helpers, cache-mode resolution, configured roots, +`run_debug.go`, `debugbundle`, and cache/state tests. + +**Work:** + +1. Add an ordinary CLI-owned helper using existing creation conventions and the + standard library: create the selected output root if needed, create a temporary + access-probe file, close it, and remove it. Do not allocate a domain output run + directory or publish files. Surface creation/write/close/cleanup failure as + failed output access, retaining its cause. +2. Apply the same temporary-file pattern to the cache root only if selected work + can use it. Resolve cache behavior from actual selected bindings and overrides; + all-bypass or genuinely deterministic work needs no cache access. Auto and + refresh probe identically. Classify cache access/cleanup problems as actionable + warnings, without preventing readiness or initializing a cache store. +3. Reuse the real requested-debug allocation lifecycle, not a separate fake probe. + Stage 7 wires that allocation early in the handler and finalizes it. Debug + failures are required failures, not cache-style warnings. +4. Preserve existing directory permissions/ownership and path conventions. + Newly created destination roots may remain. Add no permission convergence, + new host-access restrictions, or claims about future access persistence. + +**Evidence and acceptance:** Temporary roots verify cleanup, preserved accepted +cache bytes under auto/refresh, absence of cache access in bypass, and distinct +output failure versus cache warning behavior. Use deterministic filesystem +failures such as a non-directory ancestor; do not depend on chmod denial when +tests may run with elevated privileges. Requested debug is covered in Stage 7. + +**Validation:** Focused `go test ./internal/cli` access-probe tests. This stage fits +one prompt; no new configuration or report-storage options are needed. + +## Stage 6: Install The Command And Small Native Readiness Report + +**Goal:** Both command spellings expose the complete non-capture preflight flow. + +**Inspect:** `application.go`, pipeline command declarations, Stage 1 helpers, +Stage 2 parsing, Stages 3–5 operations, native reporting/outcomes, and existing +run report/delivery tests. + +**Work:** + +1. Install `pipeline preflight` and a native top-level `preflight` alias to that + declaration, using the shared pipeline operand, required input, flags, and + checker. Preserve all run inputs. Construction/help must remain lazy. +2. Compose local selection, reference/materialization and complete construction, + source validation, and destination checks before smoke execution. The run + path still performs no automatic smoke work. Do not call `Runner.Run` from + preflight or instantiate an accepted-result store for this command. +3. Define one command report with `pipeline`, `ready`, `checks`, and optional + `debug_directory`. Each check has `id`, structured `scope`, `result` (`passed`, + `failed`, or `warning`), human-readable `message`, and an optional stable + finding `code` where consumers distinguish reasons. Scope identifies the + relevant input/reference/binding/backend/profile/destination. Include multiple + binding associations for shared target checks without duplicate probes. + Keep native reports, credentials, and unrelated effective settings out of + this public report. Emit an empty checks collection as a collection, not a + second report variant. +4. Choose concise, stable check-class IDs; distinguish instances through scope. + Preserve those selected public field meanings in consumer tests and docs, + not incidental prose or private helper structure. Do not add an envelope, + report file, separate failures/warnings arrays, or third readiness state. +5. Accumulate performed local and provider results. A failed required check or + incomplete required work makes `ready` false; cache warnings alone do not. + Preserve existing actionable configuration/materialization diagnostics without + promoting ordinary quality signals to warnings or adding new severity policy. +6. Deliver an available assessment even when not ready, then return the proper + unsuccessful native outcome with retained causes. Early argument/loading + failures without an assessment use existing native errors. Preserve native + configuration/input versus operational categories; do not invent exit codes. +7. Supply concise default text (summary, failures, warnings), successful details + at verbose visibility, and native JSON/YAML serialization of the same value. + Let CommandKit own quiet/mode/format behavior and delivery evidence. Failed + report output must not be treated as operational success or trigger probes + again. + +**Evidence and acceptance:** Both spellings share behavior. Decode successful +and failed JSON/YAML assessments, check default/verbose/quiet native behavior, +and verify malformed arguments need no inputs/state/provider calls. Required +local failures cause no paid probes; deterministic selection needs no engine +diagnostic. Existing `pipeline validate` remains offline. + +**Validation:** `go test ./internal/cli ./internal/preflight`. This stage fits one +prompt by using earlier helpers; requested capture/final failure joining follows. + +## Stage 7: Complete Debug Lifecycle And Failure Preservation + +**Goal:** Requested capture records preparation and smoke evidence, with native +cancellation and independent delivery outcomes intact. + +**Inspect:** `run_debug.go`, `run_capture.go`, `runInvocation.finish`, debugbundle +and recorder helpers, native smoke observation ownership, and capture/recovery tests. + +**Work:** + +1. Start requested debug after the configuration needed to locate its root is + available and before module resolution, engine creation, source/reference + preparation, or destination/provider checks can fail. Reuse run identity, + start-time `latest`, enable/disable precedence, and the real capture lifecycle. +2. Capture useful selected configuration through the existing secret-aware + capture helper, invocation/source/reference context, performed smoke reports, + and terminal failure/readiness. Preserve native credential omissions. Debug + names/layout remain private; do not add a preflight receipt or artifact index. +3. Finalize once on every post-allocation exit. If allocation partially succeeds, + retain the available path. Reuse mechanisms for sticky write failures and + joined operation/capture causes. Do not reuse run's publication claims or + construct extraction/output metadata simply to fit its finish method. +4. Finish capture before report delivery. A failed capture can make the command + unsuccessful independently of a completed positive assessment; a report with + `ready: true` does not override nonzero process status. Failed allocation is + itself a required debug-destination check failure when an assessment exists. +5. Pass the inherited invocation context throughout. Preserve cancellation and + native causes with any capture failure, and do not restart/continue provider + work on cancellation or retry report delivery as another preflight run. +6. Keep native smoke usage in its own retained reports. PromptKit intentionally + excludes it from ordinary execution events; do not synthesize those events, + add smoke totals to ckprompt's ordinary execution group, or introduce custom + usage flags/accounting. Native usage/report controls stay installed normally. + +**Evidence and acceptance:** Cover early preparation capture, failed debug +allocation, start-time `latest`, capture disabled/explicit-empty distinctions, +cancellation plus a capture failure, and report-delivery failure without repeated +finalization/probes. Assert retained causes and useful locations, not private +capture filenames or serialization snapshots. + +**Validation:** `go test ./internal/cli ./internal/core/debugbundle ./internal/framework/debug`. +This stage fits one prompt focused on lifecycle rather than probe policy. + +## Stage 8: Verify The Assembled Consumer Workflow + +**Goal:** Close cross-boundary gaps using real application composition and +simulated external providers, not another implementation-level test matrix. + +**Inspect:** Existing native executable, assembled pipeline, run/reference, +recovery, and schema-loading tests; maintained D&D complete configuration and +its reference/input contracts. + +**Work:** + +1. Add a representative assembled command test with real ConfigKit loading, + production registries, input adapter, reference selectors, and native report + rendering. Use an ordinary valid synthetic transcript and required reference + files, as Narratio will. A local server simulates provider behavior. Adapt + maintained configuration with temporary overlay/provider settings rather + than changing production assets or requiring credentials. +2. Exercise preflight then run as separate invocations. Preflight publishes no + extraction artifacts or accepted entries; run still parses its actual input + and executes normally. A changed/invalid real input after successful fixture + preflight is still rejected by execution. +3. Cover successful shared-profile/backend counts, selected semantic validator + coverage, one representative native override including a supplied zero/empty + where supported, and exclusion of unselected work. Reuse lower-level coverage + for the remaining selection cases instead of multiplying flag combinations. +4. Verify supported/applicable negative observations, no warning for unavailable + capabilities, cache warning with readiness true, failed readiness report plus + unsuccessful exit, and native alias behavior through the assembled route. + Reuse Stage 4/6 tests where they already prove a behavior at the right boundary. +5. Review every verification row in feature-roadmap Section 5 and map it to + existing or newly added test evidence. Add tests only for consequential gaps. + Retain normal offline `pipeline validate` and ordinary run regression coverage. + +**Evidence and acceptance:** Tests are deterministic, offline, secret-free, and +independent of installed live providers. Successful preflight is not asserted to +guarantee later model/domain acceptance. No live API or Narratio subprocess test +is required for the default suite or release gates. + +**Validation:** `go test ./internal/cli ./internal/preflight ./internal/framework/pipeline`. +This stage fits one prompt devoted to assembled verification, not documentation. + +## Stage 9: Document Commands And Consumer Operation + +**Goal:** Document the implemented product surface for operators and consumers. + +**Work and canonical owners:** + +| File | Update | +| --- | --- | +| `docs/cli.md` | Command and alias; shared run inputs and preflight-specific effects; affirmative readiness checks; report/check fields, failed assessments, native statuses, and one implementation-checked structured example. Keep offline validate distinct. | +| `docs/consumers/subprocess.md` | First-class preflight-then-run invocation with references; synthetic versus real input; process status plus optional report decoding on failure. Preserve the successful-run completion protocol separately. | +| `docs/consumers/dnd-pipeline.md` | Brief optional preflight workflow using the maintained full pipeline; link to CLI and generic consumer owners rather than duplicate their contracts. | +| `docs/operations.md` | Provider contact/cost, output/cache temporary probes, cleanup, cache bypass/refresh behavior, requested debug, and remaining destination roots. Link elsewhere for syntax and report fields. | + +Cross-check documentation against the assembled command/help and tests. Use +affirmative user-facing descriptions of performed checks; do not add an unsupported +capability/coverage disclaimer catalogue. Narratio's original request remains +background, with its existing link to the accepted design. + +**Evidence and acceptance:** The structured report example matches the actual +serializer. Consumers can distinguish failed readiness with an available report +from early native errors, and always use process status. The preflight example +and run example preserve identical selections/references without claiming that +a fixture establishes readiness of a future transcript. + +**Validation:** Run both command help routes, inspect the Stage 8 report fixtures, +verify changed local links, and run `git diff --check`. No live-provider run is +needed to verify documentation. Four focused public docs fit one prompt. + +## Stage 10: Align Internal Documentation And Architecture Boundaries + +**Goal:** Document the implemented shared preparation/native smoke boundaries in +their existing canonical homes, with narrow architecture wording changes. + +**Work and canonical owners:** + +| File | Update | +| --- | --- | +| `docs/internal/cli.md` | Shared selection/preparation, separate execution/smoke handoffs, command outcomes and capture ownership. | +| `docs/internal/pipeline.md` and `docs/internal/modules.md` | Shared parse/domain-check seam and small initial-target declaration, only where implementation changed. | +| `docs/internal/state.md` and `docs/internal/llm.md` | Capture/probe lifecycle and the application-specific use of native smoke results; smoke evidence remains separate from ordinary observations. | +| `docs/internal/overview.md` | Update the preflight component row and execution map to reflect implemented boundaries, without creating an architecture policy here. | +| `docs/integrations/pkg-promptkit.md` and `docs/integrations/pkg-commandkit.md` | Briefly identify the application integration of native smoke/reporting APIs and link their selected canonical upstream docs. Do not write a copy of the library manuals. | +| `docs/policy/architecture.md` | Retain offline rules for `pipeline validate` and dependency inspection; distinguish explicit online preflight, its allowed input/probe/capture effects, and pipeline-owned readiness interpretation. Revise the broad statement that capture belongs only to run. Preserve provider/config/CLI ownership and all unrelated constraints. | + +Update only affected sections, keeping these changes concise. No new ADR is +needed for this explicit command within the existing native-kit ownership +decisions. Link upstream for native APIs and keep invocation syntax/report +contracts in `docs/cli.md` rather than repeating them in internal guides. + +**Evidence and acceptance:** Current implementation maps, offline inspection +language, capture ownership, and target-selection declarations are accurate. +Architecture still permits input-free/provider-free offline validation and +shared storage-free loaders, while explicitly permitting the accepted online +preflight effects. No unrelated invariant or safety contract is strengthened. + +**Validation:** Review changed passages against their actual code owners and +tests; check affected local links and `git diff --check`. This is one prompt of +narrow cross-document edits, not a rewrite of the documentation suite. + +## Stage 11: Verify End-To-End Completion + +**Goal:** Complete the sprint with full code, documentation, and scope verification. + +Review every requirement in `preflight.md` against implementation and test +evidence. In `docs/roadmap/future.md`, point feature context to `preflight.md` and +sequencing to this plan. Update implementation status only after successful +verification; do not delete planning documents unless requested. + +Run the final checks using the selected Go toolchain and normal repository setup: + +```sh +go test ./... +go vet ./... +go build ./cmd/notarius +go run ./cmd/notarius help pipeline preflight +go run ./cmd/notarius preflight --help +go run ./cmd/notarius pipeline validate dnd-session --config examples/dnd-complete/config.yml +``` + +The last command stays offline; do not run the maintained configuration's new +online preflight against a real provider as a mandatory check. Verify local +Markdown links in changed documents, run `git diff --check`, and inspect +`git status --short` for accidental binaries, captures, credentials, or generated +data. Remove only build outputs created by this sprint when appropriate. + +**Final acceptance:** All feature-roadmap requirements have corresponding code +and verification evidence; both command spellings work; ordinary run and offline +validation retain their contracts; native target/override/fact semantics are +honored; no accepted cache state is consulted or changed by preflight; capture, +cancellation, and delivery failures retain causes; current documentation matches +the implementation. Record remaining concrete gaps instead of declaring the +feature complete on partial test evidence. This final stage is one prompt. + +## Open Questions + +None. The accepted product decisions are complete. Private helper names, capture +layout, and check-class identifiers may be selected during implementation within +the contracts above; they do not require another product-design decision. + +[smoke-api]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/smoke_diagnostics.go +[inspection-api]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/resource_inspection.go +[promptkit-consumer]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md +[reporting]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/consumers/guide.md#invocation-reporting diff --git a/docs/roadmap/preflight.md b/docs/roadmap/preflight.md index b3fafceb..a4d80ef9 100644 --- a/docs/roadmap/preflight.md +++ b/docs/roadmap/preflight.md @@ -1,13 +1,12 @@ -# Pipeline Preflight Implementation Roadmap +# Pipeline Preflight Feature Roadmap ## Purpose And Status **Status:** Accepted design; implementation not started. -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. +This roadmap defines the target behavior and accepted product decisions for +pipeline-aware preflight. There are no remaining open product decisions. +[Implementation Plan](implementation.md) owns sequencing and implementation tasks. [Narratio's original feature request](narratio-feature-request.md) remains context. The accepted design here governs implementation where it refines that request, @@ -16,8 +15,7 @@ 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 +Private helper types, observer wiring, debug filenames, and exact check identifiers remain implementation choices within the accepted contracts. ## Accepted Direction @@ -201,12 +199,11 @@ 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. -## 5. Verification And Roadmap Handoff +## 5. Verification And Documentation Requirements -**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. +Verify Notarius orchestration with real internal components and simulated +providers. Canonical documentation describes the feature when implemented; +the implementation plan owns that documentation handoff. Use existing configuration loading, registries, input adapters, and temporary files. Simulate external provider contact with a small fake provider or local HTTP @@ -228,81 +225,3 @@ 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.