Plan the Promptkit upgrade implementation

This commit is contained in:
2026-09-26 14:46:14 +00:00
parent e4405966c8
commit 604c1f1678
2 changed files with 545 additions and 694 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,15 +5,16 @@
Accepted feature direction, recorded on 2026-09-26; implementation is pending. Accepted feature direction, recorded on 2026-09-26; implementation is pending.
Upgrade directly from Promptkit v0.9.0 to v0.11.0, including the intervening Upgrade directly from Promptkit v0.9.0 to v0.11.0, including the intervening
v0.10.0 catalog transition. This document defines the desired end state and v0.10.0 catalog transition. This document defines the desired end state and
the changes from the current baseline, not a staged coding-agent plan. the changes from the current baseline. The [implementation plan](implementation.md)
owns sequencing, concrete interface choices, verification steps, and unresolved
implementation decisions.
The target is complete definition compatibility, controllable transient The target is complete definition compatibility, controllable transient
retries, an optional whole-run deadline, and modest opt-in execution diagnostics. retries, an optional whole-run deadline, and modest opt-in execution diagnostics.
This is a focused adapter and configuration update, not another architecture This is a focused adapter and configuration update, not another architecture
migration. Optional diagnostics are included in the desired feature set but migration. Optional diagnostics are included in the desired feature set.
need not block the core compatibility upgrade; they remain separately tracked “Optional” means callers opt in, not that diagnostics may be silently omitted
until delivered. “Optional” means callers opt in, not that they appear in from the completed adoption or appear in default output.
default output.
[ADR 0004](../adr/0004-definition-boundary.md) and the [ADR 0004](../adr/0004-definition-boundary.md) and the
[architecture policy](../policy/architecture.md) govern scope. Promptkit remains [architecture policy](../policy/architecture.md) govern scope. Promptkit remains
@@ -77,24 +78,18 @@ catalog entries can change or disappear across upgrades; inheriting from one
does not create a frozen copy. Complete application-owned profiles remain the does not create a frozen copy. Complete application-owned profiles remain the
appropriate choice when an application owns its model and settings. appropriate choice when an application owns its model and settings.
### Required Changes ### Change From Baseline
- Update `go.mod` and `go.sum`, retaining tagged upstream dependencies and no The module graph and active definition fixtures reflect the released v0.11
committed workspace, replacement, vendor tree, or direct catalog imports. catalogs rather than v0.9's catalogs. The selected catalog removes
- Replace the obsolete built-in inspection test and add focused coverage for `deepseek-3-2`, `deepseek-4-flash`, and `deepseek-4-pro`; newer DeepSeek names
the maintained names, prompt/default selection, inheritance, and overrides. are not compatibility aliases. Migration guidance offers an available catalog
Preserve existing definition conformance coverage rather than rebuilding profile, a maintained Promptkit name, or a complete application-owned definition.
Promptkit's parser tests in Scriptorium. Application-owned examples retain fixed settings where that is their purpose.
- Review maintained prompts, profile references, examples, and fixtures for
removed catalog IDs. The selected upstream catalog removes `deepseek-3-2`, Definition conformance and focused resolution coverage protect Scriptorium's
`deepseek-4-flash`, and `deepseek-4-pro`. Newer DeepSeek names are not automatic adapter boundary without duplicating the upstream parser or catalog. Existing
compatibility aliases, and Scriptorium must not silently invent aliases. dependency boundaries also apply to the new `/v2` module paths.
- Explain migration options: choose an available catalog profile, choose a
maintained Promptkit name, or supply a complete application-owned definition.
Keep the existing application-owned example profiles where fixed settings
are the instructional intent.
- Audit dependency-boundary tests for the `/v2` module paths without allowing
direct catalog imports or duplicating catalog contents.
## Controllable Transient Retries ## Controllable Transient Retries
@@ -121,23 +116,16 @@ loop. Transient retries and structural repairs have distinct budgets: each
generation, including each repair generation, receives its transient budget. generation, including each repair generation, receives its transient budget.
Retries do not imply exactly-once generation or complete billing knowledge. Retries do not imply exactly-once generation or complete billing knowledge.
### Required Changes ### Change From Baseline
- Extend strict application configuration and engine settings, mapping the Application settings reach `promptkit.Config.TransientRetries`, including the
optional value to `promptkit.Config.TransientRetries` in shared engine shared server engine, and request overrides reach
construction, including the server engine. `promptkit.RunRequest.TransientRetries`. This adds execution controls, not
- Add presence-aware CLI and HTTP request mapping to prompt/profile schema fields or provider model parameters. Strict decoding and
`promptkit.RunRequest.TransientRetries`. Keep this an execution setting, not presence-aware mapping preserve inheritance and explicit zero. User and
a copied prompt/profile schema field or provider model parameter. operations guidance makes the changed default, latency/cost implications, and
- Validate malformed and negative values at the appropriate configuration or independent repair budget visible. Cancellation and shared backend limits
request boundary, using Promptkit for framework semantics. remain effective during retrying executions.
- Update CLI, HTTP, configuration, operations, and migration guidance to make
the default change, cost/latency implications, zero override, and independent
repair budget explicit.
- Protect inheritance and explicit-zero mapping with focused tests; include a
representative built-in HTTP retry path and verify that cancellation and
shared backend limits remain effective. Do not duplicate the entire upstream
status/backoff test matrix.
## Optional Whole-Run Deadline ## Optional Whole-Run Deadline
@@ -155,21 +143,15 @@ context from the caller's existing context, so a caller cancellation or earlier
deadline still wins. This is a cancellation boundary, not a guarantee of deadline still wins. This is a cancellation boundary, not a guarantee of
instantaneous interruption of arbitrary callback or filesystem code. instantaneous interruption of arbitrary callback or filesystem code.
### Required Changes ### Change From Baseline
- Replace the CLI's unconditional background-context execution with a CLI execution can carry a selected deadline instead of always using an
context carrying the selected whole-run deadline when requested. unbounded background context. HTTP execution can shorten the incoming context
- Apply an HTTP execution deadline as a child of the incoming request context, without losing parent cancellation or changing server lifecycle behavior.
retaining disconnect cancellation and existing server lifecycle behavior. Total-run duration handling is separate from existing attempt-timeout conversion.
- Keep total-run duration handling separate from per-attempt timeout conversion; The interval covers the engine invocation, not adapter parsing, engine creation,
do not reuse names or fields that would reinterpret existing requests. or output writing. Provider retry timing can exceed local backoff limits;
- Document that provider retry timing can exceed local backoff limits and that per-attempt timeouts do not cap that complete invocation.
per-attempt timeouts do not cap the complete run.
- Test deadline/cancellation propagation through a representative retry wait
and capacity wait, without adding another admission queue or retry engine.
Exact option names, units, and zero-value semantics belong in the subsequent
implementation plan and must be settled before coding this interface.
## Opt-In Execution Reports ## Opt-In Execution Reports
@@ -193,26 +175,17 @@ Existing successful-result usage semantics remain unchanged. A terminal total
is an aggregate, not another attempt to add to the bill; no report is a billing is an aggregate, not another attempt to add to the bill; no report is a billing
ledger. ledger.
### Required Changes ### Change From Baseline
- Add an opt-in reporting interface and explicit application-owned report DTOs. Both adapters have opt-in reporting and explicit application-owned report DTOs.
- Collect per-request observations without shared mutable report state, durable Per-request collection adds no shared mutable report state, durable storage,
storage, or blocking work inside synchronous callbacks. Shared operational callback I/O, or event archive. Operational failures can carry reports without
infrastructure, if used, must remain concurrency-safe. manufacturing partial `RunResult` values. Default output remains unchanged.
- Format a concise terminal report rather than introducing event streaming,
an event archive, or a general telemetry framework.
- Define success and failure response/report handling without manufacturing a
partial `RunResult` when Promptkit returns an operational error.
- Exclude prompt and response bodies, credentials, headers, endpoint URLs,
provider diagnostic text, and raw errors. Treat selected identifiers as
potentially sensitive even when the upstream event is content-free.
- Test omission by default, success/failure reporting, unknown versus known-zero
usage, incomplete totals, no aggregate double counting, and concurrent-request
isolation at the adapter/report boundary.
The report destination, wire fields, report-write failure handling, and precise Reports exclude prompt and response bodies, credentials, headers, endpoint URLs,
scope of reported metadata remain implementation-plan decisions. Full event provider diagnostic text, and raw errors. Selected identifiers remain potentially
streaming and durable history are explicitly outside this feature. sensitive even when observations are content-free. Reports are concise terminal
metadata, not a general telemetry framework, event stream, or durable history.
## Errors And Compatibility ## Errors And Compatibility
@@ -226,11 +199,11 @@ failure details in execution diagnostics, including actual attempts where
available. Retry exhaustion and the final cause are distinct facts; do not lose available. Retry exhaustion and the final cause are distinct facts; do not lose
the underlying failure category by flattening them into one label. the underlying failure category by flattening them into one label.
Review mapping precedence and add representative wrapped-error tests while Capacity and validation behavior remains intact. Whole-run deadline and caller
retaining existing capacity and validation behavior. Specify total-deadline cancellation outcomes are deliberate adapter classifications, distinct from a
outcomes in the implementation plan rather than accidentally treating every provider-attempt timeout while the caller context is still live. The implementation
context error as an unclassified failure. No breaking replacement of existing plan owns the exact presentation choices. Existing generation-error codes do
error codes is required by this upgrade. not need a breaking replacement for this upgrade.
## Licensing And Distribution Review ## Licensing And Distribution Review
@@ -253,18 +226,16 @@ approval gate for every future release.
## Documentation And Delivery ## Documentation And Delivery
Update current documentation to link to the selected v0.11.0 contracts when Current documentation links to the selected v0.11.0 contracts once implemented.
the implementation lands. CLI, HTTP, configuration, and operations documents CLI, HTTP, configuration, and operations documents own their respective new
own their respective new behavior; internal docs explain adapter mapping; behavior; internal docs explain adapter mapping; release notes summarize
release notes summarize compatibility impact. Preserve historical release notes compatibility impact. Historical release notes and ADR decision content remain
and ADR decision content. Revise current examples and migration guidance where unchanged. Current examples and migration guidance reflect the selected version.
needed rather than globally replacing version strings in historical material.
Deliver the upgrade as a minor Scriptorium release, not a compatibility patch. The upgrade merits a minor Scriptorium release, not a compatibility patch,
Prominently explain removed catalog profiles, changed retry behavior, the with prominent migration guidance for removed profiles, changed retry behavior,
explicit single-attempt option, and timeout layering. Optional diagnostics may the explicit single-attempt option, and timeout layering. Any later decision to
follow in a separate feature release without representing unfinished reports defer part of the target leaves that feature visibly incomplete until delivered.
as already available.
Use the existing [release policy](../policy/release.md) and Use the existing [release policy](../policy/release.md) and
[runbook](../release.md). This roadmap authorizes no publication. No new ADR is [runbook](../release.md). This roadmap authorizes no publication. No new ADR is
@@ -283,7 +254,7 @@ boundaries.
per-attempt timeouts or disabling parent cancellation. per-attempt timeouts or disabling parent cancellation.
- Opt-in terminal reports provide safe, isolated, presence-aware execution - Opt-in terminal reports provide safe, isolated, presence-aware execution
metadata without changing default output or creating durable workflow state. metadata without changing default output or creating durable workflow state.
If deferred to a follow-up release, this item remains visibly incomplete. Any deferred reporting work remains visibly incomplete.
- Existing error classifications remain compatible, with deliberate handling - Existing error classifications remain compatible, with deliberate handling
of the new public identities and context outcomes. of the new public identities and context outcomes.
- The licensing/distribution approach is resolved before upgraded binary - The licensing/distribution approach is resolved before upgraded binary
@@ -292,17 +263,7 @@ boundaries.
implemented behavior. Relevant tests remain offline and credential-free, implemented behavior. Relevant tests remain offline and credential-free,
and normal development and release validation pass. and normal development and release validation pass.
## Decisions To Resolve In The Implementation Plan Concrete interface decisions and the remaining distribution question are recorded
in the [implementation plan](implementation.md). They do not expand the product
- Exact placement/naming of retry overrides and which preparation-only CLI
options should accept them for consistency without implying execution.
- Whole-run deadline option names, units, zero handling, and external deadline
error presentation; omission must impose no new deadline.
- Report destinations and opt-in request shape, report DTO fields, failure
reporting, and report-output error behavior; defaults must remain unchanged.
- Whether reports ship with the core upgrade or in a clearly tracked follow-up.
- The concrete licensing/distribution approach and any resulting packaging work.
These are bounded interface and delivery decisions, not permission to expand
into conversations, follow-up messages, application-owned semantic retry loops, into conversations, follow-up messages, application-owned semantic retry loops,
prepared-handle coordination, or multi-step workflows. prepared-handle coordination, or multi-step workflows.