Share diagnostic adaptation across integrations
This commit is contained in:
@@ -256,6 +256,8 @@ with those records, while `Acquired.Diagnostics` carries independent messages.
|
|||||||
Custom explanation providers implement `Explain`; CommandKit renders the
|
Custom explanation providers implement `Explain`; CommandKit renders the
|
||||||
acquired evidence. See `EffectiveWriter` and `ExplanationReader` in the
|
acquired evidence. See `EffectiveWriter` and `ExplanationReader` in the
|
||||||
[ckconfig GoDoc](../../integrations/ckconfig/contracts.go) for the provider boundary.
|
[ckconfig GoDoc](../../integrations/ckconfig/contracts.go) for the provider boundary.
|
||||||
|
`ckconfig.AdaptDiagnostics` captures native diagnostic presentation evidence
|
||||||
|
for applications providing their own ConfigKit-backed CLI integration.
|
||||||
Set `Scope.Features.Overrides` only when the loader passes
|
Set `Scope.Features.Overrides` only when the loader passes
|
||||||
`Selection.Overrides` to ConfigKit as part of its normal load. The integration
|
`Selection.Overrides` to ConfigKit as part of its normal load. The integration
|
||||||
parses CLI records but cannot add them to an already-loaded result. The
|
parses CLI records but cannot add them to an already-loaded result. The
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Consolidated audit catalog
|
# Consolidated audit catalog
|
||||||
|
|
||||||
Status: **15 distinct open findings: 15 P3**, consolidated from 30
|
Status: **14 distinct open findings: 14 P3**, consolidated from 30
|
||||||
numbered entries in seven audit documents. Reviewed audit state:
|
numbered entries in seven audit documents. Reviewed audit state:
|
||||||
`db732e3a1de55c844f77870e1c6db683c2685d5d`.
|
`db732e3a1de55c844f77870e1c6db683c2685d5d`.
|
||||||
|
|
||||||
@@ -426,6 +426,12 @@ records the accepted scope.
|
|||||||
|
|
||||||
## F21 — P3: Both integrations maintain the same ConfigKit diagnostic adaptation
|
## F21 — P3: Both integrations maintain the same ConfigKit diagnostic adaptation
|
||||||
|
|
||||||
|
**Complete.** Both integrations use `ckconfig.AdaptDiagnostics`; focused
|
||||||
|
workspace adapter, acquisition and comparison tests pass, including captured
|
||||||
|
locations, severity grouping, side labels and deferred writer failures. ckprompt's
|
||||||
|
independent check against released ckconfig v0.4.0 remains blocked on release
|
||||||
|
alignment because that version lacks the helper.
|
||||||
|
|
||||||
ckconfig and ckprompt independently snapshot ConfigKit diagnostic evidence,
|
ckconfig and ckprompt independently snapshot ConfigKit diagnostic evidence,
|
||||||
partition severities, construct detail callbacks, label sources, and delegate
|
partition severities, construct detail callbacks, label sources, and delegate
|
||||||
native text formatting. Related Reporter scheduling switches are duplicated too.
|
native text formatting. Related Reporter scheduling switches are duplicated too.
|
||||||
@@ -445,8 +451,7 @@ new module dependency is needed.
|
|||||||
|
|
||||||
CommandKit is pre-release with no consumers; compatibility and migration are
|
CommandKit is pre-release with no consumers; compatibility and migration are
|
||||||
not constraints. The [F21 analysis](remediation-analysis.md#f21--shared-configkit-diagnostic-adaptation)
|
not constraints. The [F21 analysis](remediation-analysis.md#f21--shared-configkit-diagnostic-adaptation)
|
||||||
records the accepted scope and illustrative signature. Implementation remains
|
records the accepted scope and illustrative signature.
|
||||||
pending.
|
|
||||||
|
|
||||||
**Original:** [03-complexity M5](03-complexity.md#m5--p3-configuration-diagnostic-adaptation-is-maintained-in-both-integrations).
|
**Original:** [03-complexity M5](03-complexity.md#m5--p3-configuration-diagnostic-adaptation-is-maintained-in-both-integrations).
|
||||||
Also discussed in the [responsibility assessment](A1-responsibility.md#machinery-worth-retaining-under-the-selected-contracts).
|
Also discussed in the [responsibility assessment](A1-responsibility.md#machinery-worth-retaining-under-the-selected-contracts).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Audit remediation implementation plan
|
# Audit remediation implementation plan
|
||||||
|
|
||||||
Status: in progress; Stages 1–11 complete.
|
Status: in progress; Stages 1–12 complete.
|
||||||
|
|
||||||
Baseline: `d492c7747175c01a53261206c2b4356e53453621`. Before this sprint,
|
Baseline: `d492c7747175c01a53261206c2b4356e53453621`. Before this sprint,
|
||||||
intervening changes recorded decisions and retired the completed older
|
intervening changes recorded decisions and retired the completed older
|
||||||
@@ -412,6 +412,13 @@ Keep F21 open until stage 12 removes the other integration's duplication.
|
|||||||
|
|
||||||
## Stage 12 — Adopt shared diagnostics in ckprompt
|
## Stage 12 — Adopt shared diagnostics in ckprompt
|
||||||
|
|
||||||
|
**Complete.** ckprompt delegates native evidence adaptation to ckconfig while
|
||||||
|
retaining its scope and side headings. Focused acquisition, comparison and
|
||||||
|
diagnostic tests passed in the offline aligned Go 1.27.0 workspace. An independent
|
||||||
|
`GOWORK=off` ckprompt check against its selected ckconfig v0.4.0 failed as expected
|
||||||
|
because that release lacks `AdaptDiagnostics`; released dependency alignment
|
||||||
|
remains separate work.
|
||||||
|
|
||||||
Findings: F21 completion. Source: ckprompt `adapters.go` and related tests.
|
Findings: F21 completion. Source: ckprompt `adapters.go` and related tests.
|
||||||
|
|
||||||
1. Make promptKitDiagnostics call ckconfig.AdaptDiagnostics. Preserve its current
|
1. Make promptKitDiagnostics call ckconfig.AdaptDiagnostics. Preserve its current
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"go.maximumdirect.net/ckconfig"
|
"go.maximumdirect.net/ckconfig"
|
||||||
@@ -511,61 +510,10 @@ func appendPromptKitAcquisition(left, right promptKitAcquisition) promptKitAcqui
|
|||||||
}
|
}
|
||||||
|
|
||||||
func promptKitDiagnostics(scope, side string, sources []configkit.SourceInfo, records []configkit.Diagnostic) promptKitAcquisition {
|
func promptKitDiagnostics(scope, side string, sources []configkit.SourceInfo, records []configkit.Diagnostic) promptKitAcquisition {
|
||||||
if len(records) == 0 {
|
|
||||||
return promptKitAcquisition{}
|
|
||||||
}
|
|
||||||
// Snapshot provider-owned slices before deferring their report to invocation.
|
|
||||||
sources = append([]configkit.SourceInfo(nil), sources...)
|
|
||||||
records = append([]configkit.Diagnostic(nil), records...)
|
|
||||||
for index := range records {
|
|
||||||
if records[index].Primary != nil {
|
|
||||||
primary := *records[index].Primary
|
|
||||||
records[index].Primary = &primary
|
|
||||||
}
|
|
||||||
records[index].Related = append([]configkit.Location(nil), records[index].Related...)
|
|
||||||
}
|
|
||||||
var warnings, failures []configkit.Diagnostic
|
|
||||||
for _, record := range records {
|
|
||||||
if record.Severity == configkit.SeverityError {
|
|
||||||
failures = append(failures, record)
|
|
||||||
} else {
|
|
||||||
warnings = append(warnings, record)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
messages := promptKitAcquisition{}
|
|
||||||
if len(warnings) > 0 {
|
|
||||||
messages.diagnostics = []commandkit.Diagnostic{{
|
|
||||||
Severity: commandkit.SeverityWarning,
|
|
||||||
Write: func(writer io.Writer) error {
|
|
||||||
return writePromptKitDiagnostics(writer, scope, side, sources, warnings)
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
messages.explanation = commandkit.Explanation{Details: []commandkit.Detail{func(writer io.Writer) error {
|
|
||||||
return writePromptKitDiagnostics(writer, scope, side, sources, failures)
|
|
||||||
}}}
|
|
||||||
}
|
|
||||||
return messages
|
|
||||||
}
|
|
||||||
|
|
||||||
func writePromptKitDiagnostics(writer io.Writer, scope, side string, sources []configkit.SourceInfo, records []configkit.Diagnostic) error {
|
|
||||||
heading := "Configuration scope " + strconv.Quote(scope)
|
heading := "Configuration scope " + strconv.Quote(scope)
|
||||||
if side != "" {
|
if side != "" {
|
||||||
heading += " (" + side + ")"
|
heading += " (" + side + ")"
|
||||||
}
|
}
|
||||||
if _, err := fmt.Fprintf(writer, "%s:\n", heading); err != nil {
|
diagnostics, explanation := ckconfig.AdaptDiagnostics(heading+":\n", sources, records)
|
||||||
return err
|
return promptKitAcquisition{diagnostics: diagnostics, explanation: explanation}
|
||||||
}
|
|
||||||
if len(sources) > 0 {
|
|
||||||
if _, err := io.WriteString(writer, "Source IDs:\n"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
for _, source := range sources {
|
|
||||||
if _, err := fmt.Fprintf(writer, " %s: label=%s, path=%s\n", strconv.Quote(source.ID), strconv.Quote(source.Label), strconv.Quote(source.Path)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return configkit.WriteDiagnostics(writer, records)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user