From 82c52c8e7fd0d5f1f0d1384453f139566013a882 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Mon, 23 Nov 2026 03:07:00 +0000 Subject: [PATCH] Plan the coordinated library adoption sprint --- docs/roadmap/implementation.md | 501 +++++++++++++++++++++++++++++++ docs/roadmap/library-upgrades.md | 88 ++---- 2 files changed, 529 insertions(+), 60 deletions(-) create mode 100644 docs/roadmap/implementation.md diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md new file mode 100644 index 0000000..f001038 --- /dev/null +++ b/docs/roadmap/implementation.md @@ -0,0 +1,501 @@ +# Library Adoption Implementation Plan + +**Status:** Ready for implementation. Planning baseline: +`12fd2fba6b88e30eb482227ac786201caa84616b`. + +**Audience:** Luna coding agent implementing one stage per prompt, in the +numbered order below, during one end-to-end sprint. + +The [feature roadmap](library-upgrades.md) owns the target state, adoption +decisions, upstream revisions, and release authorization. This document owns +the implementation sequence. Read `docs/development.md` and the applicable +policies before each stage; follow the agent, architecture, testing, +documentation, OSS, and release policies for the work they govern. + +## Execution Instructions + +- Implement the final design directly. Intermediate stages may fail to compile + while callers and tests are being migrated. Stage acceptance describes the + completed portion of the final design, not a requirement for an independently + buildable intermediate release. Do not add temporary adapters, legacy loaders, + compatibility serializers, or placeholder implementations to keep stages green. +- Update affected tests with their owning implementation. Run focused checks + once their dependencies compile; otherwise record the specific deferred check + and complete it in the final stage. Do not repeatedly run the full suite while + the coordinated changes are incomplete. +- Preserve domain behavior: proposal identity, applicability, protection, + editorial acceptance, validator reconciliation, semantic correction repair, + deterministic collection, recoverable failures, cancellation/joining, and + transcript/ordinary-report publication. The deliberate changes are those + selected in the feature roadmap, including prompt-owned structural contracts, + startup classification, and debug representation. +- Test Audita's integration decisions and transformations. Use native libraries + with controlled clients, files, and environment values; do not reproduce their + complete test matrices or freeze prompt wording and upstream report layouts. +- Commit completed units with plain-English messages under the agent policy. + State honestly when a commit's validation depends on a later stage. This plan + is for separately requested implementation and release-document preparation; + publication remains a later release task. + +## Stage 1: Select the Dependencies and Compose One Application Configuration + +**Outcome:** One typed application configuration contains Audita settings and +native PromptKit settings, with one source-composition path. + +1. Update `go.mod`/`go.sum` to the feature roadmap's matched set: ConfigKit + v1.4.0, PromptKit v0.25.0, CommandKit v0.8.0, ckconfig v0.11.0, and ckprompt + v0.12.0. Keep the `/v4` module path, Go 1.27.0 minimum, selected release + toolchain, and ReleaseKit selection. Use normal module resolution, without + local replacements or workspace dependencies. Compile failures from removed + APIs are expected until the later stages. +2. Keep `internal/core/config.Config` as the reusable domain settings type. + Extract its existing defaults, version rule, sequence identities, recorded + resolution, and validation into an exported `Definition()` returning + `configkit.Definition[config.Config]`. Preserve application schema version 3. + Source discovery and embedded PromptKit assembly do not belong in this core + definition. +3. Add a small application assembly package, `internal/appconfig`, with a root + type containing `Application config.Config` tagged `yaml:",inline"` and + `PromptKit promptkit.Settings` tagged `yaml:"promptkit"`. The inline field + keeps Audita's YAML paths unchanged. Lift the domain definition's callbacks + onto `Application`, passing through the same native resolution/validation + objects and root paths; preserve its version rule, identities, and any + sensitivity rule. Compose the result with `promptkit.Configure`. +4. Assemble native underlays in increasing precedence: + `promptkit.BundledOpenRouterUnderlay()`; embedded Audita prompts and the + embedded schema-root input; + optional main-relative glossary and prompt companions. Main, selected + overlay, and explicit overrides follow those underlays through the normal + layered load. Retain the existing distinction between strict composition + within an underlay group and replacement by a later group. +5. Discover embedded definitions with `promptkit.FilesystemInputs` and set each + fragment's destination to `/promptkit`. Install `SchemaRootSource` at the + same destination with the existing embedded schema filesystem and asset + root as its explicit filesystem context. Keep the schema JSON assets shared. +6. Move the glossary-import assembly and `operatorImports` declarations into + this source-composition boundary. Keep their existing names, optionality, + recursive patterns, and selected-main anchoring. Use `MainRelative` for + companion directive inputs; enable native imports and mount wrapperless + prompt companions at `/promptkit`. Do not add a working-directory fallback + when there is no main source. Check relative import destinations in their + fragment context. +7. Replace the application-only production `config.Load` path with this + assembly. Move source-composition tests to `internal/appconfig`; core tests + can load their domain definition through a small test-local native loader. + Do not retain another production loading route solely for old test helpers. + +**Acceptance and focused verification:** Defaults, explicit version validation, +domain resolution, and glossary identities retain their existing paths and +behavior. A combined native result exposes `/promptkit` as `promptkit.Settings`. +Representative composition tests cover a wrapperless companion, a source-local +message, a main setting, and an overlay override. Main/companion behavior with +no selected main is covered. Neither assembly nor these tests contacts a +provider. The former `WithSchemaFS` users will be removed in Stages 3 and 4. + +## Stage 2: Bootstrap Secrets and Wire Shared CLI Acquisitions + +**Outcome:** Processing and native configuration commands use the same +bootstrap-before-load path and retain its safe evidence. + +1. In `internal/appconfig`, make the load entry point return the completed + native result, `*configkit.SecretsReport`, and error. Pass the selected host + `File`/`SearchConfig` source to `LoadSecretsIntoEnvironmentFromConfig` before + `LoadLayered`. Pass through any explicitly selected host filesystem context + during preparation and reuse its returned prepared main as the later input. + Do not rediscover the file or run bootstrap during engine construction. +2. Preserve native behavior for absent optional discovery, missing directory + declarations, overwrite controls, and partial effects. On bootstrap failure, + return its report and original cause without loading configuration or + starting transcript/output preparation. Check the caller context before and + after the synchronous preparation/load boundaries; retain cancellation + identity alongside any native failure already returned. +3. Update `internal/cli/app_wiring.go` and `process_inputs.go` to use the combined + result. Pass only its `Application` settings to normalization, preflight, + modules, validators, and the runner. Keep native inspection of the whole + result for the `app` scope and native PromptKit inspection for `promptkit`. + Debug effective configuration uses the completed result's native rendering. +4. Keep the invocation-local engine capture used by request inspection. Reuse + a completed acquisition where one command needs both its result and engine; + do not bootstrap twice for that handoff. Comparison loaders still acquire + each side independently, even for equal selections. Their environment is + ordinary shared process state, as selected in the roadmap. Do not introduce + process-global caches or credential-environment isolation. +5. Present successful bootstrap entry details through ordinary verbose/debug + diagnostic reporting and retain the report on error. For uniform access + from native loader callbacks, use one small, flagless CommandKit invocation + feature to put a CLI-owned report sink in the invocation context. Attach it + once through a declaration; its sole job is forwarding safe bootstrap + details to the existing reporter. It adds no final usage report or new + reporting framework. Pass contexts through rather than replacing them with + background contexts. +6. On failure, keep native load diagnostics/source evidence in the established + CommandKit acquisition path. For `SecretsError`, include its safe native + diagnostics and report in terminal error context so ordinary/quiet mode + still explains the failure. A narrow error wrapper may retain this context + while unwrapping to the original error; do not invent a second classifier. + Use `ckconfig.ClassifyConfigurationError`: native usage errors remain usage + errors and unclassified bootstrap/runtime failures remain operational. + Preserve reporter write-error handling. +7. The flagless feature and loaders must remain uninvoked for generated help, + version, completion, input preflight failures, and bare `config explain`'s + help fallback. Configuration inspection still requires no processing-ready + pipeline or model credentials, although configured bootstrap may populate + the process environment. + +**Acceptance and focused verification:** A temporary secrets directory supplies +a synthetic credential that the shared load/engine can consume. Test one +overwrite selection through Audita wiring and a failed bootstrap with safe +terminal evidence, retained native cause, no output preparation, and no provider +request. Use nonparallel environment-changing tests and restore test variables. +Exercise prepared-main reuse at this boundary without cloning upstream's full +file/overwrite test matrix. Check help-only paths and representative native +inspection; use existing `app_wiring_test.go` and process input tests as owners. + +## Stage 3: Construct the Engine from the Result and Track Native Source Origins + +**Outcome:** The LLM runtime captures resources from the shared result without +loading a second configuration or reconstructing a filesystem context. + +1. Update `internal/framework/llm/runtime.go` to use `promptkit.NewFromConfig` + with the captured result and `RuntimeConfig{HTTPClient: client}`. Accept the + public `promptkit.Configuration` handoff interface where only native result + access is needed. Keep domain settings as separate inputs at their actual + consumers; remove the runtime's unused stored configuration copy. +2. Remove `newEngineWithPromptFS`'s source reconstruction, duplicate discovery, + `pk.NewEngine` production construction, `WithSchemaFS`, and + `embeddedAssetOrInputError`. Tests that inject alternate assets should do + so at the source-assembly boundary, not through an embedded-only diagnostic + engine. Keep checking required shipped prompt identities where needed for + existing runtime readiness. +3. Preserve original `LoadError`/engine errors, source records, and error chains + through CLI classification. For directly identified application asset-access + failures, use a small assembly-owned asset error rather than reconstructing + another engine. Replace the former `llm.AssetError` plumbing accordingly. + A defect that only manifests as a native configuration error may retain + that native classification, as authorized by the roadmap. +4. Rewrite `source_paths.go` around the captured typed settings and effective + native origins. Traverse root prompts and namespaced collection prompts; + use native paths under `/promptkit` for `content_file` metadata. Associate + host message paths with their actual contributing acquired source/context, + including inherited/replaced definitions. Keep acquired host configuration + sources in the protected set. Embedded/native filesystems do not acquire + invented host paths. +5. Remove effective-YAML rendering and partial YAML decoding from path discovery. + Feed the resulting source/message set into the existing output-collision + checks. Preserve their existing semantics, including intentional in-place + transcript replacement and protection of consumed configuration/messages. + Do not add an independent filename scan or another source resolver. +6. Adapt `loadProcessInputs`, `prepareProcess`, and their tests to the combined + result and domain subvalue. Keep the existing order of configuration/runtime + preparation, transcript acquisition, processing preflight, and output setup. + +**Acceptance and focused verification:** Tests in `engine_sources_test.go`, +`source_paths_test.go`, `runtime_inspection_test.go`, and CLI output tests cover +shared handoff, main-relative companions in a wider selected host root, +source-local/inherited message paths, native inspection without provider access, +and retained collision protection. Replace reconstruction-specific asset tests +with focused shipped-asset preparation checks and original-error preservation. +Cancellation remains operational and retains its identity. + +## Stage 4: Use Prompt-Owned Contracts and Recover Invalid Response Decoding + +**Outcome:** Processing and native previews honor the same prompt definitions; +Audita's structural contract override and setting are retired. + +1. In `adapter.go`, leave `RunRequest.Validation` unset for ordinary and + coordinated calls. Remove `OutputContract` and all request-time schema/budget + replacement code. Keep explicit role profiles, transient retry controls, + operation deadlines, exchange capture, prepared notifications, and operation + execution counts. +2. Remove `structuredoutput.Request.Schema` and its plumbing in proposal + generation, LLM validators, semantic-repair requests, test doubles, and + diagnostic metadata. A selected prompt now supplies its contract. Preserve + Audita's existing expected domain DTOs and domain validation. +3. Remove `config.LLM.RepairAttempts`, its root default, stage inheritance, + validation, resolved-setting copies, request plumbing, and any remaining + associated CLI exposure. The current process flag table has no dedicated + structural-repair flag; do not introduce one. Keep `CorrectionRepairAttempts` + and its profile selection, and keep transient retries and operation timeouts. + The old YAML key has no translation or compatibility handling. +4. Keep the embedded JSON schema files and a minimal filesystem/asset-root + accessor in `internal/framework/responseschema`. Remove key enums, schema + lookup maps, hashes, diagnostics maps, eager registry decoding, and tests + that solely maintain that retired registry. Retain only loading support + actually needed by native schema-root assembly or shipped-asset tests. +5. Keep the shipped proposal, validation, and repair schema references in their + prompt definitions. Omit `output.repair_attempts` in shipped definitions so + PromptKit resolves its default. Operator replacements supply their own + compatible contracts, including any explicit budget. Do not inject defaults + into their definitions or require them to use a particular schema identity + or validation mode beyond existing native configuration rules. +6. In `finishResponse`, treat `json.SyntaxError` and `json.UnmarshalTypeError` + from the model response as recoverable `invalid_output` failures. Retain the + fatal invalid-target check before execution and fatal handling of actual + application programming errors. Apply this classification to coordinated + repair delivery through the same finish path. Preserve parent cancellation + precedence and current timeout classification. +7. Keep local proposal shape/applicability/protection checks, decision-set + reconciliation, repair response identity checks, and apply-time safety. + A weak operator contract is not a reason to restore per-call schema + enforcement. Do not add another repair loop after failed JSON decoding. + +**Acceptance and focused verification:** Prepare all eleven shipped prompts +through the new assembly and their configured schemas. Use controlled responses +to prove that ordinary proposal/validation and coordinated repair honor native +prompt contracts, including an operator replacement and explicit zero/nonzero +budgets. For the omitted budget, derive expectations from native inspection +rather than duplicating upstream's default-resolution implementation. Under a +permissive operator contract, malformed JSON/type-incompatible responses become +recoverable errors; an invalid application decode target remains fatal. Include +an assembled partial-success case showing usable sibling work continues. Update +adapter, conversation, proposal, validator, runner, and config fixtures at their +existing ownership boundaries. + +## Stage 5: Retain Native Execution Evidence in the Collector + +**Outcome:** Execution collection carries Audita attribution around native facts, +with native aggregation and no redundant metric representations. + +1. Change `llm.ExecutionObservation` to carry `call_id`, domain `context`, and + a `promptkit` field containing the public `promptkit.ExecutionEvent` value. + Preserve the existing `LogicalCall` attribution, start/finish facts, and + logical call IDs; those are Audita-owned rather than native run IDs. +2. Remove `llm.TokenCount`, `Usage`, and the copied fields in execution events. + Keep one native invocation `ExecutionGroup` and native per-call aggregation + where the debug view needs it. Feed or replay native events into native + groups rather than converting them back from local token DTOs. +3. Replace `ExecutionSummary`'s metric projection with Audita's logical-call + count plus the native `ExecutionGroupSummary`. Preserve the distinction + between pre-execution logical calls and actual native runs; a pre-dispatch + failure need not manufacture a run or prepared request. +4. Keep callback synchronization, copied domain coordinates, deterministic + presentation ordering, and snapshots after work joins. Preserve terminal + evidence for failures and canceled/undelivered coordinated responses. + Do not register the same collector through both a request observer and + context observation. The independent native CLI usage group in Stage 7 + may observe the same runs for its own view. +5. Keep `outcomes.ExecutionCounts` and the small adapter projection from a + terminal event into provider attempts, retries, structural repairs, HTTP + status, and exhaustion. Those are used by domain outcomes and ordinary + reports and remain independent of debug-native DTOs. + +**Acceptance and focused verification:** Collector tests check call/run +attribution, concurrent collection, snapshot ownership, and native evidence +retention. Read reasoning, cache, cost, usage availability/completeness, and +terminal coverage directly from the native structures. Reuse existing native +group behavior rather than retesting its aggregation algebra or provider +decoders. Ordinary-report counts and role progress still function without +debug capture. + +## Stage 6: Serialize the Native Diagnostic Envelope + +**Outcome:** One debug format exposes native evidence with Audita's stage, +section, role, and proposal/batch attribution. + +1. Update `internal/framework/processreport/llm.go` so `llm-execution.json` + retains top-level `summary`, `calls`, and `events`. The summary contains + `logical_calls` and nested `promptkit` native group evidence; calls retain + their Audita identity/context and native per-call evidence under `promptkit`; + events contain `call_id`, `context`, and nested `promptkit` native events. + Use public PromptKit types for those nested values. Their native JSON field + names and duration representation need not match the old local projections. +2. Keep `IndexLLMObservations`'s deterministic proposal-index adjustment on + Audita coordinates. It must not rewrite native run identity or provider + evidence. Remove `mapLLMSummary` and corresponding copied metric structures + in `internal/core/reporting/llm.go` when their consumers are gone. +3. Capture the actual `PreparedRun` at the adapter's prepared notification when + debug evidence is requested, including its contract, structured schema + evidence, and `MessageContentHash`. Forward it as optional opaque diagnostic + data through the application boundary and serialize it under `promptkit` in + the interaction request payload. Keep the small domain prompt metadata used + by logical calls; remove independent registry-schema metadata from request + construction and artifact builders. +4. Adapt `structuredoutput.PreparedSnapshot`, proposal/validator interaction + builders, semantic-repair artifact capture, and the diagnostic writer only + as needed for that native payload. Keep necessary domain-neutral message + snapshots where indexed repair history sharing uses them. Preserve the + existing sharing of unchanged message prefixes and final index/path binding; + do not reintroduce full transcript/history copies to normalize native JSON. + Native execution types remain inside adapters/diagnostics, not module or + validator decision logic. +5. Retain the correction ledger's Audita domain fields, optional debug-write + warning handling, and preparation/undelivered-response evidence. Use one + serializer for the new representation; no old-format output switch is + required. Ordinary errors/recoveries/report files keep their current schemas. + +**Acceptance and focused verification:** Existing processreport and debug +integration tests verify the new envelope, correct section/proposal offsets, +semantic-repair attribution, actual prepared contract/hash, and native +reasoning/cost evidence. Test selected meaningful fields and preserved unknown +versus zero states; do not snapshot the complete upstream event structure. +Confirm debug remains optional and capture-disabled processing avoids prepared +message snapshots. Keep partial artifact-write failure coverage. + +## Stage 7: Exercise Native CLI Usage Reporting and the Assembled Pipeline + +**Outcome:** The installed ckprompt family supplies invocation usage reporting +for Audita processing, and all command paths use the new assembly. + +1. Keep the existing `ckprompt.Declarations` installation, which brings native + `--show-tokens`. Resolve any actual assembly collisions without creating an + Audita-owned duplicate flag or usage formatter. Keep the Stage 2 bootstrap + report sink separate from this upstream final-report feature. +2. Trace `Invocation.Context` through processing, derived worker contexts, + ordinary model calls, coordinated repairs, and nested validators. Preserve + its values and join owned work before returning. Do not install an extra + accounting observer into each handler for the native CLI summary. +3. Adapt application-native inspection tests for `/promptkit` paths, prepared + contracts/hashes, provider declarations, and native smoke output. Structured + smoke consumers and tests request `--format yaml` or `--format json`; default + text output follows upstream. Keep explicit smoke probes opt-in. +4. Update native adapter and assembled HTTP fixtures to use the appropriate + explicit provider when testing OpenRouter/vLLM evidence. Preserve generic + OpenAI-compatible examples and do not infer `zero_cost` or a provider from + endpoint/ID. Let upstream validate and interpret those settings. +5. Add or adapt representative assembled tests combining proposal, validation, + and semantic repair. Verify observed usage with debug off, with debug on, + and on a returned failure/cancellation. Check transcript stdout isolation, + quiet suppression, help-only paths, and coexistence with ordinary reports. + A normalization-only pipeline can exercise native zero-execution reporting. + +**Acceptance and focused verification:** Existing CLI and subprocess tests pass +with controlled responses and no real credentials or paid calls. The native +summary includes executions reached through the pipeline's contexts and is +independent of optional debug retention. Compare meaningful observed counts to +the controlled workload, without copying CommandKit's report template or +PromptKit's full retry/cost accounting suite. Keep Audita's ordinary completion +message, partial-success behavior, capacity sharing, and output lifecycle. + +## Stage 8: Update Maintained Examples, Migration Guidance, and Canonical Docs + +**Outcome:** Documentation explains Audita's changed integration and links to +upstream for library behavior; maintained projects exercise the target model. + +1. Follow the feature roadmap's documentation-consolidation table and the + adopted documentation policy. Keep Audita's paths, mounts, role choices, + domain response requirements, output lifecycle, and error mapping local. + Replace repeated upstream feature descriptions with links applicable to the + imported versions. Keep brief Audita workflow examples discoverable. +2. Update `docs/config.md`, `docs/cli.md`, `docs/operations.md`, and affected + integration docs. Remove the retired Audita structural-repair setting. + Identify shared loading, configured bootstrap availability and when Audita + invokes it, and native usage reporting. Explain the changed startup error + mapping. Link upstream for controls, native commands, providers, credentials, + schemas, and token/cost semantics. +3. Add `docs/migrations/v4.1.md` for this conversion. Cover removal of root/stage + `llm.repair_attempts`, prompt-level budget selection and the changed omitted + default, operator output contracts, native inspection paths, debug-format + changes, and native smoke format selection where scripts are affected. + Keep application configuration version 3 and wrapperless companions. + Explain that former stage-specific structural budgets now become choices + for the selected prompt; do not promise an automatic one-to-one conversion. +4. Give the budget migration a concrete, valid example using the existing + complete grammar prompt replacement in `examples/prompt-edit/prompts.yml`. + Add an explicit `output.repair_attempts` there while retaining its messages, + format, validation mode, and schema reference. Validate the example through + the real loader; do not present a partial same-ID record as a field patch + when native replacement discards its lower record. +5. Update `examples/local`, `service`, `prompt-edit`, and `campaigns` and their + integration fixtures as needed. Keep generic/local service identities and + synthetic credentials. Add a small synthetic bootstrap fixture to the + existing maintained-example tests rather than checking in real secret files. + Validate a prompt-owned budget example with the native engine; keep complete + copyable inputs in `examples/`, with migration prose linking to them. +6. Update internal overview, CLI/configuration recipes, runtime, prompts, + diagnostics, modules, and validator docs where ownership or call signatures + changed. Remove references to retired registries, schema overrides, metric + DTOs, and the diagnostic reconstruction. Document the Audita envelope and + its native nested evidence without maintaining a duplicate upstream schema. + Keep existing accepted ADR decisions and historical release notes intact. +7. The upstream documentation policy v1.13 is already adopted. Apply it; no + further policy edit is needed merely to restate its upstream-dependency rule. + +**Acceptance and focused verification:** Maintained projects load, native +previews resolve the schemas they use, and controlled processing examples pass. +The migration example actually selects the intended budget without losing the +prompt's messages or schema. Check affected local links and examples. Readers +can find the imported libraries' canonical docs, while Audita's behavior remains +understandable without duplicated library manuals. + +## Stage 9: Refresh Attribution and Prepare v4.1.0 Release Documentation + +**Outcome:** The changed dependency selections and application migration have +accurate notices and a checked-in release record ready for later publication. + +1. Update the five dependency entries in `docs/oss/attribution.md` to the + roadmap's exact versions and full source commits. For ckconfig/ckprompt, + use their independently tagged integration commits and correct nested + notice paths. Inspect the selected `COPYRIGHT`/`LICENSE` material, preserving + `LGPL-3.0-or-later` and applicable companion-text links under the OSS policy. +2. Reuse applicable local standard license texts. Review any transitive changes + actually selected by normal module resolution, updating only affected + entries. The toolchain, YAML v4 selection, and ReleaseKit remain unchanged; + this work does not require rewriting unrelated notices or published records. +3. Create `docs/releases/v4.1.0.md`, beginning `# Audita v4.1.0`, and index it in + `docs/releases/README.md`. Describe the shipped upgrade, bootstrap capability, + native usage reporting, and the configuration/debug/inspection/error-mapping + changes with links to canonical Audita guidance and the migration guide. + Explain actual breaking changes and required action plainly. The feature + roadmap owns the release authorization; do not repeat its versioning-override + discussion in the release note or change the release policy. +4. End the release note with the runbook's absolute, immutable v4.1.0 links + labeled `COPYRIGHT | LICENSE | ATTRIBUTION`. Check those paths against the + source tree; the unpublished tag need not resolve. Keep Audita's `/v4` import + path. Prepare documentation only: do not tag, push, run `publish`, or wait + for CI as part of this sprint plan. + +**Acceptance and focused verification:** Attribution versions/commits agree +with module metadata, license links reach the proper texts, and the release +note accurately describes the implemented migration. Required footer paths and +the release index resolve locally. No historical release content is rewritten. + +## Stage 10: Finish Cleanup and Validate the Complete Target State + +**Outcome:** The complete adoption compiles, passes the offline suite, builds +both production targets, and contains no retired implementation path. + +1. Review every stage's deferred checks and complete them. Remove superseded + tests, imports, files, helper DTOs, and comments that only served the old + loader, schema registry, per-call structural contracts, embedded-only probe, + or debug metric projections. Retain domain and integration coverage serving + the current contracts. Keep the tests for unavailable decisions, empty + replacement spans, semantic repair, and output failures. +2. Search active application/test code and maintained current docs for retired + references: `WithSchemaFS`, `embeddedAssetOrInputError`, per-call + `Request.Schema`, the removed schema registry/builder, and Audita's root/stage + structural budget. Distinguish legitimate native `repair_attempts`, semantic + correction-repair settings, migration explanations, and historical records + from stale production support. Do not make a blanket zero-occurrence rule. +3. Review the final dependency direction: core domain code does not acquire + CLI/provider responsibilities; `internal/appconfig` composes configuration; + runtime constructs from the result; modules/validators retain their domain + contracts; debug-native types stay at the adapter/diagnostic boundary. +4. Use the selected Go 1.27.4 toolchain and prepare module dependencies before + offline validation. Run `go mod tidy` and review its diff, format changed Go + files, run `go vet ./...`, and run `go test -race ./...` once on the completed + source. The race-enabled command covers the complete default suite; do not + require a second full non-race run for this same state. Fix failures according + to their actual contract; repeat affected checks when fixes warrant it. +5. Build `./cmd/audita` for Linux amd64 and arm64 using `GOOS=linux`, the selected + `GOARCH`, and `CGO_ENABLED=0`, writing binaries to a temporary directory. + Native macOS testing is best effort and is not a prerequisite. Check affected + documentation links, examples, and `git diff --check` without introducing + new recurring release gates or running the publication command as a test. +6. Review the final diff against the feature roadmap: all selected capabilities + are present, intentional migrations are documented, ordinary output and + resilience behavior remain covered, and cleanup is complete. Commit the + final changes under the agent policy and report validation results and any + actual limitations. A later release task follows the existing runbook. + +**Acceptance:** All ten stage outcomes are satisfied, required checks pass on +the final source, no outstanding implementation work is hidden behind a +compatibility path or temporary scaffold, and the workspace is clean. Report +the completed source commit and prepared release documentation without claiming +that v4.1.0 has been published. + +## Open Questions + +None. Product choices are resolved by the feature roadmap. The private assembly +package, shared-load handoff, diagnostic envelope, startup reporting integration, +and failure classifications above provide the implementation decisions needed +for this sprint. diff --git a/docs/roadmap/library-upgrades.md b/docs/roadmap/library-upgrades.md index 61730ee..dedca28 100644 --- a/docs/roadmap/library-upgrades.md +++ b/docs/roadmap/library-upgrades.md @@ -1,6 +1,6 @@ # ConfigKit, PromptKit, and CommandKit Upgrade -**Status:** Adoption decisions agreed; ready for implementation planning. +**Status:** Adoption decisions agreed; [implementation plan](implementation.md) prepared. Implementation has not begun. **Reviewed:** 2026-11-23, against Audita commit @@ -24,7 +24,7 @@ one provenance model. The tradeoff is broader configuration validation and inspection, described below. This document records agreed adoption choices and the desired outcome. -A subsequent implementation plan can divide the work into bounded units. +The [implementation plan](implementation.md) owns the ordered work and validation. ## Reviewed Releases @@ -416,66 +416,34 @@ explanations while checking that Audita-specific choices and workflows remain understandable. No new library reference pages or recurring documentation gates are needed. -## Work and Validation +## Acceptance Criteria -The implementation should cover the following outcomes: +- The selected dependency versions match the reviewed releases, with consistent + module metadata and commit-pinned attribution. The reviewed target + `COPYRIGHT` and `LICENSE` files are unchanged from the currently selected + releases; all five remain `LGPL-3.0-or-later`. +- One combined native result serves application settings and engine capture, + preceded by configured secrets bootstrap with prepared-source reuse and safe + startup evidence. Native inspection and processing use the same assembly. +- Prompt definitions own actual output contracts and structural budgets. + Audita's retired setting, per-call overrides, and redundant registry are gone. + Domain checks and recoverable JSON decoding retain the selected behavior. +- Native execution facts and aggregation supply CLI usage reporting and the + new diagnostic envelope. Domain attribution, cancellation/joining, ordinary + reports, partial success, and output publication retain their contracts. +- Superseded source assembly, filesystem reconstruction, YAML round trips, + diagnostic engine reconstruction, metric projections, and tests dedicated to + those retired mechanisms are removed. No temporary compatibility path remains. +- Current documentation and maintained examples follow the upstream ownership + rule. Migration guidance and v4.1.0 release documentation explain actual + configuration, inspection, debug, and failure-classification changes. +- Representative offline integration coverage protects Audita's wiring and + selected behavior without repeating upstream test inventories. The complete + offline suite and required Linux builds pass for the completed source. -- Select all five target versions in `go.mod` and tidy module metadata. Adapt - changed public types, including affected tests and any positional literals. -- Replace separate PromptKit source assembly with the shared typed load and - native inputs; keep source evidence, relative resources, selected overlays, - and output protection coherent across both consumers. Apply the error - handling selected in [runtime failure classification](#runtime-failure-classification). -- Bootstrap configured secrets through the upstream helper before loading, - reuse its prepared main, and retain its safe report and native failure facts. -- Adapt embedded-schema installation and use prompt-defined output contracts - for ordinary and coordinated requests. Remove per-call schema and structural - budget overrides, redundant registry machinery, and the root/stage - `llm.repair_attempts` setting and any CLI bindings. Migrate explicit structural - budgets to native prompt definitions; retain domain decoding and checks. -- Adopt native usage reporting and retain useful new metadata in optional debug - evidence. Preserve cancellation causes, recoverable timeouts, and joined work. -- Remove superseded source assembly, filesystem-context reconstruction, YAML - encode/decode round trips, the embedded-only diagnostic engine construction, - and redundant accounting projections as their replacements land. Adopt the - agreed diagnostic envelope and native evidence representation. Remove or - consolidate tests that only protect those retired mechanisms; retain - behavioral coverage for the application contracts they served. Cleanup is a - completion outcome of this upgrade. -- Update canonical configuration, CLI, operations, LLM integration, and internal - documentation plus maintained examples under the ownership and consolidation - direction above. Replace duplicated library guidance with canonical upstream - links. Review old source paths and scripts consuming native reports, and add - migration guidance for actual Audita input or inspection changes. -- Prepare release notes for v4.1.0 describing the delivered features, breaking - changes, and required migration steps. The maintainer's versioning override - is recorded only in this roadmap and must not appear in the release notes. -- Update the five attribution entries and commit-pinned notice/source links. - The reviewed target `COPYRIGHT` and `LICENSE` files are unchanged from the - selected releases, and all five remain `LGPL-3.0-or-later`. Reuse applicable - local standard texts; inspect any newly selected transitive material. - -Use focused offline tests at Audita's integration boundaries: representative -source selection and mounting with relative resources; shared configuration -handoff; secrets bootstrap with prepared-source reuse and startup failure -reporting; prompt-defined contracts for proposal, validation, and repair, -including operator replacements, shared schemas, and native default/explicit -zero/nonzero structural budgets; recoverable response JSON syntax/type errors -and fatal invalid decode targets; retained domain checks; inspection -scopes and comparison acquisitions; context propagation and failure -classification; and domain attribution across proposal, validation, and repair. -Check transcript/diagnostic stream separation, quiet/help behavior, and -coexistence with debug capture using controlled clients or HTTP responses. -Where Audita transforms usage or cost evidence, verify that it preserves native -availability and completeness. Keep the existing partial-success and -output-lifecycle coverage. Select representative cases that detect Audita wiring -errors without rebuilding ConfigKit's environment/overwrite matrix or -PromptKit's accounting and provider-decoding suites. - -Run the complete offline suite and required Linux builds after implementation. -Do not duplicate upstream's provider-decoding or lifecycle test inventories. -The compile probe in this review establishes incompatibility, not successful -adoption; no runtime validation of the upgraded application has been claimed. +The [implementation plan](implementation.md) identifies the owning components, +ordered changes, and focused checks. The earlier compile probe establishes +incompatibility, not successful adoption; implementation has not been validated. ## Scope and Release Impact