223 lines
14 KiB
Markdown
223 lines
14 KiB
Markdown
# Dedicated Preflight Implementation Review
|
||
|
||
Status: Open findings. Reviewed commit
|
||
`7874ea648b756fe83abb92854b8219e1c4f26aa5` against the eight stages of the
|
||
[implementation plan](implementation.md), the [feature roadmap](preflight-command.md),
|
||
and the preceding baseline `645931c`.
|
||
|
||
The follow-up integration audit reviewed `330044b`, which adds this review
|
||
document without changing application code. It examined each stage's interaction
|
||
with the existing configuration, reporting, output, and execution paths. R1–R3
|
||
remain open; R4 records the additional integration finding.
|
||
|
||
The shared preparation and execution boundaries are implemented. The findings
|
||
below concern diagnostic delivery and documentation accuracy. They do not require
|
||
new readiness gates, stronger filesystem guarantees, or changes to provider
|
||
success criteria. No implementation fixes were made during this review.
|
||
|
||
## R1 — Present actionable native smoke errors
|
||
|
||
**Priority:** P2. **Stage:** 7. **Status:** Complete.
|
||
|
||
**Completion:** Native smoke errors now appear beside their profile and safe
|
||
observations while the original cause remains attached. The missing-model CLI
|
||
regression passes in ordinary, quiet, and debug modes; preflight tests pass with
|
||
Go 1.27.4.
|
||
|
||
**Locations:** `internal/cli/preflight.go:38` and `:53`;
|
||
`internal/framework/llm/smoke.go:72`.
|
||
|
||
**Finding:** The LLM adapter correctly retains each native report and error,
|
||
including partial evidence and cancellation. However, `verificationLine` never
|
||
uses `ProfileVerification.Err`, and the CLI attaches the combined error only as
|
||
the CommandKit outcome's cause. CommandKit preserves that cause for programmatic
|
||
access; it does not automatically present it to the operator. A native error
|
||
without a report therefore loses its actionable explanation on stderr, including
|
||
in debug mode.
|
||
|
||
Reproduced with a selected profile that has an endpoint but no model. Local
|
||
inspection succeeds, then native smoke selection fails. Standalone preflight
|
||
exits 1 and displays only `Profile "selected": negative; smoke usage: unknown`.
|
||
The native `promptkit test structured_output --profile selected` command instead
|
||
explains that the execution model is required. No provider request is needed to
|
||
reproduce this case.
|
||
|
||
**Recommended change:** Include an appropriate native error explanation in the
|
||
per-profile failure details, alongside any available safe report observations.
|
||
Keep the original error attached for `errors.Is`/`errors.As` and retain partial
|
||
reports. Use the existing CommandKit explanation/detail path; do not dump whole
|
||
requests, credentials, transcript content, or raw provider bodies. Keep the
|
||
selected operational exit classification and native ownership of diagnostics.
|
||
|
||
**Acceptance:** A representative native request-preparation error identifies the
|
||
affected profile and explains the actionable defect on stderr, including in quiet
|
||
mode. Existing cancellation identity and partial-report behavior remain intact.
|
||
Add a focused CLI regression for the missing-model case without pinning the
|
||
complete upstream error wording.
|
||
|
||
## R2 — Identify the profile while its smoke check is running
|
||
|
||
**Priority:** P3. **Stage:** 7. **Status:** Complete.
|
||
|
||
**Completion:** A small adapter callback identifies each profile before dispatch
|
||
through CommandKit progress. Adapter ordering and CLI visibility regressions
|
||
cover progress, disabled progress, debug, and quiet modes. Focused CLI and LLM
|
||
tests pass with Go 1.27.4.
|
||
|
||
**Locations:** `internal/cli/preflight.go:36`;
|
||
`internal/framework/llm/smoke.go:64`.
|
||
|
||
**Finding:** The command emits one generic provider-verification progress message,
|
||
then waits for `VerifyStructuredOutput` to finish every selected profile. The
|
||
adapter has no progress notification. Per-profile result messages are produced
|
||
only after the full operation returns and use the informational reporting
|
||
category. Consequently, enabling `--progress` does not identify the profile
|
||
currently being checked, contrary to Stage 7's selected per-profile progress.
|
||
|
||
A controlled two-profile run confirmed that, while the second request was held
|
||
open, stderr contained only the local-readiness and generic structured-output
|
||
messages. This makes a slow check difficult to locate even when the operator
|
||
explicitly requests progress.
|
||
|
||
**Recommended change:** Add a small progress notification at the per-profile
|
||
dispatch boundary and route it through CommandKit's progress reporter. Keep
|
||
verification in the LLM adapter and preserve sequential order, ordinary-failure
|
||
continuation, cancellation, and collected results. A callback is sufficient; no
|
||
scheduler or reporting framework is needed. Preserve native visibility rules,
|
||
including quiet mode and `--progress=false`.
|
||
|
||
**Acceptance:** With progress enabled, the profile being checked is identified
|
||
before its smoke call returns. A controlled blocked-call test can establish this
|
||
without timing assertions or exact message snapshots. Existing result and usage
|
||
presentation continues to follow CommandKit's reporting modes.
|
||
|
||
## R3 — Reconcile the feature roadmap with completed implementation
|
||
|
||
**Priority:** P3. **Stage:** 8. **Status:** Complete.
|
||
|
||
**Completion:** The roadmap now records implementation, labels its original
|
||
baseline as historical, and links canonical current behavior and remaining
|
||
remediation. Affected links and whitespace checks passed.
|
||
|
||
**Locations:** `docs/roadmap/preflight-command.md:3`, `:28`, `:39`, and its
|
||
closing validation paragraph.
|
||
|
||
**Finding:** The implementation plan marks all stages complete, and the canonical
|
||
CLI, operations, subprocess, and internal documentation describes the delivered
|
||
feature. The feature roadmap still says implementation has not begun and that
|
||
the commands are unimplemented interfaces. Its heading "Current Baseline" also
|
||
introduces the former output-coupled preparation path and runner-owned chunking
|
||
without labeling those descriptions as historical. The closing paragraph still
|
||
describes an implementation-free documentation pass.
|
||
|
||
**Recommended change:** Record the actual implementation status and distinguish
|
||
the original reviewed baseline from the delivered architecture. Remove obsolete
|
||
claims that the interfaces are unimplemented or that this remains only a
|
||
documentation pass. Retain the agreed target and rationale while linking to the
|
||
canonical documentation for implemented behavior; no additional behavioral
|
||
contract is needed.
|
||
|
||
**Acceptance:** The roadmap and implementation plan agree about delivery status,
|
||
and historical baseline descriptions cannot be mistaken for current code.
|
||
|
||
## R4 — Integrate preflight with the existing usage-reporting feature
|
||
|
||
**Priority:** P2. **Stages:** 5–7. **Status:** Open.
|
||
|
||
**Locations:** `internal/cli/app_wiring.go:121`,
|
||
`internal/cli/preflight.go:37` and `:47`; upstream ckprompt v0.12.0
|
||
`usage_report.go:24`.
|
||
|
||
**Finding:** The existing global `--show-tokens` feature installs an ordinary
|
||
PromptKit execution observer and renders its final summary. Native smoke calls
|
||
intentionally do not enter that observer. ckprompt recognizes its own
|
||
`promptkit test` route and adds a smoke-usage qualification, but it does not
|
||
recognize Audita's new standalone `preflight` route.
|
||
|
||
Audita presents actual per-profile smoke observations with `Reporter.Info`, which
|
||
is hidden in ordinary reporting mode. Consequently, `preflight --show-tokens`
|
||
can make a provider request and display only an empty observer summary: zero
|
||
prompts, zero tokens, USD 0, and complete terminal coverage. It does not explain
|
||
that this excludes the smoke calls. With `--verbose`, the actual smoke counts
|
||
appear alongside that unqualified zero summary. Preserving observations in the
|
||
adapter does not resolve this presentation conflict.
|
||
|
||
Reproduced with one controlled smoke request reporting 7 prompt tokens,
|
||
3 completion tokens, and 10 total tokens. The command exited 0. Without
|
||
`--verbose`, the explicitly requested usage report showed only zeros; with
|
||
`--verbose`, the profile line showed 10 total tokens while the subsequent
|
||
execution-observer summary still showed zero. Local-only preflight made no
|
||
requests, so its empty observer summary does not demonstrate this defect.
|
||
|
||
**Recommended change:** Integrate the standalone route with native usage
|
||
reporting so explicitly requested smoke usage is visible without requiring
|
||
verbose/debug mode, subject to quiet mode. Suppress the irrelevant empty
|
||
execution-observer summary for this route or clearly qualify its scope while
|
||
presenting the native per-profile observations. Prefer a focused upstream
|
||
ckprompt hook if its current public API cannot express that distinction. Keep
|
||
ordinary processing usage behavior intact. Do not synthesize execution events,
|
||
add local token/cost aggregation, or infer zero cost from absent observations.
|
||
|
||
**Acceptance:** A controlled `preflight --show-tokens` invocation exposes its
|
||
native smoke counts and does not imply that the observer's zero totals describe
|
||
those requests. Unknown/incomplete observations remain truthful. Quiet mode,
|
||
local-only preflight, and processing's existing usage report retain their
|
||
respective behavior. Add focused assembled-command coverage using controlled
|
||
responses; assert meaning and scope rather than the entire upstream rendering.
|
||
|
||
## Stage Review Summary
|
||
|
||
| Stage | Review result |
|
||
| --- | --- |
|
||
| 1 — Checked destinations | Implemented. Checking is separate from resource acquisition; existing path, collision, in-place, stream, staging, and publication behavior is retained. |
|
||
| 2 — Temporary probes | Implemented. Active regular targets receive sibling probes; close/removal failures and cancellation are retained. Stdout, streams, devices, and disabled reports are skipped. |
|
||
| 3 — Domain preparation | Implemented. The provider-independent plan resolves stages and glossary views, normalizes once, fixes chunks, and collects distinct profiles in first-use order. Infeasible requested chunk counts retain input classification. |
|
||
| 4 — Processing handoff | Implemented. Processing consumes the prepared plan and checked destinations, then initializes reports/debug evidence and runs the existing stage pipeline. The runner no longer chunks. |
|
||
| 5 — Shared bindings and routes | Implemented. Preflight shares processing inputs and acquisition; smoke is preflight-only, and `run` is a native alias. Quiet destination checks and existing error classifications are retained. |
|
||
| 6 — Provider verification | Implemented. Native structured-output checks use the captured engine without extra retries or deadlines. Success requires the selected positive facts; native errors and partial reports remain available. |
|
||
| 7 — CLI reporting | Scope, outcomes, native usage presence/completeness, quiet handling, and cancellation are implemented. R1 and R2 cover diagnostic-delivery gaps; R4 covers the conflict with the inherited usage-reporting feature. |
|
||
| 8 — Documentation and validation | Canonical documentation and examples reflect the implementation; the offline suite and build pass. R3 covers stale roadmap status. |
|
||
|
||
## Validation Performed
|
||
|
||
Using Go 1.27.4 with workspace discovery and module network access disabled:
|
||
|
||
- `go test ./...` passed.
|
||
- A source build of `./cmd/audita` passed; the executable was kept outside the
|
||
repository for controlled CLI probes.
|
||
- `go test -race` passed for `internal/cli`, `internal/framework/llm`,
|
||
`internal/framework/preflight`, `internal/framework/runner`, and
|
||
`internal/core/diagnostics`.
|
||
- Controlled CLI probes reproduced R1 and R2, exercised positive/negative native
|
||
diagnostics, and confirmed that local-only preflight against a FIFO with no
|
||
reader returns without opening or writing it.
|
||
- Changed production Go files are formatted; affected local Markdown links and
|
||
`git diff --check` passed.
|
||
|
||
Tests and probes used local fixtures and controlled HTTP responses, without live
|
||
inference or real credentials. No unintended new input caps, credential gates,
|
||
retry/deadline policies, plan authenticity/reusability guarantees, filesystem
|
||
durability guarantees, or correction-acceptance restrictions were found.
|
||
|
||
## Follow-up Integration Audit
|
||
|
||
All eight stages were checked against their existing collaborators:
|
||
|
||
| Stages | Integration evidence and result |
|
||
| --- | --- |
|
||
| 1–2 — Destination checks and probes | Checked paths retain the existing session's collision, canonicalization, stream, and publication rules. Probes are confined to standalone preflight; processing still acquires its real output resources. No additional integration finding. |
|
||
| 3 — Domain plan | Existing normalization/chunking algorithms and glossary-view reuse are preserved. Canonical conversion owns its segment/category data, so moving it earlier does not corrupt later source-debug evidence. No additional integration finding. |
|
||
| 4 — Processing handoff | A controlled multi-stage, two-chunk run retained runtime glossary guidance and both original source-debug documents. Failure of all four proposal operations still returned the normalized transcript with completed ordinary reports. No additional integration finding. |
|
||
| 5 — Bindings and routes | Shared acquisition retained overlays, ordered runtime inputs, bootstrap credentials, source protection, and input/operational error distinctions. The native `run` alias executed the processing path. The inherited usage feature needs R4. |
|
||
| 6 — Native smoke adapter | The same bootstrapped credentials reached native smoke and processing calls. Used profiles were checked in order; the disabled repair role was omitted. Local-only mode made no calls. No additional integration finding. |
|
||
| 7 — Reporting and orchestration | Actual CLI invocations reproduced R4's mismatch between native smoke observations, informational-message visibility, and the inherited execution-observer report. Existing R1 and R2 remain separate findings. |
|
||
| 8 — Documentation and examples | Canonical lifecycle descriptions agree with the checked handoffs. R3's stale roadmap status remains open. The usage-reporting fix should keep the canonical CLI/operations descriptions aligned. |
|
||
|
||
Validation reused the preceding full-suite, build, and race results after
|
||
confirming no Go source or dependency changes since that review. Focused CLI
|
||
tests for reporting modes, runtime-input failures, ordered profiles, resilient
|
||
processing, and preflight passed again with Go 1.27.4. Additional controlled CLI
|
||
probes exercised the interactions above and the `--show-tokens` reporting
|
||
combinations. No live inference or real credentials were used. This follow-up
|
||
changes only the remediation document.
|