diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index 7623313..366b125 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -5,6 +5,11 @@ Status: Open findings. Reviewed commit [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 @@ -101,6 +106,51 @@ 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 | @@ -111,7 +161,7 @@ and historical baseline descriptions cannot be mistaken for current code. | 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. | +| 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 @@ -134,3 +184,25 @@ 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.