12 KiB
Audit Remediation Discussion
Created 2026-11-24; updated 2026-11-25. Status: topic 1 accepted; remaining topics pending discussion. No remediation implementation is recorded yet.
This document gives maintainers an ordered agenda for working through the audit catalog. The catalog and its source reports own the findings and evidence; this document owns the proposed disposition, open questions, and subsequent decisions. It is not an implementation plan or a new audit.
Overall Assessment
The findings support Scriptorium's existing direction: a thin executable that delegates configuration, execution, operator interfaces, and release mechanics to the upstream libraries. No broad architectural redesign is indicated.
The catalog distinguishes production defects, behavioral test weaknesses, deployment choices, and optional cleanup. Its 17 entries should not become 17 mandatory implementation tasks. The defective-overlay experiments provide useful evidence of test blind spots; statement coverage alone missed them.
Recommended sequence: settle the narrow corrective work first, then diagnostic ownership and deployment questions, then optional cleanup. Deployment decisions need not delay confirmed bug fixes. Retain the boundaries in the architecture policy and the proportionality required by the testing policy.
Discussion Order And Decision Record
Work through the sections below in order. Record accepted scope, deferrals, and any necessary follow-up in this table as decisions are made. Pending entries are proposals, not authorization to introduce new behavior.
| Topic | Catalog entries | Decision |
|---|---|---|
| 1. Correct the production defects | 1–3 | Accepted 2026-11-25: lossless numbers, pathname identity, regular-file acquisition with cooperative cancellation; upstream reader reuse is separate follow-up. |
| 2. Strengthen existing behavioral protection | 4, 7, 9–13 | Pending |
| 3. Improve startup diagnostics at the owning boundary | 8 | Pending |
| 4. Select HTTP connection-lifetime policy | 5 | Pending |
| 5. Establish whether additional memory controls are needed | 6 | Pending |
| 6. Select proportionate local cleanup | 14, 15, 17 | Pending |
| 7. Decide whether to move HTTP report ownership | 16 | Pending |
1. Correct The Production Defects
Decision — accepted 2026-11-25: Make narrow fixes with focused regression coverage for catalog entries 1–3.
- Preserve large and nested provider numbers through the existing decoder's
UseNumbersupport. Verify the outgoing provider request losslessly through a real engine and loopback provider; avoid a new numeric conversion layer. - Preserve significant pathname whitespace. Test distinct padded and unpadded files, keeping configured-root normalization separate.
- Carry context through artifact acquisition and check cancellation during
reading and before success. Follow upstream's regular-file behavior so an
existing FIFO cannot block opening. Context checks after
os.Openalone do not resolve that case.
Reader scope: Adopt upstream's ordinary regular-file acquisition and cooperative cancellation semantics. Reject unsupported non-regular inputs before opening; streaming input support is outside this remediation. Retain lexical containment and enforce byte limits during acquisition. The existing symlink policy remains unchanged: the OS may follow symlinks to regular files. Do not introduce abandoned-read goroutines, a symlink sandbox, or an immediate-interruption guarantee.
Separate upstream follow-up: The restricted reader mixes legitimate HTTP access policy with ordinary reading and metadata mechanics. The inspected PromptKit implementation already handles relevant cancellation behavior, but that reader implementation is internal. Investigate whether a supported reusable reader would reduce duplication. Any proposal must retain Scriptorium's access policy and enforce byte limits during acquisition, not only after reading. Do not import or copy upstream internals. This investigation and any upstream release are not prerequisites for correcting the local defect.
2. Strengthen Existing Behavioral Protection
Recommendation: Proceed without new product requirements. Prefer replacing weak or redundant assertions over expanding the test inventory.
| Catalog entries | Recommended disposition |
|---|---|
| 4 and 7 | Consolidate shared-capacity protection at the real server boundary. Register cancellation, release, and joining before launching workers; bound the second request. Remove the lower-level duplicate only when its meaningful protection is covered. |
| 9 | Replace the production-helper oracle with independently meaningful digest expectations. |
| 10 | Use distinct accounting values and check required field names and value/known/complete semantics. |
| 11 | Cover a resolved configuration whose engine construction fails: typed cause, nonzero status, and no listen attempt. This need not wait for topic 3's diagnostic design. |
| 12 | Supply otherwise-valid invocations and verify rejection of the removed flag specifically. Retain the selected hard-cutover protection. |
| 13 | Assert status, code, precedence, usable messages, and cause privacy without freezing noncontractual sentences. |
The numeric representation assertion belongs with the precision correction in topic 1. Avoid coverage quotas, exhaustive upstream test matrices, and tests that silently establish new resource or disclosure guarantees.
3. Improve Startup Diagnostics At The Owning Boundary
Recommendation: Split catalog entry 8 into two responsibilities rather than designing one universal error renderer.
- Application-owned listener failures: provide deliberate, safe address and failure-category context through native CommandKit explanations.
- PromptKit capture failures: establish a supported structured diagnostic path through PromptKit and ckprompt, requesting upstream support if needed. Native PromptKit commands should benefit alongside application commands.
Open questions:
- Which resource identifiers and failure categories should operators receive?
- Can the selected public APIs supply and render that information safely, or is an upstream extension needed?
- Should the local listener improvement proceed independently while framework support is investigated? Recommendation: yes.
Retain typed causes and current statuses. Do not parse error prose, print arbitrary causes, or move resource capture into configuration inspection. Sharing the existing ConfigKit diagnostic helper does not itself solve these constructor failures.
4. Select HTTP Connection-Lifetime Policy
Catalog entry 5 requires a deployment decision, not an automatic timeout patch.
Open questions:
- Which supported deployments rely on gateway controls, and which need Scriptorium to bound body reads, idle connections, or response delivery?
- If application controls are needed, which phases, configurable values, and defaults should they cover?
Recommendation: Prefer existing gateway controls where appropriate. A trusted network alone does not prevent stalled clients. For direct deployments needing controls, use standard HTTP deadlines chosen for the relevant phases. A short global write timeout can cut off legitimate inference; a context deadline alone does not interrupt a blocked body read. Keep the engine operation budget and shutdown contract unchanged unless separately decided.
5. Establish Whether Additional Memory Controls Are Needed
Catalog entry 6 demonstrates a distinction between per-file and aggregate limits, not a measured production exhaustion problem or a need for new orchestration.
Open questions:
- Is the objective capacity planning, an aggregate input cap, or a stronger memory guarantee?
- Which representative workloads and deployment sizes justify additional controls beyond existing file and backend limits?
- If acquisition limits are warranted, what belongs in PromptKit rather than Scriptorium?
Recommendation: Start with representative workloads and the full resource envelope: inputs, rendering expansion, admitted runs, output, and delivery buffers. An aggregate input cap alone would not bound process memory. A gateway cannot infer referenced-file bytes from request size. Prefer upstream support for library-owned acquisition controls, and do not add a parallel admission system or arbitrary rejection rules without an agreed requirement.
6. Select Proportionate Local Cleanup
Recommendation: Consider these changes when adjacent corrective work makes their benefit concrete; none is a prerequisite for fixing the defects.
- 14: HTTP handler: extract a few cohesive private decoding, mapping, or projection helpers while retaining a clear request lifecycle and existing behavioral tests.
- 15: CLI diagnostics: share the small run/serve evidence-selection bridge and flatten failure selection where helpful. Preserve native inspection ownership and error precedence; do not force distinct failure paths into one abstraction.
- 17: Optional model mapping: call the existing nil-aware converter unconditionally when touching request mapping, preserving omitted/null versus explicit-empty behavior.
Decision to record: Which cleanups are useful in the corrective work, and which should remain deferred? No middleware framework, universal classifier, or interface for every phase is warranted.
7. Decide Whether To Move HTTP Report Ownership
Catalog entry 16 offers two coherent choices: co-locate the collector/projection with the HTTP adapter, or retain the isolated package with its HTTP-specific purpose clear.
Recommendation: Defer moving it unless adjacent report work makes the maintenance benefit concrete. Package count alone is insufficient justification. The accounting-test correction in topic 2 can proceed in either location.
Decision to record: Retain the current boundary or move the implementation and focused tests together. Either choice should preserve HTTP wire behavior, terminal-only observation, detached snapshots, and request isolation, while keeping CLI native reports distinct. No shared reporting framework is needed.
Review Basis
These recommendations consolidate the catalog review, supporting reports, and selected application and pinned PromptKit source inspection. The review did not rerun the recorded experiments or tests. Decisions and implementation status should be added explicitly rather than inferred from these proposals.