Adopt native secrets bootstrap in the upgrade roadmap

This commit is contained in:
2026-11-23 00:53:00 +00:00
parent 5ba998d977
commit d01b4db02e

View File

@@ -2,19 +2,25 @@
## Status And Recommendation ## Status And Recommendation
Proposed, reviewed 2026-11-23 against Scriptorium commit Proposed. Revised 2026-11-22 to incorporate the selected native-workflow
`857c0bae201bb5f9b5ffdcb20c4f5a0bddb00114`. This is an upgrade recommendation, direction, including ConfigKit's configured secrets bootstrap. The code review
not an implementation plan or a record of implemented behavior. baseline is Scriptorium commit `857c0bae201bb5f9b5ffdcb20c4f5a0bddb00114`.
This is an upgrade recommendation, not an implementation plan or a record of
implemented behavior.
Adopt the latest released versions together, using ConfigKit's completed result Adopt the latest released versions together, using ConfigKit's completed result
as the handoff to PromptKit and CommandKit's native integrations for operator as the handoff to PromptKit and CommandKit's native integrations for operator
interfaces. Prefer a clean configuration migration over retaining the separate interfaces. Adopt native upstream workflows by default; retain an
framework-loading architecture. Expose native token/cost reporting and preserve application-specific workflow where a concrete Scriptorium requirement warrants
new definition features without building parallel application machinery. it. Use a clean configuration migration, including configured secrets bootstrap,
in place of the separate framework-loading architecture. Expose native token/cost
reporting and preserve new definition features without building parallel
application machinery.
The main approval decision is the configuration cutover described below. It The shared-load configuration cutover and native secrets bootstrap are the
changes the application format and inspection boundary, not just dependencies. selected direction. They change the application format, startup behavior, and
The recommended HTTP reporting additions are a smaller, separable decision. inspection boundary, not just dependencies. The recommended HTTP reporting
additions remain a separable decision.
## Reviewed Releases And Sources ## Reviewed Releases And Sources
@@ -83,8 +89,9 @@ v1.3.0 adds explicit secrets-directory startup helpers, main-file
Configured bootstrap returns a captured main source for the subsequent load, Configured bootstrap returns a captured main source for the subsequent load,
preserving its filesystem context. It writes process environment variables; preserving its filesystem context. It writes process environment variables;
partial writes survive a later failure. Ordinary loading consumes the controls partial writes survive a later failure. Ordinary loading consumes the controls
but never performs bootstrap itself. This is optional application startup work, but never performs bootstrap itself. Scriptorium must explicitly invoke the
not a new automatic credential lifecycle. helper to make the native configured-startup workflow available; operators opt
into file provisioning by declaring the main-file controls.
v1.4.0 supplies the key integration enablers: v1.4.0 supplies the key integration enablers:
@@ -102,10 +109,13 @@ creating a Scriptorium configuration projection or provenance merger. Keep
resolved settings consistent with frozen evidence until engine handoff; this resolved settings consistent with frozen evidence until engine handoff; this
requires ordinary ownership discipline, not a new generic deep-copy layer. requires ordinary ownership discipline, not a new generic deep-copy layer.
Recommendation: adopt v1.4.0 now; defer explicit secrets bootstrap unless wanted Recommendation: adopt v1.4.0 and integrate
as a separate startup capability. PromptKit still resolves `api_key_env` at its `LoadSecretsIntoEnvironmentFromConfig` into the common configuration-loading
native preparation/execution lifecycle. Converting those names to ConfigKit path. Preserve its native source capture, overwrite policy, reports, and failure
`Secret` fields would change that lifecycle and is not needed for this upgrade. semantics. This populates the environment before configuration loading;
PromptKit still resolves `api_key_env` at its native preparation/execution
lifecycle. Converting those names to ConfigKit `Secret` fields would change
that lifecycle and is not needed for this upgrade.
### PromptKit ### PromptKit
@@ -195,10 +205,12 @@ calls. No selected-main-format accessor is needed for current output delivery.
Replace the acquisition-only `PromptKitDocument` with public Replace the acquisition-only `PromptKitDocument` with public
`promptkit.Settings` at `Document.PromptKit`. Compose the existing application `promptkit.Settings` at `Document.PromptKit`. Compose the existing application
definition with `promptkit.Configure`. Load through `configkit.LoadLayered` definition with `promptkit.Configure`. Prepare the existing selected file/search
using the existing selected file/search source as main, imports and overlay source through ConfigKit's configured secrets helper, as described below, then
selection, existing override records, and `promptkit.BundledOpenRouterUnderlay()` load through `configkit.LoadLayered` using the returned captured source as main,
as the lowest-priority underlay. Defaults-only startup remains supported. imports and overlay selection, existing override records, and
`promptkit.BundledOpenRouterUnderlay()` as the lowest-priority underlay.
Defaults-only startup remains supported.
Pass the successful whole result to `promptkit.NewFromConfig`, supplying the Pass the successful whole result to `promptkit.NewFromConfig`, supplying the
existing optional transient-retry setting through `RuntimeConfig` and the HTTP existing optional transient-retry setting through `RuntimeConfig` and the HTTP
@@ -229,6 +241,52 @@ credential field and is not automatically protected: preserve Scriptorium's
existing raw-key boundary through application validation using public settings. existing raw-key boundary through application validation using public settings.
Do not redact `extra_params` as a whole or invent a new version requirement. Do not redact `extra_params` as a whole or invent a new version requirement.
### Native Configured Secrets Startup
Use `configkit.LoadSecretsIntoEnvironmentFromConfig` before each reached
application configuration load: execution, server startup, native configuration
inspection/comparison, and PromptKit commands all use the common acquisition
path. Pass its successful returned source directly to the layered main input;
this retains the selected main's captured contents and filesystem context
without rediscovery, rereading, or a second bootstrap during the load. Help,
version, static completion, and scope discovery remain acquisition-free.
The main file's root `config.secrets_dir` and `config.secrets_overwrite` are
the operator controls. Use native defaults rather than an application overwrite
override: existing variables, including empty ones, win unless the main file
selects overwrite. A main without a secrets directory remains valid, and
optional search exhaustion still permits defaults-only loading. Let ConfigKit
own directory resolution, containment, eligible entries, whitespace, limits,
and which source may declare these controls. Bootstrap all native eligible
entries, including environment names not referenced by PromptKit. No extra CLI
flag, custom secret-file parser, or new raw-key configuration field is needed.
Retain the returned `SecretsReport` on success and failure and expose its native
safe rendering through CommandKit's diagnostics, separately from the later
configuration report and main stdout. Preserve visibility of blocked/failed
entries and typed `LoadError` / `SecretsError` diagnostics without logging
credential contents or inventing source/provenance records for environment
writes. Thin forwarding of this explicit report is application integration,
not a replacement configuration-inspection workflow.
Bootstrap failure stops that acquisition; its returned source is unusable.
Already applied environment writes remain, including when a later load fails.
Each reached comparison side prepares its own selected source in native load
order, but both use the process environment as it exists at that point. In
preservation mode, a variable supplied while preparing an earlier side can win
over a later side's file; overwrite mode can replace it. Document these native
effects rather than promising environment-isolated comparisons or adding
snapshot/restore, rollback, or subprocess machinery. Configuration diffs still
compare native frozen configuration values, not secret-file contents or provider
credentials resolved later.
For `serve`, complete startup bootstrap and loading before accepting concurrent
requests. Keep bootstrap out of HTTP request handling and retain the shared
engine lifecycle. Native bootstrap precedes concurrent application work; adopting
it creates no hot-reload or environment-isolation guarantee. The
[upstream startup contract][secrets-contract] and [public helper][secrets-api]
own these semantics.
### Native Views Of The Same Result ### Native Views Of The Same Result
Keep `config`'s `app` scope as the complete application result using Keep `config`'s `app` scope as the complete application result using
@@ -242,7 +300,10 @@ reintroduce application-specific inspection selector flags.
Remove acquisition evidence transport/decorators that exist only to reconcile Remove acquisition evidence transport/decorators that exist only to reconcile
the former two loads. Preserve native typed errors, findings, source catalogs, the former two loads. Preserve native typed errors, findings, source catalogs,
and left/right comparison context. Emit diagnostics once for their real load, and left/right comparison context. Emit diagnostics once for their real load,
not as independently generated application and framework evidence. not as independently generated application and framework evidence. Retain only
the thin integration needed to carry the distinct native bootstrap report and
its diagnostics to the operator; this does not justify keeping two-load
reconciliation or merging bootstrap entries into configuration provenance.
The intentional operator change is that `app` inspection includes PromptKit The intentional operator change is that `app` inspection includes PromptKit
settings and validates the whole document. Invalid PromptKit settings can fail settings and validates the whole document. Invalid PromptKit settings can fail
@@ -250,7 +311,9 @@ an application inspection. The focused scope retains whole-load diagnostics and
explicit native queries, including outside `/promptkit`; ancestor differences explicit native queries, including outside `/promptkit`; ancestor differences
can survive focused comparison. Neither scope promises isolation. Each reached can survive focused comparison. Neither scope promises isolation. Each reached
comparison side still loads independently from its own selection, without comparison side still loads independently from its own selection, without
sharing mutable results or inheriting the other side's options. sharing mutable results or inheriting the other side's options. That source and
option independence does not isolate process-global environment effects from
native secrets bootstrap.
### Definition, Example, And Repair Migration ### Definition, Example, And Repair Migration
@@ -304,6 +367,29 @@ counts to token totals, interpret unknown as zero, estimate prices, or claim
invoice accuracy. No HTTP request controls or broader HTTP redesign are needed invoice accuracy. No HTTP request controls or broader HTTP redesign are needed
to expose these result facts. to expose these result facts.
### Justified Application-Owned Boundaries
The native-workflow goal removes duplicate source loading, configuration
composition, inspection, provider/schema handling, and CLI accounting. The
remaining local responsibilities have concrete application purposes:
- HTTP DTOs, transport limits, restricted artifact reading, and request-scoped
report projection implement Scriptorium's service boundary. CommandKit's
native CLI reporting is not an HTTP transport. Reuse native PromptKit facts
within that boundary, without preserving a second accounting algorithm.
- Exact artifact stdout, independent report-file delivery, and the whole-run
timeout map already selected application execution/delivery choices onto
native public APIs; upstream still owns rendering, timeout enforcement,
preparation, and execution semantics.
- Application discovery selection, server settings, domain callbacks, process
lifecycle, and safe bootstrap-report forwarding are consumer integration
responsibilities, consistent with ADR 0005. ConfigKit and PromptKit continue
to determine how selected inputs and requests are processed.
These are scoped reasons for local integration, not a general exception allowing
parallel versions of native workflows. Shared loading and native bootstrap have
no identified Scriptorium-specific requirement that warrants a legacy path.
### Documentation, Licensing, And Verification ### Documentation, Licensing, And Verification
Update the canonical configuration, CLI, HTTP (if selected), operations, Update the canonical configuration, CLI, HTTP (if selected), operations,
@@ -312,6 +398,9 @@ changes. Update the architecture policy's current integration description and
versioned upstream links; accepted ADR decision text remains unchanged. Mark the versioned upstream links; accepted ADR decision text remains unchanged. Mark the
embedded-configuration direction in [future work](future.md) as delivered only embedded-configuration direction in [future work](future.md) as delivered only
when its implementation lands. Other deferred directions remain separate. when its implementation lands. Other deferred directions remain separate.
Describe configured bootstrap, native overwrite behavior, partial environment
effects, and comparison behavior in configuration/operations guidance. Include
maintained secret-free provisioning examples when implementation lands.
The five selected components' COPYRIGHT and LICENSE texts are unchanged from The five selected components' COPYRIGHT and LICENSE texts are unchanged from
their adopted baselines and remain LGPL-3.0-or-later. During implementation, their adopted baselines and remain LGPL-3.0-or-later. During implementation,
@@ -331,6 +420,14 @@ and shared backend capacity using representative real-library integration tests
with controlled providers. Reuse existing coverage rather than duplicate upstream with controlled providers. Reuse existing coverage rather than duplicate upstream
format/accounting matrices. format/accounting matrices.
Protect bootstrap integration with representative native-helper tests: selected
main capture, absent-directory/defaults-only behavior, environment preservation
and explicit overwrite, bootstrap reports on failure, and comparison-side
effects. Control process environment in those tests; avoid parallel tests that
mutate the same environment. Test that successful bootstrap reaches PromptKit's
ordinary credential lookup without leaking values into output. Do not retest
the upstream directory-entry and parsing matrix locally.
Run normal repository code validation and affected maintained examples during Run normal repository code validation and affected maintained examples during
implementation; default tests remain offline and credential-free. This review implementation; default tests remain offline and credential-free. This review
did not upgrade modules or compile/test the proposed combination. A green build did not upgrade modules or compile/test the proposed combination. A green build
@@ -342,21 +439,6 @@ preparation, not in this roadmap.
## Open Decisions ## Open Decisions
### Shared-Load Configuration Cutover
**Recommendation:** approve the embedded-settings, single-load target above,
including whole-document application inspection and native imports in place of
`promptkit.configuration`. It realizes the previously deferred integration,
reduces custom evidence handling, and follows the adopted ownership boundaries.
Provide migration guidance without a legacy loader.
**Alternative:** adopt the released dependencies using standalone `NewEngine`,
retain a separate external-file selector, and migrate only that file's format
and schema handling. This is viable and narrows the immediate application change,
but retains two resolution lifecycles and diagnostic plumbing while postponing
the most useful new integration API. It still requires the upstream breaking
format/default changes; it is not a dependency-only patch.
### HTTP Accounting Additions ### HTTP Accounting Additions
**Recommendation:** include the additive reasoning/cost/cache visibility above. **Recommendation:** include the additive reasoning/cost/cache visibility above.
@@ -370,22 +452,6 @@ work and cleanly separates the deferred HTTP review, at the cost of knowingly
omitting newly available evidence for HTTP consumers. Definition support does omitting newly available evidence for HTTP consumers. Definition support does
not itself require these response additions. not itself require these response additions.
### Configured Secrets Bootstrap
**Recommendation:** defer explicit bootstrap for now. Existing deployments
supply environment variables, and native PromptKit credential timing remains
appropriate. Global environment writes require a deliberate startup policy,
particularly for inspection/comparison invocations; adopting the library alone
does not select one.
**Alternative:** expose ConfigKit's configured-main bootstrap as an opt-in
startup capability. Use its returned captured source for the same subsequent
load, honor native overwrite controls, and handle partial failures without
logging contents. This helps file-provisioned deployments but needs a separately
agreed process-wide startup boundary so one comparison side's environment writes
cannot be mistaken for independent configuration resolution. Neither option
requires adding raw-key settings or changing PromptKit to typed ConfigKit secrets.
[ck130]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/652ddb649c60208dbba964f0ef919e36725c12c0/docs/releases/v1.3.0.md [ck130]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/652ddb649c60208dbba964f0ef919e36725c12c0/docs/releases/v1.3.0.md
[ck140]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/releases/v1.4.0.md [ck140]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/releases/v1.4.0.md
[pk240]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/5ea60e9b96651fd7dfcbc7d05b6f43d131df358f/docs/releases/v0.24.0.md [pk240]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/5ea60e9b96651fd7dfcbc7d05b6f43d131df358f/docs/releases/v0.24.0.md
@@ -395,3 +461,5 @@ requires adding raw-key settings or changing PromptKit to typed ConfigKit secret
[cc110]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888/integrations/ckconfig/docs/releases/v0.11.0.md [cc110]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888/integrations/ckconfig/docs/releases/v0.11.0.md
[cp110]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/54e951e38a404b4338c7967ac39c6c01159bf76d/integrations/ckprompt/docs/releases/v0.11.0.md [cp110]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/54e951e38a404b4338c7967ac39c6c01159bf76d/integrations/ckprompt/docs/releases/v0.11.0.md
[cp120]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/2422ccf02d6b55756b07f21e66a581202a09fc3f/integrations/ckprompt/docs/releases/v0.12.0.md [cp120]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/2422ccf02d6b55756b07f21e66a581202a09fc3f/integrations/ckprompt/docs/releases/v0.12.0.md
[secrets-contract]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap
[secrets-api]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/secrets.go