535 lines
34 KiB
Markdown
535 lines
34 KiB
Markdown
|
|
# 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
|