594 lines
38 KiB
Markdown
594 lines
38 KiB
Markdown
# Native Library Upgrade Implementation Plan
|
|
|
|
## Scope And Execution
|
|
|
|
Implement the target in [the library upgrade roadmap](library-upgrades.md),
|
|
reviewed at Scriptorium commit `882bdb4bdb0de3b04c7a9b393024ed7557b4ef3c`.
|
|
The roadmap owns product intent, selected upstream releases and source revisions,
|
|
boundaries, and deferred work. This document owns implementation order and tasks.
|
|
It is written for a Luna coding agent executing one stage per implementation
|
|
prompt, in sequential order.
|
|
|
|
This is one end-to-end sprint. Intermediate stages may fail to compile or have
|
|
failing tests. Do not introduce temporary compatibility loaders, duplicate types,
|
|
adapters, or alternate execution paths to make an intermediate stage green.
|
|
Record incomplete validation accurately and carry it forward. Focused checks
|
|
below run when their dependencies are available; Stage 12 verifies the complete
|
|
end state. Follow the local commit policy for completed units without treating
|
|
each stage as an independently releasable product.
|
|
|
|
Before work, read `docs/development.md` and the applicable adopted policies.
|
|
In particular, follow agents, architecture, testing, documentation, and OSS
|
|
policy for the changes below. Keep documentation policy v1.13's upstream-owner
|
|
rule; link library contracts rather than rewriting them. Use the public APIs of
|
|
the selected tags, not sibling-checkout HEAD assumptions or internal packages.
|
|
|
|
### Decisions That Apply Throughout
|
|
|
|
- The application document embeds `promptkit.Settings` at `promptkit`.
|
|
`promptkit.Configure` composes library rules with application callbacks.
|
|
- Each acquisition prepares its selected main with native secrets bootstrap,
|
|
performs one typed ConfigKit layered load, and returns the actual completed
|
|
result. Engine construction passes that whole result to `NewFromConfig`.
|
|
There is no second framework load, projection/redecode, or post-load resolver.
|
|
- Native all-scope/comparison operations may reach multiple independent loader
|
|
callbacks. Each reached callback follows that sequence; this does not promise
|
|
one load for an entire invocation or add a configuration/engine cache.
|
|
- Both native configuration scopes allow overrides. Paths remain native
|
|
application-root paths, including `/promptkit`; scopes do not rebase them.
|
|
- ConfigKit owns secret-file processing and process-environment effects.
|
|
Preserve native sequential comparison effects, not isolated environments.
|
|
- Keep the bundled OpenRouter underlay, application retry setting, server
|
|
settings/defaults/normalization, source-root selection, request presence,
|
|
artifact policy, and process lifecycle unless this plan expressly changes them.
|
|
- Adopt upstream repair/schema/provider semantics and native CLI usage reporting.
|
|
Keep application-specific output and error/status choices. Additional HTTP
|
|
reporting, workflow APIs, hot reload, and selected-format accessors are outside
|
|
this sprint. HTTP's existing wire contract remains unchanged.
|
|
- Preserve raw-key restrictions with narrow application validation. Do not
|
|
reject ordinary PromptKit extension fields, invent a version requirement,
|
|
redact whole `extra_params` maps, or introduce a generalized legacy detector.
|
|
- Tests protect adoption and application boundaries. Remove obsolete two-load
|
|
assertions rather than rebuilding their machinery; retain distinct HTTP,
|
|
delivery, cancellation, and concurrency protections.
|
|
|
|
## Stage 1 — Select The Released Dependency Set And Update Attribution
|
|
|
|
**Status: Complete.** Selected all five releases and verified their module-origin
|
|
commits against the upgrade roadmap. Updated the corresponding attribution links;
|
|
the selected upstream license texts match the previous releases. Module selection
|
|
retains Go 1.27.0 without replacements. Source migration, module tidiness, runtime
|
|
attribution review, and full offline validation remain for later stages; the
|
|
intermediate application may not compile against the new APIs.
|
|
|
|
**Files:** `go.mod`, `go.sum`, `docs/oss/attribution.md`, and license texts only
|
|
if the selected runtime graph actually requires a change.
|
|
|
|
1. Select these releases together:
|
|
|
|
```sh
|
|
GOWORK=off go get go.maximumdirect.net/configkit@v1.4.0 go.maximumdirect.net/promptkit@v0.25.0 go.maximumdirect.net/commandkit@v0.8.0 go.maximumdirect.net/ckconfig@v0.11.0 go.maximumdirect.net/ckprompt@v0.12.0
|
|
```
|
|
|
|
Keep the module path and `go 1.27.0`. Keep the selected release toolchain
|
|
Go 1.27.4; no toolchain/CI upgrade is needed for this dependency set.
|
|
2. Check the selected modules against the roadmap's full source revisions.
|
|
ckprompt v0.12.0 is released and selects the other four target versions.
|
|
Do not use replacements, a committed workspace, vendoring, or sibling source
|
|
changes. Prepare dependencies separately from offline validation.
|
|
3. Update the five existing attribution entries to those versions and exact
|
|
source/COPYRIGHT/LICENSE commit links. Preserve the separate policy-material
|
|
attribution and mixed policy baselines. The reviewed library grants/texts
|
|
are unchanged; reuse local standard texts after checking the selected sources.
|
|
4. Inspect module selection now; finish tidying and runtime-graph review after
|
|
source migration. Graph-only upstream maintainer tools do not by themselves
|
|
require runtime attribution. Do not add release scanners or publication gates.
|
|
|
|
**Check:** selected module versions and attribution links agree with the roadmap.
|
|
Build failures from removed schema APIs or old fixtures are expected at this point.
|
|
|
|
## Stage 2 — Replace The Configuration Schema And Loader
|
|
|
|
**Status: Complete.** Embedded native PromptKit settings and composed its
|
|
definition with application validation and normalization. Configuration loading
|
|
now bootstraps the selected source once, retains its native report and typed
|
|
errors, and performs one layered load with the bundled underlay. Retired fields
|
|
and raw backend/profile keys are rejected at their effective paths; native
|
|
sensitivity is composed with the application raw-key boundary.
|
|
|
|
The offline configuration package tests pass on Go 1.27.4, covering native
|
|
extensions, diagnostics, discovery, overrides, server normalization, and
|
|
configured bootstrap preservation, overwrite, exhaustion, and failure effects.
|
|
The old conversion and callers remain temporarily for the next stage, so the
|
|
assembled application is not yet expected to compile or pass its full suite.
|
|
|
|
**Files:** `internal/config/document.go`, `load.go`, their tests,
|
|
`internal/defaults/defaults.go`; remove obsolete settings definitions when callers
|
|
are migrated in Stage 3.
|
|
|
|
1. Replace `PromptKitDocument` with `promptkit.Settings` in `Document.PromptKit`.
|
|
Keep `TransientRetries` and `Server` as application fields. Remove framework
|
|
acquisition/path defaults and normalization; retain recorded application
|
|
server/address/artifact-root normalization and existing numeric validation.
|
|
2. Return the application definition composed with `promptkit.Configure`,
|
|
selecting `&document.PromptKit`. Keep existing defaults and domain callbacks
|
|
in the supported definition flow. Do not clone the framework schema, normalize
|
|
native resources locally, or add a root inline map to relax application decoding.
|
|
3. In application validation, use public settings' extension maps to reject
|
|
the exact retired `promptkit.configuration` and `promptkit.schema_dir` keys
|
|
when present, including null. Report their native paths and a value-free
|
|
migration message. This checks effective fields, not every historical source.
|
|
4. Preserve the raw-key boundary by rejecting `api_key` in root and collection
|
|
backend/profile extension maps. Use actual list-index/collection paths and
|
|
value-free diagnostics. Preserve all other native extension data. Classify
|
|
these exact forbidden API-key field positions as sensitive through the
|
|
application definition so native diagnostic/history rendering cannot print
|
|
their rejected contents. Compose, rather than replace, PromptKit's native
|
|
sensitivity predicate. Do not recursively police arbitrary application data.
|
|
5. Change `Load` to return
|
|
`(*configkit.Result[Document], *configkit.SecretsReport, error)`.
|
|
Keep `LoadOptions`' explicit selection, overlay, and override records. Choose
|
|
the existing host `File` or `SearchConfig("scriptorium", applicationSearch)`;
|
|
call `LoadSecretsIntoEnvironmentFromConfig` with native default options.
|
|
6. Return the native report on every path. On bootstrap failure, stop and retain
|
|
the typed cause; never pass the unusable returned source to a loader. On
|
|
success, use the captured source in an import-enabled layered main input.
|
|
Call `LoadLayered` once, with the composed definition, existing overlay and
|
|
override selections, and `BundledOpenRouterUnderlay()` as the lowest tier.
|
|
Do not rediscover/reopen the main, call bootstrap again, or set a mismatched
|
|
filesystem context. Preserve report access if the later load fails.
|
|
7. Return the native completed result unmodified. Error context may wrap with
|
|
`%w`, preserving both `LoadError` and `SecretsError`. Do not convert failures
|
|
into a synthetic ConfigKit result or attach secret-file entries as sources.
|
|
8. Migrate configuration tests. Add focused cases for shared resource decoding,
|
|
effective retired-key rejection, ordinary extension acceptance, raw-key
|
|
diagnostics/redaction, omitted/null/zero retries, recorded server normalization,
|
|
and typed native errors. Revise source assertions to account for the bundled
|
|
underlay instead of requiring the old single-source count.
|
|
9. Cover native bootstrap handoff using temp files and controlled environment:
|
|
preservation including an existing empty variable, explicit YAML overwrite,
|
|
no directory, optional discovery exhaustion, bootstrap failure and its report,
|
|
and a later validation failure retaining a successful bootstrap report/effect.
|
|
Reuse upstream coverage for entry parsing and directory limits. Use
|
|
`t.Setenv`/cleanup; environment-mutating tests must not run in parallel.
|
|
|
|
**Check when available:** `go test ./internal/config`. Defaults-only loading
|
|
still includes the selected bundle; configuration inspection performs no
|
|
PromptKit provider-credential lookup or message-file reads. Native bootstrap
|
|
still provisions the environment when configured. PromptKit's own settings
|
|
validation participates in the load.
|
|
|
|
## Stage 3 — Wire Shared Acquisition, Engine Handoff, And Bootstrap Diagnostics
|
|
|
|
**Status: Complete.** CLI acquisition forwards native bootstrap reports through
|
|
an invocation-local reporting feature, and run/server construct engines directly
|
|
from the completed application result. Server settings are consumed directly;
|
|
obsolete conversion types and schema defaults are removed. The process and HTTP
|
|
behavior remain unchanged. The former prompt/config adapter evidence machinery
|
|
is still present until its replacement in the next stage.
|
|
|
|
Go 1.27.4 offline build and configuration tests pass. Focused tests against the
|
|
production CLI files verify a controlled provider receives a bootstrapped dummy
|
|
credential without exposing it, and server bootstrap occurs before listening
|
|
and is not repeated for requests. Full CLI test compilation remains deferred
|
|
until old two-load fixtures are migrated as planned.
|
|
|
|
**Files:** `internal/adapter/cli/app.go`, `selection.go`, `engine.go`,
|
|
`native_run.go`, `server.go`, `outcomes.go`; a small CLI bootstrap-report helper.
|
|
|
|
1. Keep `loadApplication` as the common native-adapter loader. Map selectors and
|
|
presence-aware server overrides to `LoadOptions`, call the new loader once,
|
|
forward its bootstrap report, and return the actual result and typed error.
|
|
Retain context checks at acquisition boundaries; do not claim interruption
|
|
of synchronous upstream work that ignores context.
|
|
2. Use a small `commandkit.NewInvocationFeature` with `struct{}` input, no flags,
|
|
and no final report producer to provide the invocation's reporter to this
|
|
common acquisition path. Attach its handle once, with `WithInvocationFeature`
|
|
on the always-installed configuration declaration. `Start` decorates the
|
|
incoming context with a private-key report-sink callback and returns that
|
|
context. This is a reporting bridge, not an acquisition hook: it never loads
|
|
configuration, mutates environment, or creates an accounting group.
|
|
3. The CLI loader obtains that callback from its context and passes it the
|
|
returned `SecretsReport` and load error. The sink queues native `WriteTo`
|
|
rendering through `Reporter.AtEnd`: Info for nonempty successful bootstrap
|
|
reports, Warn for failed/blocked entries. For `SecretsError`, use its safe
|
|
diagnostics through `ckconfig.AdaptDiagnostics` and the diagnostic Details;
|
|
do not render raw wrapped host errors. Ordinary `LoadError` evidence remains
|
|
the native adapter's responsibility, without duplicate rendering by the sink.
|
|
Message visibility follows native verbose/debug/quiet behavior. Even if
|
|
report detail is suppressed, a bootstrap failure still returns a failed
|
|
native outcome. Rendering/writer errors remain native presentation failures.
|
|
4. Keep this sink invocation-local, with a no-op when no reporter is installed
|
|
(for direct loader tests). Queue report callbacks as each acquisition occurs;
|
|
do not recreate an acquisition journal, generic report envelope, global
|
|
reporter, per-selector cache, environment snapshot, or callback-per-resource
|
|
evidence reconciliation. Do not wrap `App.Execute` to intercept output.
|
|
5. Replace `newEngine(AppSettings, ...)` with direct `NewFromConfig(result,
|
|
RuntimeConfig{TransientRetries: result.Config.TransientRetries}, options...)`.
|
|
A small helper taking the actual result is acceptable if shared by run/serve;
|
|
it must not resolve/load anything or invent a second runtime settings model.
|
|
6. Update `runPrompt` to use the shared acquisition and native namespace view,
|
|
then call `Engine.Run` with the supplied invocation context and existing
|
|
request mapping. Adapt the one load's diagnostics once, from the completed
|
|
result or typed `LoadError`. Drop the application-vs-framework failure branch
|
|
and duplicate configuration inspection solely used for evidence reconciliation.
|
|
7. Update server startup to use `result.Config.Server` directly, inject the
|
|
existing restricted artifact reader, and construct one shared engine from
|
|
the same result before opening the listener. Keep timeout/limit values,
|
|
listener injection, cancellation/connection close behavior, and status mapping.
|
|
Do not bootstrap/load per HTTP request or attach server-global CLI accounting.
|
|
8. Remove `AppSettings`, `Settings`, `settings.go`, `SchemaDirDefault`, and their
|
|
conversion-only tests once callers use resolved application fields directly.
|
|
Remove old source-selection construction in `engine.go`; retain genuine
|
|
application discovery/flag mapping rather than deleting necessary integration.
|
|
9. Keep `ckconfig.ClassifyConfigurationError` authoritative for native errors.
|
|
`SecretsError` is an operational failure under that classifier; do not add a
|
|
local code/message classifier. Keep existing application domain status 4,
|
|
timeout behavior, and safe terminal explanations.
|
|
|
|
**Check:** a loopback-provider run can use a bootstrapped dummy credential without
|
|
emitting it. A server loads/bootstrap once at startup. Bootstrap report text is
|
|
diagnostic output, never part of an artifact, structured result, or HTTP response.
|
|
|
|
## Stage 4 — Replace The Native Configuration And Prompt Adapter Assembly
|
|
|
|
**Status: Complete.** Both native configuration scopes now use the common typed
|
|
loader, including subtree inspection and overrides on each scope. PromptKit
|
|
commands use the same loader and direct engine handoff with native callbacks;
|
|
the obsolete evidence state, decorators, and sentinel are removed. The upstream
|
|
invocation feature supplies token reporting without an application duplicate.
|
|
|
|
The application builds offline with Go 1.27.4. Focused native composition tests
|
|
pass for acquisition-free help, scope listing and shell completion, bare explain
|
|
help, shared loading and overrides in both scopes, and the bootstrap run/server
|
|
checks. Broader fixture and integration migration remains scheduled below.
|
|
|
|
**Files:** `internal/adapter/cli/native_config.go`, `native_prompt.go`,
|
|
`acquisition.go`, and related generic callback types/callers.
|
|
|
|
1. Assemble config with `Suite[applicationInput, struct{}]`. Use
|
|
`FromConfigKit("app", ..., loadApplication)` and
|
|
`FromConfigKitSubtree("promptkit", ..., configkit.Keys("promptkit"), loadApplication)`.
|
|
Set `Features.Overrides = true` on both scopes. Preserve app as the default
|
|
scope and native operations/path discovery; do not narrow the scope's native
|
|
explicit-path behavior or silently prefix `--set` paths.
|
|
2. Delete `frameworkConfigurationScope`'s engine-backed `ConfigScope` wrapper.
|
|
Neither config scope constructs an engine. Let the native adapters supply
|
|
configuration findings, path enumeration, redaction, and independent comparison
|
|
sides, including native whole-load/ancestor evidence in a focused view.
|
|
3. Assemble prompt commands with `ckprompt.FromEngine(loadEngine)` and the
|
|
existing request validation, preparation, smoke, namespace, and declaration
|
|
integrations, using `struct{}` for otherwise unused state. Keep all twelve
|
|
callbacks, existing bindings/aliases, and nil default request builders.
|
|
`loadEngine` calls the common loader and then `NewFromConfig`, returning
|
|
original typed acquisition errors; no sentinel masking is necessary.
|
|
4. Delete `acquisitionState`, `applicationAcquisition`, `errApplicationAcquisition`,
|
|
`attachApplicationEvidence`, `withApplicationEvidence`, and associated
|
|
mark/replay logic. Remove `acquisition.go` if empty. Do not retain dead helpers
|
|
or two-load tests as a compatibility option. The Stage 3 bootstrap sink is
|
|
separate and carries only native bootstrap report/diagnostic presentation.
|
|
5. Keep native `ckprompt.Declarations` installation. Its released integration
|
|
installs `--show-tokens` application-wide. Preserve its decorated invocation
|
|
context through every engine execution. Do not declare another flag,
|
|
observer/group, usage formatter, or final summary callback in Scriptorium.
|
|
6. Retain current run/serve application flags and output effects. Do not add
|
|
main `--output`, raw API-key flags, generalized config convenience flags,
|
|
or a selected-format accessor dependency.
|
|
|
|
**Check when fixtures are migrated:** help/version/completion and config scope
|
|
listing are acquisition-free; `config explain` with no path/list shows native
|
|
help without bootstrap or feature reports. Both scopes accept native overrides.
|
|
|
|
## Stage 5 — Migrate Maintained Configuration And Collection Examples
|
|
|
|
**Files:** application/definition YAML under `examples/`, maintained preview
|
|
scripts, representative collection resources, and example-loading tests.
|
|
|
|
1. Keep existing example entrypoint filenames usable. Replace all application
|
|
acquisition selectors with native root `config.imports`, preserving each
|
|
example's selected bundle of definitions, server choices, and overlay intent.
|
|
Migrate `config.yml`, `config.full.yml`, composed/collections/inheritance/
|
|
discovery variants, `config-fragments/sources.yml`, and application overlays.
|
|
2. Use a consistent placement convention: application files import complete
|
|
framework entry documents at root. Entry documents such as `promptkit.yml`,
|
|
`inheritance.yml`, and `collections.yml` place their wrapperless settings
|
|
imports at `[promptkit]`. Descendant wrapperless fragments inherit that mount.
|
|
Whole application/framework entries import at root without a second prefix.
|
|
Update the collection/GPU and inheritance chains accordingly. Preserve
|
|
peer-conflict and whole-record replacement behavior through native imports.
|
|
3. Keep standalone prompt/profile/backend fragments wrapperless where explicitly
|
|
mounted. Keep source-local `content_file` references and exact resource IDs.
|
|
Convert `generic.structured_events` to source-relative
|
|
`schema_file: ../schemas/structured_events.schema.json` and remove the old
|
|
application schema directory. Retain existing explicit zero repair budgets.
|
|
4. Keep `config.discovery.yml` importing `discovery/framework.yml`. Its optional
|
|
glob imports still discover both collection entry spellings. Collection
|
|
entry documents self-declare their namespace under `promptkit.collections`
|
|
and place standalone records using native sequence-item destinations such as
|
|
`[promptkit, collections, support, prompts]`. Keep relative checkout imports;
|
|
do not derive namespace IDs from directory names or load arbitrary checkout YAML.
|
|
5. Add a small source-relative schema example to the support checkout: a
|
|
`structured` prompt with an inline message and `schema_file` pointing to a
|
|
sibling schema, imported by the collection entry. Keep the existing answer/
|
|
summarize prompts' behavior unchanged. This complements the existing
|
|
source-relative answer message and proves checkout-local resource context.
|
|
6. Add `examples/config.secrets.yml` and a native directory containing only
|
|
clearly synthetic fixture text under a dedicated example environment name.
|
|
The main file imports the maintained definitions and declares native bootstrap
|
|
controls; no custom secret schema/CLI flag is introduced. Link upstream for
|
|
standalone provisioning instructions. Ensure example tests restore environment
|
|
and never rely on real credentials or contact a provider.
|
|
7. Update maintained preview scripts only as needed for these paths/formats.
|
|
Keep their provider-free behavior. Do not turn examples into a comprehensive
|
|
tutorial/test matrix for upstream features.
|
|
|
|
**Check when available:** `go test ./internal/adapter/cli -run 'TestMaintained'`;
|
|
run `bash examples/render-markdown-summary.sh` and
|
|
`bash examples/render-v0.9-features.sh` with cached dependencies/offline Go
|
|
settings. Validate both scopes for every maintained application example and
|
|
prepare the structured/schema examples without model calls.
|
|
|
|
## Stage 6 — Migrate CLI Acquisition, Inspection, And Source-Context Tests
|
|
|
|
**Files:** CLI `selection_test.go`, `native_config_test.go`, `native_prompt_test.go`,
|
|
`discovery_test.go`, `examples_test.go`, and small related fixture helpers.
|
|
|
|
1. Rewrite native fixture helpers to create one complete application source plus
|
|
native imported definitions, not an app file pointing at a second framework
|
|
load. Update expected configuration paths to `/promptkit/...`. Use keyed
|
|
expanded upstream structs and public input APIs where needed.
|
|
2. Replace `TestNativeApplicationScopeDoesNotLoadFramework` with the new boundary:
|
|
app scope sees and validates the complete document, including framework
|
|
settings, but no config scope captures message files, performs PromptKit
|
|
provider-credential lookup, reads schemas, or contacts a provider. Native
|
|
configured secrets bootstrap still runs. Missing resource files can
|
|
therefore permit config inspection yet fail later engine capture/preparation.
|
|
3. Replace old promptkit-scope override-rejection tests with positive override
|
|
cases in both scopes, including all-scope operation, independent
|
|
`--against-set`, changed framework values, and native overlap/conflict handling.
|
|
Keep rejection of Scriptorium-only server/source convenience flags where those
|
|
flags are not installed. Do not add a focused-scope override-path restriction.
|
|
4. Replace application-vs-framework evidence assertions with original-load
|
|
provenance, typed failures, native diagnostics without duplication, and native
|
|
left/right context. Keep redaction/history checks and ordinary `extra_params`
|
|
visibility. Verify a non-framework application setting can be explicitly
|
|
explained from the focused native view; it is not an isolation boundary.
|
|
5. Protect independent comparison source/overlay/override selection and the
|
|
selected bootstrap behavior: sequential sides share environment, preservation
|
|
keeps an earlier value, overwrite can replace it, and no restoration occurs.
|
|
Native diff still compares configuration, not secret-file bytes. Use unique
|
|
controlled environment variables and nonparallel tests.
|
|
6. Retain representative discovery/requirements/preview/smoke integration coverage
|
|
with real libraries. Verify captured message contexts and all three schema
|
|
modes through representative preparations: inline, source-relative file, and
|
|
explicit-root path with a collection root overriding the application root.
|
|
Missing explicit roots use native failure behavior, not a cwd fallback.
|
|
7. Extend the checkout workflow for the Stage 5 schema resource and fresh
|
|
invocations after installing a checkout. Retain both entry spellings,
|
|
namespace declarations, multiple records, relative imports, and provider-free
|
|
requirement discovery. Do not duplicate exhaustive ConfigKit grammar tests.
|
|
|
|
**Check:** focused native config/prompt/discovery/selection tests. Delete tests
|
|
whose only owner was the removed reconciliation machinery, not the regressions
|
|
protecting retained behavior.
|
|
|
|
## Stage 7 — Verify CLI Generation, Native Usage, And Delivery
|
|
|
|
**Files:** CLI `native_run_test.go`, `delivery_test.go`, `lifecycle_test.go`,
|
|
`app_test.go`, and a focused native usage integration test file if helpful.
|
|
|
|
1. Migrate remaining run/delivery/lifecycle fixture YAML and removed schema/input
|
|
APIs. Preserve artifact bytes, request presence (including zero and cleared
|
|
reasoning), timeout layering, namespace selection, explicit report formatting,
|
|
file failures, quiet-mode file delivery, and native finalization/status tests.
|
|
2. Use a controlled loopback provider with native OpenRouter `provider` metadata
|
|
and reported usage/cost to verify `run --show-tokens`: unchanged artifact
|
|
stdout, text summary only on diagnostics, native reasoning/cache/cost facts,
|
|
and native full result fields in structured stdout/separate reports. Check
|
|
semantic fragments or decoded fields, not whole upstream formatting snapshots.
|
|
3. Cover omitted/false/quiet suppression, repeated native flag selection through
|
|
one representative case, an operational failure/cancellation retaining an
|
|
available summary, and a zero-execution command. Verify explicit help and
|
|
bare config-explain help neither bootstrap nor produce a usage summary.
|
|
Keep smoke usage separate from ordinary execution summaries; use explicit
|
|
structured format where existing tests decode smoke output.
|
|
4. Add representative adoption coverage for omitted versus explicit zero repair
|
|
budgets using a provider that returns invalid then valid output. Let PromptKit
|
|
perform repairs; retain domain status 4 on exhausted invalid content and
|
|
operational status on schema/generation failures. Check attempt/terminal/result
|
|
facts without computing an application-owned accounting total.
|
|
5. Verify backend `provider` and explicit `zero_cost` fields appear in native
|
|
inspection and accept native vLLM metadata/default authentication selection.
|
|
A small local diagnostic fixture suffices; do not add real provider probes,
|
|
provider inference heuristics, or a parallel pricing/provider abstraction.
|
|
6. Exercise bootstrap-report forwarding via run/config/prompt entrypoints with
|
|
verbose diagnostics, a failed bootstrap, and a later load failure. Canary
|
|
credential contents must not appear in stdout, diagnostics, or reports.
|
|
Verify diagnostic-writer failure remains a native presentation failure.
|
|
|
|
**Check when available:** `go test ./internal/adapter/cli`. Native usage is
|
|
installed through ckprompt, not reimplemented to satisfy these tests.
|
|
|
|
## Stage 8 — Migrate HTTP, Report, And Process Fixtures Without Wire Expansion
|
|
|
|
**Files:** `internal/adapter/http/*_test.go`, `internal/report/*_test.go`,
|
|
`cmd/scriptorium/*_test.go`, and test fixtures/helpers reached by those tests.
|
|
|
|
1. Migrate root framework fixtures to `/promptkit`, explicit fragment mounts,
|
|
source-relative/explicit-root schemas, and current public input types. Simple
|
|
isolated upstream-engine test fixtures may still use supported `NewEngine`;
|
|
production Scriptorium acquisition uses the shared application load. Do not
|
|
create a shared test framework facade or convert unrelated fakes unnecessarily.
|
|
2. Keep HTTP request/response field sets, optional raw output and terminal report,
|
|
status/error mapping, strict decoding, and response-size fallback behavior.
|
|
In particular, do not automatically marshal the enlarged native RunResult
|
|
or ObservedTokenUsage into these DTOs: added reasoning, cost, ratio, and
|
|
prepared-hash fields are not new HTTP fields in this sprint.
|
|
3. Reuse HTTP/report tests to prove unchanged projection on success, invalid
|
|
output, and operational failure, and isolation across concurrent requests.
|
|
Internal simplification is allowed when it preserves that wire contract;
|
|
there is no requirement to freeze the current collector type permanently.
|
|
4. Retain transport/artifact limits, lexical containment and documented symlink
|
|
behavior, shared backend concurrency/capacity, request timeout/retry presence,
|
|
and parent cancellation protections. Bootstrap remains server startup work.
|
|
5. Migrate process identity/status/signal fixtures and preserve the current
|
|
main entrypoint and release identity injection. Do not add shutdown-drain,
|
|
durable state, or process-wide environment isolation guarantees.
|
|
|
|
**Check:** `go test ./internal/adapter/http ./internal/report ./cmd/scriptorium`.
|
|
Existing HTTP consumers need no reporting-schema migration for this work.
|
|
|
|
## Stage 9 — Consolidate Public And Operator Documentation Around Upstream Owners
|
|
|
|
**Files:** `README.md`, `docs/cli.md`, `docs/config.md`, `docs/operations.md`,
|
|
`docs/api.md`; maintained example links.
|
|
|
|
1. Apply the roadmap's documentation ownership table, not a mechanical version
|
|
replacement. Identify adopted libraries and link the pinned canonical sources
|
|
there; use relevant sections. Preserve one application quickstart and navigation.
|
|
2. In CLI docs retain installed entrypoints, application-selected bindings/aliases,
|
|
run/serve application flags, artifact/file effects, and application outcome
|
|
mappings. Replace repeated native family, reusable-flag, parser, formatter,
|
|
requirements, smoke, and finalization reference material with upstream links.
|
|
3. In config docs retain the application fields and selected discovery preset
|
|
order/underlay, embedded settings location, common bootstrap acquisition, and
|
|
final result handoff. Delegate filenames/preset expansion, composition,
|
|
imports/inheritance/overlays/override rules, sensitivity, secret-file processing,
|
|
and schema/repair/provider contracts upstream. Remove retired selector tables.
|
|
4. In operations retain Scriptorium deployment, restart, output retention,
|
|
service/reader policy, limits, and recovery responsibilities. Describe local
|
|
startup integration briefly and link native startup/comparison semantics;
|
|
do not write a second bootstrap or model-execution manual.
|
|
5. Keep the full application HTTP wire contract. Remove duplicated framework
|
|
semantic explanations in favor of selected-version links while preserving
|
|
DTO definitions, presence mapping, error/status mapping, and local effects.
|
|
Do not document deferred reporting fields as current or change wire behavior
|
|
to make documentation cleanup easier.
|
|
6. Check changed application examples/commands against the actual implementation;
|
|
run only provider-free examples by default. Fix links/anchors removed by
|
|
consolidation, including README and contributor navigation.
|
|
|
|
**Check:** local docs explain application selections/effects; adopted native
|
|
behavior has an upstream owner instead of a new local reference table.
|
|
|
|
## Stage 10 — Simplify Consumer And Migration Guidance
|
|
|
|
**Files:** `docs/consumers/api.md`, `upgrading-cli.md`, `upgrading-promptkit.md`,
|
|
`migrating-to-promptkit.md`, and `docs/integrations/subprocess.md`.
|
|
|
|
1. Keep concise executable-interface selection and process/stream/file
|
|
responsibilities, linking CLI/HTTP local owners and native upstream contracts.
|
|
2. Make `upgrading-cli.md` the application-specific migration owner for this
|
|
cutover: replace acquisition selectors with native imports/embedded settings,
|
|
note changed configuration inspection boundaries and enabled scope overrides,
|
|
and link the selected upstream migration/release guides for native changes.
|
|
3. Condense `upgrading-promptkit.md` to upstream format/API migration navigation
|
|
plus necessary Scriptorium-specific deployment pointers. Remove duplicated
|
|
before/after framework definitions, catalogs, inheritance/schema tutorials,
|
|
and obsolete acquisition advice. Do not retain a legacy loader.
|
|
4. Condense `migrating-to-promptkit.md` to the historical application/framework
|
|
split and destination guidance. Preserve the fact that v0.11.1 was the final
|
|
Scriptorium Go framework release; use upstream docs for its library successors
|
|
rather than maintaining an obsolete multihop library tutorial.
|
|
5. Preserve subprocess invocation/capture, application file-delivery, cancellation,
|
|
result availability and recovery choices without repeating native flags,
|
|
result schemas, retry/default rules, or feature descriptions. Repair incoming
|
|
links to removed headings. Keep published release records unchanged.
|
|
|
|
**Check:** migration remains actionable for Scriptorium callers and delegates
|
|
library migrations to their owners. New guidance does not imply compatibility
|
|
aliases, new HTTP fields, or new library feature guarantees.
|
|
|
|
## Stage 11 — Align Contributor And Internal Documentation With The Final Structure
|
|
|
|
**Files:** `docs/development.md`, `docs/internal/{overview,adapters,sources}.md`,
|
|
`docs/policy/architecture.md`, and `docs/roadmap/future.md`.
|
|
|
|
1. Update contributor version links and task routing for the selected dependencies.
|
|
Keep selective policy reading and baseline validation. Route native-feature
|
|
questions to upstream, local integration questions to focused local documents.
|
|
2. Replace two-load inventories/mechanics with the actual typed shared load,
|
|
bootstrap-report bridge, native config scopes, and direct engine handoff.
|
|
Remove obsolete package/helper descriptions and copied upstream lifecycle
|
|
explanations. Keep local adapter/process/HTTP implementation detail.
|
|
3. Update architecture's implemented version/boundary descriptions and links,
|
|
including the shared configuration's native inspection/sensitivity boundary.
|
|
Preserve deliberately selected application constraints. Do not elevate the
|
|
bootstrap sink, current report collector, or intermediate package choices
|
|
into architectural invariants. Retain policy provenance and update its local
|
|
last-updated date for actual edits; accepted ADR decision text is immutable.
|
|
4. Documentation policy v1.13 is already adopted: apply its Upstream Dependencies
|
|
section without another local policy rewrite or upstream policy refresh.
|
|
5. In future work, remove the now-delivered embedded-framework-configuration
|
|
direction once implementation is complete. Preserve HTTP redesign/accounting,
|
|
dynamic completion, optional format access, and other independently deferred
|
|
directions. Keep this feature roadmap as target/rationale and this plan as
|
|
execution record until deliberately retired; do not prematurely remove them
|
|
or erase deferred work.
|
|
|
|
**Check:** architecture/internal docs describe the landed implementation, all
|
|
local links/anchors resolve, and library contracts are linked rather than copied.
|
|
|
|
## Stage 12 — Audit The Complete Cutover And Validate The Sprint
|
|
|
|
1. Review all changes against the feature roadmap and this plan. Confirm:
|
|
|
|
- the five selected releases and their attributions agree;
|
|
- native bootstrap feeds one completed application load into PromptKit;
|
|
- all entrypoints use that acquisition path, with no production `NewEngine`
|
|
fallback, raw YAML reconstructor, second loader, or stale settings conversion;
|
|
- config scopes use the same loader and native whole/focused views, both with
|
|
overrides, while comparisons keep independent selections and native
|
|
process-environment effects;
|
|
- the old reconciliation state/decorators/sentinels and obsolete-only tests
|
|
are gone; remaining bootstrap forwarding is narrowly scoped;
|
|
- definitions, source-relative resources, native repair/schema/provider
|
|
behavior, prepared hashes, and native CLI accounting work end to end;
|
|
- generation bytes, independent reports, lifecycle/statuses, HTTP wire shape,
|
|
limits/reader policy, and shared capacity remain protected;
|
|
- documentation consolidation is complete rather than just version-bumped,
|
|
and HTTP reporting and other deferred work have not slipped into scope.
|
|
|
|
2. Run `gofmt` on changed Go files, finish `go mod tidy`, and inspect the actual
|
|
runtime graph with `go list -deps ./cmd/scriptorium` against attribution.
|
|
Do not copy graph-only tool dependencies into runtime notices automatically.
|
|
3. Use the selected Go 1.27.4 with a prepared module cache, `GOWORK=off`,
|
|
`GOTOOLCHAIN=local`, read-only modules, and offline dependency settings for
|
|
the final repository checks:
|
|
|
|
```sh
|
|
go test ./...
|
|
go test -race ./...
|
|
go vet ./...
|
|
go build ./cmd/scriptorium
|
|
git diff --check
|
|
```
|
|
|
|
Run affected provider-free preview scripts and the maintained discovery/schema
|
|
example checks. Review generated help and bash/zsh/fish completion for native
|
|
composition and the new usage flag. Tests use temp files, synthetic credentials,
|
|
and controlled providers, never real inference or credential services.
|
|
4. Inspect doc links and pinned upstream targets, attribution/license links,
|
|
changed examples, and the full diff. Reuse successful checks for unchanged
|
|
content rather than rerunning them solely for another reporting phase.
|
|
Remove only generated scratch artifacts created by this sprint.
|
|
5. Follow the repository commit policy, leaving the completed implementation
|
|
accurately recorded. Report actual checks, any failures, and remaining work.
|
|
Leave no committed workspace/vendor tree, module replacement workaround, or
|
|
unrelated sprint changes. Preserve unrelated local files rather than treating
|
|
a clean Git status as permission for broader cleanup.
|
|
|
|
This is implementation completion, not release publication. No version number,
|
|
release note, tag, push, CI polling, artifact verification gate, or new release
|
|
automation is required by this plan. The later breaking pre-v1 release should
|
|
use a new minor version under the existing release policy.
|
|
|
|
## Open Questions
|
|
|
|
None remain that require a product or architecture decision before this sprint.
|
|
The selected native shared-load/bootstrap path, both scopes' override support,
|
|
upstream documentation ownership, and HTTP-reporting deferral are settled.
|
|
Implementation mechanics selected above use released public APIs and preserve
|
|
their native behavior. Report a concrete newly discovered API/scope blocker
|
|
before changing the selected target.
|