From b127e9427e8c2cd2f59a1d8366a210bdcccd8de8 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Wed, 25 Nov 2026 16:27:10 +0000 Subject: [PATCH] Record core operation ownership and audit resolutions --- ...continuation-and-application-assessment.md | 3 +- ...ned-operation-preparation-and-execution.md | 57 +++++++++++++++++++ docs/policy/architecture.md | 21 ++++--- docs/roadmap/audit/catalog.md | 56 +++++++++++++----- docs/roadmap/audit/discussion.md | 21 +++---- docs/roadmap/implementation.md | 5 ++ 6 files changed, 129 insertions(+), 34 deletions(-) create mode 100644 docs/adr/0026-core-owned-operation-preparation-and-execution.md diff --git a/docs/adr/0022-use-native-continuation-and-application-assessment.md b/docs/adr/0022-use-native-continuation-and-application-assessment.md index 3f69d237..607a7b87 100644 --- a/docs/adr/0022-use-native-continuation-and-application-assessment.md +++ b/docs/adr/0022-use-native-continuation-and-application-assessment.md @@ -1,6 +1,7 @@ # ADR-0022: Use native continuation and application assessment -**Status:** Accepted +**Status:** Accepted; module-composed producer mechanics narrowly superseded by +[ADR-0026](0026-core-owned-operation-preparation-and-execution.md). Other decisions remain in force. **Date:** 2026-11-22 ## Context diff --git a/docs/adr/0026-core-owned-operation-preparation-and-execution.md b/docs/adr/0026-core-owned-operation-preparation-and-execution.md new file mode 100644 index 00000000..327ee73e --- /dev/null +++ b/docs/adr/0026-core-owned-operation-preparation-and-execution.md @@ -0,0 +1,57 @@ +# ADR-0026: Core-owned operation preparation and execution + +**Status:** Accepted +**Date:** 2026-11-25 + +## Context + +The native continuation and application assessment decisions in +[ADR-0022](0022-use-native-continuation-and-application-assessment.md) remain +valuable, but module-composed producer mechanics left engine selection, cache +binding, candidate state, and terminal handling coupled to integrations. Three +registry families also repeated a reconciliation lifecycle around shared +proposal-safety primitives. A smaller helper or private state cleanup alone +would not establish an understandable core/integration boundary. + +## Decision + +Core invokes typed stage preparation and executes the resulting deterministic, +native, or explicit preparation-limit operation. Domain integrations own input +projection, prompt selection, interpretation, identity, correction assignment, +and supported fallback construction. Core owns assessment, native coordination, +reuse, capture, evaluation lifetime, and terminal disposition. Direct callers +use that same executor with an explicitly supplied execution context. + +Each interpretation returns one evaluation containing its optional candidate, +actionable guidance, diagnostics, and optional evidence. Core assesses usable +candidates through the configured chain and clears the current evaluation before +a selected correction. Historical capture may retain prior evaluations but a +failed continuation cannot recover one as current output. + +The domain-neutral reconciliation facility prepares fixed candidates and source +windows, assesses proposals, and applies each safe plan afresh through typed family +policy. Its evaluation retains omissions and family findings together with the +candidate. Families retain identity, compatibility, warning semantics, and +fallback invariants. This facility returns an operation to the same executor; +it is not another execution service or a domain-specific framework. + +This decision supersedes only ADR-0022's module-composed producer mechanics. +Its native continuation, full assessment, guidance, cancellation, fallback, +and acceptance decisions remain in force. The fixed pipeline, PromptKit's +execution and structural repair ownership, ordinary error behavior, and existing +reuse contracts are unchanged. + +## Alternatives Considered + +Keeping module-invoked producer helpers with smaller closures would reduce local +complexity but leave integrations selecting execution collaborators and repeating +reconciliation coordination. A generic workflow DSL or second reconciliation +executor would introduce machinery beyond the demonstrated fixed-stage needs. + +## Consequences + +Integrations can be understood and tested as operation preparation with explicit +domain policy; the core owns one lifecycle for registered and direct callers. +Internal interfaces and tests move together, and evaluation-specific state must +remain operation-local. This does not establish a public SDK, a new scheduler, +blanket concurrency guarantees, or new fallback eligibility. diff --git a/docs/policy/architecture.md b/docs/policy/architecture.md index 7e790c32..23a5c346 100644 --- a/docs/policy/architecture.md +++ b/docs/policy/architecture.md @@ -2,7 +2,7 @@ **Base Policy Version:** 1.3 -**Last Updated**: 2026-11-24 +**Last Updated**: 2026-11-25 **Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/architecture.md @@ -46,8 +46,9 @@ cache permissions remain established product decisions. Successor ADRs [0022](../adr/0022-use-native-continuation-and-application-assessment.md), [0023](../adr/0023-unify-accepted-artifact-and-plan-caching.md), and [0024](../adr/0024-publish-artifacts-with-native-reports-and-debug-evidence.md) -record the native cutover. Earlier accepted bodies remain historical decisions, -with status links identifying superseded portions. +record the native cutover. [0026](../adr/0026-core-owned-operation-preparation-and-execution.md) +establishes core-owned operation preparation and execution. Earlier accepted +bodies remain historical decisions, with status links identifying superseded portions. ## System Shape @@ -86,9 +87,9 @@ those generic layers. Generic layers must not depend on production extensions; extensions must not compose the application or own process behavior. Semantic reconciliation is a domain-neutral mechanism for fixed candidate -preparation, native request construction, proposal decoding, and safe typed -application. It does not own domain identity, durable IDs, warning semantics, -or artifact construction rules. Native execution uses the shared producer path. +preparation, proposal assessment, safe typed application, and evaluation-scoped +details. It prepares operations for the shared core executor; it does not own +domain identity, durable IDs, warning semantics, or artifact construction rules. The root `assets` package remains a content-only dependency leaf. It may expose a read-only embedded filesystem but contains no business logic or dependencies @@ -242,9 +243,11 @@ conversation history, turn iteration, and backend admission. Notarius does not pin omitted native budgets or add outer retries to extend them. Deterministic operations have no generic retry budget or synthetic model request. -One small typed producer helper connects module-owned fixed inputs, native -request builders, interpretation, and supported fallback functions with the -pipeline assessor. Initial/correction pairs use complete replacement responses +Core invokes module-owned operation preparation and executes its deterministic, +native, or explicitly limited result. Core owns assessment, native coordination, +reuse, operation evidence, and terminal disposition; integrations own fixed inputs, +interpretation, correction assignments, and supported fallback construction. +Initial/correction pairs use complete replacement responses and the same declared schema. Enduring principles belong in initial system context; correction supplies current findings and a new assignment. Native coordination carries the growing exchange without manual response replay or diff --git a/docs/roadmap/audit/catalog.md b/docs/roadmap/audit/catalog.md index 9d457696..4dad2540 100644 --- a/docs/roadmap/audit/catalog.md +++ b/docs/roadmap/audit/catalog.md @@ -14,13 +14,12 @@ another code audit or an implementation plan. The companion [remediation discussion](discussion.md) collects review recommendations and open choices in discussion order. Accepted decisions there qualify proposed remediation; finding statuses here track implementation. -The [Core And Integration API Roadmap](../core-integration-api.md) takes -implementation priority over the remaining catalog work. Reassess affected -findings after that migration rather than assuming their current remediation -remains unchanged. +The [Core And Integration API Roadmap](../core-integration-api.md) established +the core/integration boundary. The reassessment below distinguishes its completed +work from the remaining audit remediation. -The **45 original finding entries** reduce to **33 outstanding catalog entries -and one resolved documentation entry**. Repeated responsibility findings are +The **45 original finding entries** reduce to **30 outstanding catalog entries +and four resolved entries**. Repeated responsibility findings are merged. Regression gaps are attached to the defects they protect rather than counted as additional runtime bugs. In particular, TEST-001, TEST-002, and TEST-004 each cover several distinct defects; TEST-003's native-fixture oracle @@ -64,13 +63,23 @@ Original P2/P3 ratings and relative refactoring priorities are retained for context; they are not one universal severity scale. No audit establishes a P1 incident or a measured end-to-end production speedup. -All CAT-001 through CAT-033 remain outstanding at the reviewed revision. +CAT-007, CAT-015, CAT-016, and CAT-034 are resolved; the other entries remain +outstanding. The original reports and their baseline observations are historical. "Refactoring" denotes a maintenance opportunity, not a confirmed runtime failure. CAT-024 explicitly requires revisiting an existing evidence-convenience -choice. CAT-034 is resolved and excluded from outstanding counts. Related entries +choice. Related entries may share files without representing the same underlying issue; they should be coordinated rather than silently treated as duplicates. +**Migration overlap:** Lazy [operation evidence](../../../internal/framework/pipeline/operation.go) +addresses part of CAT-003, not all run-wide capture allocation. Core operation +ownership and the [internal guides](../../internal/modules.md) clarify portions +of CAT-014/017/018/022/025/032, without completing their broader layout, +copying, runner, writer-obligation, or package-cohesion work. CAT-006/008/009 +and CAT-023 remain separate lifetime, failure-diagnostic, and CLI concerns; +CAT-024's full-source representation is unchanged. These overlaps do not resolve +any of those findings. + ## Prioritized Findings ### CAT-001 — Overflow In An Accepted Generic Chunk Size @@ -154,6 +163,12 @@ and CAT-009 so cleanup does not erase completed-work information. ### CAT-007 — Native Failed-Validation Handling Loses Meaning And Its Tests Miss It +**Status:** Resolved. [Core usability checking](../../../internal/framework/pipeline/native_result.go) +retains completed-validation details and upstream causes; the [producer tests](../../../internal/framework/pipeline/producer_test.go), +[combat validator tests](../../../internal/modules/dnd/validate/scenedescriptions/combat_semantics/native_execution_test.go), +and [reconciliation fixture](../../../internal/framework/semanticreconcile/engine_test.go) +exercise the respective boundaries. The original observation below is historical. + **Assessment:** Static classification/detail defect with duplicated handling; original ERR-001 P3, TEST-003 P2, EQ-005 low refactoring priority. @@ -161,8 +176,8 @@ original ERR-001 P3, TEST-003 P2, EQ-005 low refactoring priority. [EQ-005](10-equivalence.md#eq-005--producers-and-an-llm-validator-duplicate-the-native-usability-gate), [TEST-003](08-testing.md#test-003--native-failure-assertions-have-an-incomplete-or-incorrect-oracle). -The producer and combat semantic validator correctly refuse unusable content, -but discard native validation details and manufacture `promptkit.ErrValidation`, +At the audit baseline the producer and combat semantic validator refused unusable content, +but discarded native validation details and manufactured `promptkit.ErrValidation`, conflating a completed failed content check with an operational validation error. Give the small usability check one framework owner; distinguish missing results, failed checks, and actual native Go errors. Preserve producer disposition and @@ -291,12 +306,17 @@ distinct phases. This also governs CAT-017/CAT-018; implementation remains pendi ### CAT-015 — Producer Lifecycle Depends On Coupled Closure State +**Status:** Resolved for the selected operation lifecycle. [Core execution](../../../internal/framework/pipeline/operation.go) +and [native continuation](../../../internal/framework/pipeline/operation_native.go) +own evaluation replacement and disposition; [operation tests](../../../internal/framework/pipeline/operation_native_test.go) +cover current-candidate invalidation. The former `RunProducer` path is removed. + **Assessment:** High-leverage local maintainability opportunity; original high. **Source:** [CPLX-001](03-complexity.md#cplx-001--producer-execution-has-too-much-coupled-mutable-state). -Preparation, cache lookup, capture, candidate interpretation/assessment, native -continuation, and disposition share mutable closure state in `RunProducer`. +At the audit baseline, preparation, cache lookup, capture, candidate interpretation/ +assessment, native continuation, and disposition shared mutable closure state in `RunProducer`. Use small private phase/state results to make candidate invalidation and exits explicit. Preserve native execution/history ownership, final-turn assessment, cache hits, cancellation precedence, capture errors, and strict/permissive @@ -305,13 +325,21 @@ defect with the wider readability refactor or create a new retry engine. ### CAT-016 — Three Registry Normalizers Repeat Reconciliation Lifecycle Glue +**Status:** Resolved for the shared reconciliation lifecycle. The neutral +[operation facility](../../../internal/framework/semanticreconcile/operation.go) +and its [lifecycle tests](../../../internal/framework/semanticreconcile/operation_test.go) +own fixed preparation and final evaluation; the [NPC](../../../internal/modules/dnd/normalize/npcregistry/normalizer.go), +[item](../../../internal/modules/dnd/normalize/itemregistry/normalizer.go), and +[location](../../../internal/modules/dnd/normalize/locationregistry/normalizer.go) +adapters retain independent family policy. The former duplication is historical. + **Assessment:** Shared lifecycle/refactoring opportunity; original high/medium. **Sources:** [CPLX-004](03-complexity.md#cplx-004--semantic-registry-normalizers-repeat-a-stateful-lifecycle), [EQ-001](10-equivalence.md#eq-001--registry-normalizers-repeat-one-reconciliation-lifecycle), [BND-005](11-boundaries.md#bnd-005--registry-reconciliation-lifecycle-ownership-is-repeated-by-family-adapters). -NPC, item, and location normalizers duplicate fixed-original preparation, +At the audit baseline, NPC, item, and location normalizers duplicated fixed-original preparation, proposal/evidence bookkeeping, correction, and fallback glue around the shared core and producer. Share only that demonstrated typed lifecycle, returning current proposal/omission information explicitly. Keep domain identity, currency guards, @@ -563,7 +591,7 @@ Keep exact consecutive-token semantics, Unicode normalization, punctuation, empty-query behavior, and token boundaries; compare with an independent simple reference matcher. No fuzzy search dependency or name-length cap is indicated. -## Resolved Finding +## Other Resolved Finding ### CAT-034 — Distribution Architecture Described A Retired Source-Only Workflow diff --git a/docs/roadmap/audit/discussion.md b/docs/roadmap/audit/discussion.md index c5ccd80c..597c5696 100644 --- a/docs/roadmap/audit/discussion.md +++ b/docs/roadmap/audit/discussion.md @@ -194,7 +194,8 @@ broader consolidation. ## 5. Producer State And Shared Reconciliation Lifecycle **Findings:** CAT-015 and CAT-016; coordinate CAT-007. -**Status:** Expanded API direction accepted; implementation planned separately. +**Status:** Implemented for the selected core/integration boundary; see +[ADR-0026](../../adr/0026-core-owned-operation-preparation-and-execution.md). The discussion selected a clear core/integration boundary, core ownership of as much demonstrated shared lifecycle responsibility as practical, and a clean, @@ -204,16 +205,16 @@ that target. Internal integration interfaces may change to achieve it. The [Core And Integration API Roadmap](../core-integration-api.md) now owns the targeted end state, accepted API decisions, migration work, and verification. -Execute that initiative before the remaining audit remediation, then reassess -which findings remain against the resulting architecture. Items 1–4 remain +That initiative implemented the selected lifecycle and the catalog records the +reassessment. Remaining audit remediation is separate. Items 1–4 remain accepted; later discussion items are not silently accepted by this change. -CAT-007's native usability/error-detail correction is accepted and included in -that roadmap. Producer disposition and validator unavailability remain distinct; +CAT-007's native usability/error-detail correction was implemented with that +roadmap. Producer disposition and validator unavailability remain distinct; no new structural repair loop or budget is selected. **Decision:** Accepted direction and API choices; implementation details and status -are maintained in the linked roadmap. +are maintained in the linked roadmap and current internal guides. ## 6. Finalization, Completed Diagnostics, And Intermediate Lifetimes @@ -322,8 +323,8 @@ every catalog entry through code changes is not itself the goal. Recommended approach: -1. Fix narrow correctness defects with focused regressions: CAT-001/CAT-002, - CAT-011–CAT-013, and native classification/test-oracle handling in CAT-007. +1. Fix narrow correctness defects with focused regressions: CAT-001/CAT-002 and + CAT-011–CAT-013. Native classification/test-oracle handling in CAT-007 is resolved. Preserve supported inputs rather than imposing new restrictions. Reproduce static counterexamples at their real boundaries when implementing the fixes. 2. Prioritize ordinary-run costs in CAT-003–CAT-005 alongside failure visibility @@ -354,7 +355,7 @@ end-to-end speedups should be claimed only if measured. Update canonical behavior documentation when implementation lands. Record any significant changed architectural decision without rewriting accepted ADR bodies. Keep the catalog's evidence and qualifications linked rather than duplicating -all ten reports in an implementation plan. CAT-034 is already resolved and -requires no further remediation. +all ten reports in an implementation plan. CAT-007, CAT-015, CAT-016, and +CAT-034 are resolved and require no further remediation within their stated scope. **Decision:** Pending. diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index cc334839..06469646 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -868,6 +868,11 @@ API references against source. Run affected example/config loading tests if chan ## Stage 23 — Record Ownership And Reassess Overlapping Audit Findings +**Status:** Complete. ADR-0026 and architecture policy record the selected +boundary, ADR-0022 links its narrow supersession, and the audit catalog and +discussion distinguish resolved lifecycle/usability findings from remaining work. +Changed local documentation links were checked against the repository. + **Goal:** Bring architectural guidance and audit status in line with the result. **Inspect:** Architecture policy, ADR-0022 and related ADR status links,