207 lines
12 KiB
Markdown
207 lines
12 KiB
Markdown
# Audit Remediation Discussion
|
||
|
||
Created 2026-11-24; updated 2026-11-25. Status: topics 1–3 accepted; remaining
|
||
topics pending discussion. No remediation implementation is recorded yet.
|
||
|
||
This document gives maintainers an ordered agenda for working through the
|
||
[audit catalog](catalog.md). 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](../../policy/architecture.md) and the proportionality
|
||
required by the [testing policy](../../policy/testing.md).
|
||
|
||
## 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 | Accepted 2026-11-25: strengthen tests at application boundaries, consolidate redundant scenarios, and remove incidental assertions without new runtime requirements. |
|
||
| 3. Improve startup diagnostics at the owning boundary | 8 | Accepted 2026-11-25: native explanations for listener failures, upstream-owned capture diagnostics, and independent delivery of the two improvements. |
|
||
| 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](catalog.md#1-restricted-file-acquisition-can-ignore-cancellation-and-stall).
|
||
|
||
- Preserve large and nested provider numbers through the existing decoder's
|
||
`UseNumber` support. 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.Open` alone 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
|
||
|
||
**Decision — accepted 2026-11-25:** Strengthen protection for existing behavior
|
||
without new product requirements. Replace weak or redundant assertions rather
|
||
than broadly expanding the test inventory.
|
||
|
||
| Catalog entries | Accepted disposition |
|
||
| --- | --- |
|
||
| [4 and 7](catalog.md#4-shared-engine-lifetime-is-not-protected-at-server-composition) | 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](catalog.md#9-artifact-hash-tests-reuse-the-production-implementation-as-oracle) | Replace the production-helper oracle with independently known digests for fixed content. A suitable upstream public comparison remains an alternative when interoperability is the purpose. |
|
||
| [10](catalog.md#10-collector-fixtures-cannot-detect-swapped-cache-usage-fields) | Use distinct accounting values and check required field names and value/known/complete semantics. |
|
||
| [11](catalog.md#11-server-engine-construction-failure-lacks-boundary-coverage) | 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](catalog.md#12-removed-flag-tests-can-pass-because-the-prompt-operand-is-missing) | Supply otherwise-valid invocations and verify rejection of the removed flag specifically, using native typed evidence where available or a minimal flag-specific diagnostic fragment. Retain the selected hard-cutover protection. |
|
||
| [13](catalog.md#13-http-error-mapping-tests-pin-noncontractual-prose) | Assert status, code, precedence, usable messages, and cause privacy without freezing noncontractual sentences. |
|
||
|
||
Preserve distinct privacy and retry checks when consolidating capacity tests.
|
||
Retain exact wording assertions only where wording is expressly contractual;
|
||
constructor-failure coverage must not prescribe new diagnostic wording.
|
||
The numeric representation assertion belongs with the precision correction in
|
||
topic 1. Avoid coverage quotas, exhaustive upstream test matrices, new runtime
|
||
limits, and tests that silently establish resource or disclosure guarantees.
|
||
|
||
## 3. Improve Startup Diagnostics At The Owning Boundary
|
||
|
||
**Decision — accepted 2026-11-25:** Address
|
||
[catalog entry 8](catalog.md#8-cli-startup-failures-hide-actionable-resource-context)
|
||
through the component that owns each failure.
|
||
|
||
- Application-owned listener failures: identify the selected address and a
|
||
useful failure category through native CommandKit explanations, using typed
|
||
error information where available. Deliver this improvement independently
|
||
of framework diagnostic support.
|
||
- PromptKit capture failures: seek upstream-provided resource identity or
|
||
configuration location and a useful explanation. PromptKit owns the supported
|
||
diagnostic representation and safe content; ckprompt supplies native
|
||
presentation. Native PromptKit commands should benefit alongside application
|
||
commands.
|
||
|
||
**Upstream follow-up:** Verify whether the selected public APIs can supply the
|
||
structured capture information and ckprompt can present it. If support is
|
||
missing, prepare an upstream feature request and defer that portion until
|
||
supported. The exact upstream API remains to be determined; do not build a
|
||
Scriptorium-owned framework-error interpreter.
|
||
|
||
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](catalog.md#5-http-connection-lifetimes-need-a-deployment-decision)
|
||
requires a deployment decision, not an automatic timeout patch.
|
||
|
||
**Open questions:**
|
||
|
||
1. Which supported deployments rely on gateway controls, and which need
|
||
Scriptorium to bound body reads, idle connections, or response delivery?
|
||
2. 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](catalog.md#6-per-file-limits-do-not-establish-an-aggregate-memory-budget)
|
||
demonstrates a distinction between per-file and aggregate limits, not a measured
|
||
production exhaustion problem or a need for new orchestration.
|
||
|
||
**Open questions:**
|
||
|
||
1. Is the objective capacity planning, an aggregate input cap, or a stronger
|
||
memory guarantee?
|
||
2. Which representative workloads and deployment sizes justify additional
|
||
controls beyond existing file and backend limits?
|
||
3. 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](catalog.md#14-http-handler-responsibilities-are-hard-to-review-independently):
|
||
extract a few cohesive private decoding, mapping, or projection helpers while
|
||
retaining a clear request lifecycle and existing behavioral tests.
|
||
- [15: CLI diagnostics](catalog.md#15-cli-diagnostic-adaptation-is-duplicated-and-failure-selection-is-nested):
|
||
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](catalog.md#17-optional-model-mapping-has-redundant-nil-handling):
|
||
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](catalog.md#16-http-terminal-report-ownership-spans-two-packages)
|
||
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.
|