diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md new file mode 100644 index 0000000..7623313 --- /dev/null +++ b/docs/roadmap/remediation.md @@ -0,0 +1,136 @@ +# 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 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:** Open. + +**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:** Open. + +**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:** Open. + +**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. + +## 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 the remaining diagnostic-delivery gaps. | +| 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.