Record preflight destination requirements and write probes

This commit is contained in:
2026-11-26 23:57:36 +00:00
parent 9dadd97ee6
commit 604ae631b3

View File

@@ -1,6 +1,6 @@
# Dedicated Preflight Command
Status: Core design agreed; quiet-mode destination semantics remain open.
Status: Design decisions agreed; ready for implementation planning.
Implementation has not begun.
## Purpose and Targeted End State
@@ -32,9 +32,9 @@ CommandKit reports which scope was checked and the outcome. No persistent
preflight report format is required for this feature; callers can use exit status.
Ordinary `process` (also invoked as `run`) reuses shared preparation and proceeds
to execution without adding smoke requests to every processing run. Native configuration inspection
and individual PromptKit diagnostic commands remain available for their existing
purposes.
to execution without adding smoke requests to every processing run. Native
configuration inspection and individual PromptKit diagnostic commands remain
available for their existing purposes.
## Current Baseline
@@ -138,13 +138,31 @@ processing reports, or retaining processing debug artifacts. Reporting and debug
flags remain accepted, describing the intended invocation; they do not initiate
the output lifecycle. CommandKit's diagnostic reporting still applies.
Separate destination selection and non-writing checks from acquisition and
publication of output resources. Preserve existing in-place transcript support,
inactive-destination handling, and optional-debug failure severity. Do not open
pipes/devices for delivery or introduce permission-bit simulations, write probes,
or stronger filesystem guarantees to make preflight approximate publication.
Required output parents retain their existing requirements. Output preparation
and actual writes remain execution-time checks owned by the output session.
Separate destination checking and temporary readiness probes from acquisition
and publication of processing outputs. For each active regular-file transcript
or report destination, apply the normal path, destination-type, and collision
checks, then create/open a temporary sibling file for writing, close it, and
remove it. This mirrors the directory access used for regular-file output
preparation while leaving the final destination untouched. Creating the probe
alone does not replace checks on the intended destination itself. Perform these
probes regardless of quiet mode and before provider verification, including when
`--smoke=false` selects local checks only.
Use standard filesystem operations and reuse output-adapter logic where useful.
Attempt cleanup on failures and cancellation and report probe/close/cleanup errors
through existing output-error handling rather than silently reporting readiness.
Do not open the final path with create/truncate flags or initialize ordinary
reports as a write test. Required output parents retain their existing requirements;
preflight does not create missing output directories to make a probe succeed.
Preserve existing in-place transcript support, inactive-destination handling, and
optional-debug failure severity. Pipes and devices use their destination-specific
handling rather than a regular-file probe; preflight must not block waiting for a
pipe reader or write to a stream. Stdout has no transcript-file probe. Required
report destinations are probed only when reporting is enabled. Do not introduce
permission-bit simulations or stronger filesystem guarantees: probes check present
write readiness, while actual output preparation and publication still occur
when processing runs.
Processing performs local preparation, then acquires output resources, initializes
its reports/debug evidence, and executes the prepared stages and chunks. Preserve
@@ -168,24 +186,32 @@ missing required profile selections remain input failures. No new exit-code fami
machine-report schema, or mandatory retained artifacts are selected.
Destination flags describe the would-be processing outputs; standalone preflight
does not emit a corrected transcript. Quiet-mode handling of an omitted destination
is the open decision below. Help/version continue to avoid configuration loading.
Do not turn the command into a general side-effect-free guarantee: ordinary
configured secrets bootstrap still applies, and provider verification is enabled
by default. Link upstream documentation for standard diagnostic behavior rather
than maintaining an Audita copy of the smoke-test reference.
does not emit a corrected transcript. Quiet preflight requires `--output`, including
`/dev/null` when deliberately selected, just as `process`/`run` does. Supplying the
intended destination allows preflight to check where processing would write;
a placeholder does not validate a different eventual output path. Nonquiet
invocations may retain the existing stdout selection when output is omitted.
Help/version continue to avoid configuration loading.
Do not turn the command into a general side-effect-free guarantee: temporary
write probes and configured secrets bootstrap apply, and provider verification
is enabled by default. Link upstream documentation for standard diagnostic
behavior rather than maintaining an Audita copy of the smoke-test reference.
## Work to Reach the Target
1. Refactor shared acquisition and local preparation. Extract destination checking
from output-session preparation, move normalization and chunk planning to the
shared path, and have processing consume the resulting plan. Remove obsolete
duplicate preparation and adjust error ownership with the new boundaries.
shared path, and have processing consume the resulting plan. Add temporary
sibling write probes and cleanup for standalone preflight's active regular-file
destinations, reusing the output adapter's checks without a throwaway processing
session. Processing's real resource preparation continues to establish its own
write readiness. Remove obsolete duplicate preparation and adjust error ownership
with the new boundaries.
2. Add `preflight` using shared processing argument definitions and the default-on
`--smoke` flag. Wire it to local preparation without starting output sessions.
Register `run` as an alias of `process` using the existing command framework
and document it in command help and the CLI reference.
Resolve the quiet-destination decision before finalizing CLI behavior.
Share the quiet-mode destination requirement with processing.
3. Add the native smoke adapter and selected-profile orchestration. Reuse the
existing PromptKit runtime and CommandKit reporting; preserve cancellation and
classify native observations correctly. Keep domain preparation independent
@@ -204,7 +230,7 @@ and controlled provider responses; default tests remain offline and require no
real credentials. Focus coverage on:
- Argument/configuration parity, including overlays, runtime glossaries, stage
overrides, profile fallback, and the selected quiet-mode rule.
overrides, profile fallback, and rejection of quiet preflight without output.
- A representative CLI invocation through `run` exercising the same processing
arguments and outcome behavior as `process`, without duplicating the processing
test suite for the alias.
@@ -215,7 +241,13 @@ real credentials. Focus coverage on:
- Positive and negative structured-output facts, nil-error negative reports,
unknown/unsupported outcomes, provider errors, and cancellation.
- Preflight preserving existing transcript/report files and avoiding output/debug
initialization, while still detecting existing destination collisions.
initialization, while detecting existing destination collisions and invalid
destination types. Verify temporary sibling creation and removal for enabled
regular-file destinations, including local-only and nonquiet invocations.
- Probe, close, and cleanup failures and cancellation; missing required parents;
inactive reports remaining unprobed; and pipes/devices avoiding blocking delivery
opens and stream writes. Use controlled failures rather than permission tests
that depend on the test process's user privileges.
- Processing retaining its output publication and cleanup behavior after the
refactor, without automatically performing smoke tests.
- CommandKit completion, progress, quiet, and exit behavior at representative CLI
@@ -225,29 +257,3 @@ Reuse existing coverage for unchanged domain logic and upstream behavior. Run
focused tests during implementation and the repository's normal full suite and
build before completion. This documentation pass does not execute provider tests
or implement the command.
## Open Decisions
### Should quiet preflight require a transcript output destination?
**Context:** Processing currently rejects quiet mode without `--output` because
it would suppress the only corrected transcript destination. That check lives in
the acquisition helper proposed for sharing. Standalone preflight does useful
readiness work even when its optional summary is suppressed, but accepting the
same arguments would then not imply that quiet processing accepts that exact
destination choice.
**Recommendation:** Allow `preflight --quiet` without `--output`. Quiet controls
the readiness command's own reporting; no corrected transcript is being discarded.
Keep the destination requirement in the processing command, while sharing actual
destination selection and collision checks. This supports simple orchestration
using exit status without requiring a placeholder output path. The tradeoff is
that preflight's quiet/output combination is intentionally different from process.
**Alternative:** Enforce processing's destination requirement during preflight as
well. This gives closer argument-level equivalence for callers switching the
command name and catches a future quiet-processing invocation with no destination.
It requires a destination or `/dev/null` even when the caller only wants a silent
readiness check. Both approaches preserve processing's current rule; choose the
standalone command's meaning explicitly rather than inheriting it accidentally
from a shared helper.