diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index ff1c8c5..506a2ec 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -1,6 +1,7 @@ # Automatic Usage Reporting Review -Status: one open documentation finding; production code unchanged by this review. +Status: two open findings: documentation R1 and integration R2. Production code +is unchanged by these reviews. ## Scope and evidence @@ -16,8 +17,10 @@ Reviewed implementation commit `b7467c5` against all eight stages of | 7: consumer evidence | Normal integration installation enables the offline application pipeline without accounting code in its handler. | | 8: documentation and validation | Workspace and isolated-source checks pass. R1 remains in the canonical CLI reference. Published-dependency alignment remains the explicitly planned release follow-up. | -No production correctness defect, missing architectural capability, or -inadvertently strengthened contract requiring remediation was identified. +The initial stage-oriented review identified no production correctness defect, +missing architectural capability, or inadvertently strengthened contract. The +subsequent interaction review below identifies the help-fallback integration +defect R2. Validation used Go 1.27.4: @@ -72,3 +75,90 @@ explain the text percentage presentation and keep provider/accounting semantics linked upstream. Verify the sample against the current DTO or offline consumer. This requires documentation updates, not a production behavior change or a new upstream-domain test suite. + +## R2: Honor ckconfig's help-only fallback before starting invocation features + +**Priority:** P2. **Status:** open. **Plan coverage:** Stages 2–4 and 7–8. + +**Relevant code and contracts:** + +- [prepareConfigOperation](../../integrations/ckconfig/input.go) records a help-only + plan when `config explain` has neither `--path` nor `--list`. +- [runConfigOperation](../../integrations/ckconfig/operations.go) returns + `Invocation.Help()` for that plan before initializing state or acquiring data. +- [App.Execute and prepareFeatures](../../execute.go) enforce required feature + flags before the command's input check reveals that help-only plan. +- [typedCommand.prepare](../../command.go) starts features after successful + `CheckInput`, before ckconfig's `Run` can delegate to help. +- The [existing explain contract](../cli.md#explain-a-configuration-path) defines + the invocation without either mode as help. The new + [invocation-scope target](automatic-usage-reporting.md#invocation-scope) excludes + help from observation and usage summaries. + +**Failure condition:** install ckconfig alongside a nonempty ckprompt family, or +alongside another invocation feature, then enter `config explain` without a mode. +The existing integration represents this help path inside its handler rather +than as a generated builtin or a parser-level help request. The new lifecycle +recognizes only the latter forms before starting features. + +**Expected:** this documented help-only invocation should have the same feature +exemption as explicit help: no usage summary or feature startup, no acquisition, +and no requirement to supply execution-only invocation flags. Ordinary inspection +commands without model executions should still receive the selected zero summary. +Validation failures inside an actual `Run` remain execution as already agreed. + +**Actual and reproduction:** from the repository root, with the maintained offline +consumer and Go 1.27.4: + +```sh +go run ./integrations/ckprompt/examples/composed config explain --show-tokens +go run ./integrations/ckprompt/examples/composed config explain --help --show-tokens +``` + +Both return status 0 and display help. The first additionally emits the standard +zero-token/zero-cost usage summary; the explicit-help invocation emits none. + +A temporary external consumer further confirmed the generic feature interaction: +install `ckconfig.AppCommand` with a loader counter and an invocation feature +having a required Boolean flag and a `Start` counter. `config explain` returns +status 2 with `required flag --feature-required was not supplied`, while +`config explain --help` returns status 0. Supplying `--feature-required` returns +status 0 but calls `Start` once before displaying help. The loader remains uncalled +in all three cases. The temporary consumer did not modify repository sources. + +**Consequence:** equivalent help paths have different output and eligibility +rules. Invocation features can execute callbacks on this help path or prevent +the help display altogether. This is an interaction with an established standard +integration, not a request to reinterpret arbitrary application validation. + +**Remediation approach:** provide a narrow, library-neutral way to communicate a +known help-only preflight disposition to core, and have ckconfig expose its +existing `plan.help` decision through it. Honor that disposition before enforcing +execution-only feature requiredness and before feature input construction/startup. +Keep supplied-value syntax checking and existing main help rendering in the shared +CLI machinery. Preserve requested summaries for real executions, including empty +groups and returned validation/acquisition failures. A report-output heuristic or +blanket suppression of zero summaries would miss the callback/requiredness defect +and discard intentionally supported empty-execution reports. + +**Regression coverage:** exercise ckconfig's implicit explain help and explicit +`--help`, both with normal ckprompt installation and with a generic required +invocation feature. Verify successful help, zero feature-start/provider calls, +and no invocation summary in both paths. Include a real explain operation and an +ordinary non-model command to verify that their requested zero summaries and +execution-only required flags still work. Cover an alias to the help-only command +through the same dispatch behavior. + +## Follow-up interaction audit evidence + +The interaction review used source baseline `b7467c5`, with R1 already recorded +at `70cd68f`. It revisited the eight stages through their existing collaborators: +registry/alias installation, local and shared flag parsing, discovery, reporting, +configuration preflight, native observation, smoke reporting, and consumer wiring. + +All three workspace suites passed afresh with `go test -count=1` on Go 1.27.4. +A temporary external consumer also passed checks combining a late-installed +feature with local shared-debug input, local and feature repeatable values, +scoped/global flag aliases, an alias-only help prefix, operands after `--`, +version, and completion. R2 was reproduced separately despite those passing +suites. No other new interaction defect requiring remediation was identified.