Simplify observability upgrade ownership and implementation plan

This commit is contained in:
2026-11-23 02:16:57 +00:00
parent 447110a939
commit 5d3a3b5956

View File

@@ -7,9 +7,10 @@ execution-observation, provider-accounting, and operator-reporting capabilities.
Retain the existing configuration ownership, typed pipeline, accepted-result
cache, domain artifacts, and application assessment boundaries.
This document records recommendations and the target state, not an
implementation sequence. No application or dependency changes are part of this
review. A separate staged implementation plan can follow approval.
This document records the selected target and a short implementation sequence.
Implementation remains pending; recording these decisions changes no application
behavior or dependencies. Keep implementation planning here rather than requiring
a separate planning document.
## Reviewed Baseline And Published Targets
@@ -19,7 +20,7 @@ declares the versions below. Release status was checked against the upstream
repositories' remote tags on 2026-11-23; annotated tags were resolved to source
commits. The source commits, rather than tag-object hashes, are recorded here.
| Module | Notarius baseline | Recommended target | Target source commit |
| Module | Notarius baseline | Selected target | Target source commit |
| --- | --- | --- | --- |
| `go.maximumdirect.net/configkit` | v1.4.0 | Retain v1.4.0 | `4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3` |
| `go.maximumdirect.net/promptkit` | v0.24.0 | v0.25.0 | `207677e9948dc5699073a4d6620d21139033c72d` |
@@ -132,7 +133,7 @@ comments; callers needing structured smoke output should select JSON or YAML.
Smoke usage remains in the smoke report, separate from ordinary execution
observation, without a new smoke cost field.
## Recommended Target State And Work
## Selected Target State And Work
### Adopt The Coordinated Published Set
@@ -147,6 +148,12 @@ schemas, producer budgets, assessment policy, worker limits, and backend
admission choices unchanged unless a specific compatibility fix requires it.
These releases do not require new domain extraction behavior.
Preserve application outcomes and useful diagnostic evidence; freely remove or
relocate internal plumbing that upstream capabilities make unnecessary. Existing
group parameters, observer hooks, and snapshot-writing locations are not
compatibility requirements. Keep the public artifact, cache, assessment, and
execution-policy contracts distinct from those implementation choices.
### Use Native Operator Usage Reporting
Retain the existing `ckprompt.Declarations` assembly in
@@ -169,27 +176,59 @@ Cached accepted artifacts represent no current model execution and must not
replay historical usage or cost; deterministic-only operations likewise create
no synthetic executions. An empty native group can legitimately report zeros.
### Simplify Invocation Observation Where It Removes Existing Plumbing
### Move Invocation Accounting Out Of Runner Inputs
The runner currently enrolls its `RunInput.Executions` group by composing its
observer into `input.Execution.Observer` and propagating that observer through
requests. Prefer attaching this group once with `WithExecutionObserver` to the
runner context, retaining the group for existing debug snapshots and caller
inspection. Remove the old enrollment of that same group from request-level
fan-out in the same change; do not rely on terminal de-duplication to hide
duplicate registration.
requests. Replace this with native contextual observation owned by the consumer
of the evidence:
Keep request-specific capture and caller callbacks where they serve their
existing purpose. This recommendation does not require deleting the general
`ExecutionOptions.Observer` hook or turning per-operation debug writers into
one shared writer. A pipeline debug group and ckprompt's CLI invocation group
may independently observe the same execution; never add their overlapping
totals. Preserve callback composition, concurrency synchronization, captured
run identity, and error/capture handling.
- ckprompt owns ordinary invocation usage reporting through its installed feature.
- Debug capture creates and attaches a native group when it needs a snapshot,
retaining that group for capture at the appropriate application boundary.
- Other callers attach their own observers or groups through
`WithExecutionObserver` and inspect them after their work finishes.
- The runner propagates the supplied context without an accounting-group input
or unconditional allocation of its own group.
Remove `RunInput.Executions` and general observer forwarding through
`ExecutionOptions.Observer`. Audit remaining callers and migrate them to native
contextual enrollment; internal caller compatibility does not justify retaining
the old path. Remove the old request/coordination/validator enrollment in the same
change so a group is registered once, without relying on terminal de-duplication
to conceal duplicate event delivery. When neither capture nor an explicit caller
needs a group, Notarius creates none of its own.
A debug group and ckprompt's CLI invocation group may independently observe the
same execution. Never add their overlapping totals. Exactly one group is not an
architectural goal: do not introduce shared-group discovery, an accounting
service, or new upstream integration machinery merely to avoid this small
duplication.
Verify both `Run` and `RunPrepared` use the decorated execution context, as do
corrections and nested validators. Preparation/cache hits must remain event-free.
### Retain Operation Evidence And Application Lifecycle Ownership
Invocation accounting and operation evidence serve different purposes.
`NativeCapture` still associates prepared messages, raw responses, exchanges,
cache-hit evidence, and domain scope with individual operations. Preserve that
useful evidence and native request-specific callbacks, including `OnPrepared`
and direct request observers where needed. Contextual accounting does not require
turning per-operation writers into one centralized event router that reconstructs
lane/chunk/validator ownership.
Keep callback composition, synchronization, native run identity, and capture-error
handling where their consumers still need them. Remove forwarding that only
served invocation accounting; do not remove capture hooks simply because they
also use native observer APIs.
Notarius continues to own debug allocation and finalization, domain assessment,
and publication-aware failure handling. CommandKit's final diagnostic reports
do not replace these application boundaries. Preserve requested capture failures,
available artifacts and locations, and completion-report ordering without moving
domain lifecycle work into a generic invocation feature solely because one exists.
### Adopt Explicit Provider Conventions Without Adding Defaults
The bundled OpenRouter backend now declares `provider: openrouter` upstream.
@@ -199,7 +238,8 @@ of the upstream backend is unnecessary.
Link operators to PromptKit's canonical backend documentation for independently
declared or replaced backends, including OpenRouter and vLLM provider selection.
Do not write a Notarius-owned explanation or field reference for these settings.
Brief Notarius-specific orientation or examples may explain an integration choice;
link upstream for field semantics rather than maintaining a parallel reference.
An endpoint override of an inherited backend retains its provider selection,
so switching from an OpenRouter parent to a local vLLM endpoint also needs a
deliberate provider override. Do not infer conventions from an ID, hostname,
@@ -222,8 +262,12 @@ Notarius documentation should state which native libraries and integrations it
imports and link to their canonical upstream documentation. Upstream owns the
explanation of its features, APIs, configuration fields, defaults, flags,
reporting, and authentication semantics. Do not reproduce those references or
write parallel tutorials in Notarius. The release assessment above supplies
upgrade-review context, not material to copy into permanent product docs.
write parallel library tutorials in Notarius. Brief orientation and concrete
Notarius workflows are appropriate, with links to the selected upstream contracts
for details. For example, explaining that an accepted-artifact cache hit makes
no model call and adds no current token usage connects application behavior to
native reporting; that explanation belongs locally. The release assessment above
supplies upgrade-review context, not material to copy wholesale into product docs.
Local documentation retains Notarius-specific integration choices, application
behavior, and workflows. Update only the affected content when changes land:
@@ -232,14 +276,17 @@ behavior, and workflows. Update only the affected content when changes land:
interfaces and link to the selected upstream CLI reference, including native
[usage reporting](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-usage-reporting).
Keep application-owned commands, aliases, inputs, and completion reports local;
do not add a local usage-flag or smoke-report reference.
brief usage examples may orient callers without duplicating a usage-flag or
smoke-report reference.
- [Configuration](../config.md): retain Notarius's source assembly and embedded
collection choices; link to PromptKit's
[backend definitions](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md#backend-definitions)
for provider, zero-cost, and authentication settings instead of explaining them.
for provider, zero-cost, and authentication semantics. Explain Notarius-specific
source/inheritance choices locally where useful.
- [Operations](../operations.md): retain application-owned accepted-result reuse
and debug handling; link upstream for token/cache/cost interpretation without
adding a reporting contract or duplicating accounting documentation.
and debug handling, including how application cache reuse affects current
execution. Link upstream for token/cache/cost interpretation without adding
a reporting contract or duplicating accounting documentation.
- [LLM internals](../internal/llm.md), [pipeline internals](../internal/pipeline.md),
and [CLI internals](../internal/cli.md): update Notarius's contextual enrollment
and integration wiring where implementation changes; link upstream for API
@@ -263,18 +310,41 @@ behavior, and workflows. Update only the affected content when changes land:
A new ADR is not needed for this additive use of the already adopted native-kit
ownership boundaries. Existing architecture wording may need a small factual
update from request enrollment to contextual enrollment; accepted ADR bodies
remain unchanged.
update from runner-owned request enrollment to consumer-owned contextual
observation; accepted ADR bodies remain unchanged.
Documentation acceptance: readers can discover each adopted interface and reach
its selected upstream documentation directly. Local material describes what
Notarius contributes or selects, with no parallel library feature documentation.
This upgrade is not a repository-wide documentation rewrite.
Notarius contributes or selects, allowing brief orientation without a parallel
library reference. This upgrade is not a repository-wide documentation rewrite.
## Implementation Sequence
All work remains pending. Use a few focused, reviewable changes, with relevant
tests and documentation accompanying each change:
1. Adopt the coordinated dependencies and native reporting through the existing
command assembly. Verify installation and invocation-context propagation
without introducing temporary application accounting or reporting wrappers.
2. Move caller/debug observation to native contexts, remove the runner group
parameter and general observer forwarding, and retain operation-specific
capture and application lifecycle handling. Update callers and focused tests
with the removal rather than preserving a compatibility path.
3. Complete the integration checks below and remaining documentation/notices.
Confirm that ordinary accounting needs no application-maintained totals,
unconditional group, or handler reporting callbacks.
These are implementation units within this roadmap, not separate releases or
new approval gates. Refine file-level tasks as the code changes without creating
another substantial planning artifact.
## Verification And Acceptance
Use the real updated kits with fake clients or local HTTP fixtures. Protect
integration behavior, not an exact copy of upstream report wording:
integration behavior, not an exact copy of upstream report wording. The list
below defines coverage, not one required new test per item or flag combination.
Reuse existing tests and combine representative workflows where they protect
the same integration boundary:
1. Both maintained example configurations pass offline pipeline validation;
original-result handoff, focused inspection, overlays, and secret-aware
@@ -286,14 +356,18 @@ integration behavior, not an exact copy of upstream report wording:
3. `--show-tokens --format json` leaves stdout as the ordinary completion report
and writes usage only to diagnostics. Omission/explicit false, repeated
selection, quiet, help, bare `config explain`, returned failure, cancellation,
and diagnostic-delivery failure retain native semantics. Choose a focused
set of application integration tests; upstream already tests its own parser
and presentation matrix.
and diagnostic-delivery failure retain native semantics. Cover representative
application reporting and failure boundaries using existing tests where
sufficient; do not reproduce upstream's parser and presentation matrix.
4. A subsequent accepted-result hit performs no new model call and contributes
no historical usage. Preparation alone emits no execution; a prepared miss
observes its execution context. Debug events/group snapshots continue to
retain native identity, coverage, reasoning, and cost without a second ledger.
5. Provider fixtures verify a representative application-selected OpenRouter
Caller/debug observers work through context without `RunInput.Executions` or
general `ExecutionOptions.Observer` forwarding. Preserve operation-specific
evidence and capture/publication failure handling while retiring tests coupled
only to the old plumbing.
5. One representative HTTP fixture verifies an application-selected OpenRouter
or vLLM configuration through the built-in HTTP client and new accounting
fields. Preserve known zero versus unavailable/incomplete state; do not add
reasoning/cache counts again to total tokens. Avoid duplicating the full