20 KiB
Consolidated Audit Findings
Consolidated on 2026-11-24 at repository revision
5f194da734f478f5c34102c02c5f666f5da25b97.
Scope And Ordering
This catalog covers all ten audit reports currently in this directory. It contains 17 consolidated entries, merging repeated underlying issues and including the associated regression-test gaps with the production defects they protect. Separate problems within a combined original finding remain distinguishable here. The original reports retain their detailed evidence, reproductions, alternatives, and limitations.
Order reflects recommended attention: confirmed production defects first, protection of the shared-engine constraint next, then deployment decisions, test reliability/operator diagnostics, remaining test weaknesses, and optional refactoring. Original priority labels are retained where applicable; ordering does not establish release gates or promote optional proposals into requirements. Deployment exposure can change the relative urgency of entries 5 and 6.
Application and tool sources have not changed between the first audit's baseline and this revision. No finding is marked remediated by this catalog. This is a consolidation of recorded evidence, not a fresh runtime audit or an implementation plan.
The remediation discussion provides an ordered agenda of recommendations, open questions, and decisions to record against these findings.
Current Architecture
Scriptorium is a thin CLI/HTTP executable with six production packages. ConfigKit owns resolved configuration, PromptKit owns preparation/execution and backend admission, CommandKit and its integrations own native operator workflows, and ReleaseKit owns release mechanics. Local packages own process and server composition, application schema/defaults, HTTP adaptation and artifact-access policy, CLI report-file effects, and HTTP terminal-report projection. The server shares one engine; requests and collectors are local to each invocation. See the component overview.
1. Restricted File Acquisition Can Ignore Cancellation And Stall
Classification: Confirmed production defect; P2.
The restricted HTTP reader checks context only on entry, then calls file helpers without it. An existing FIFO can block acquisition beyond client cancellation or the operation budget, retaining pending work until another filesystem participant releases it. The reader can then return success despite cancellation. The concurrency/resource/error audits describe the same defect, not additional bugs.
Carry context through acquisition, check it cooperatively during reads and before success, and align unsupported-file handling with the ordinary upstream reader. Add bounded post-start cancellation/non-regular-input regression coverage with reliable cleanup and a representative engine or HTTP path. Preserve lexical containment and byte limits; this does not call for a symlink sandbox, abandoned-read goroutines, or immediate interruption guarantees.
Original entries: Correctness §3, Concurrency §1, Resources: previously recorded cleanup, Error handling: previously recorded failures, Testing §1: acquisition coverage. The efficiency assessment also carries this existing finding forward without a new algorithmic finding.
2. HTTP Provider Parameters Lose Large Integer Precision
Classification: Confirmed production defect and coupled test weakness; P2.
HTTP decoding of model.extra_params into untyped values rounds integers
through float64 before PromptKit sees them, including nested values. The
existing small-number fixture misses the corruption and its concrete-float64
assertion rejects the proposed lossless representation.
Use the existing decoder's UseNumber capability, or another lossless handoff
supported by PromptKit. Consolidate extra-parameter mapping protection with an
HTTP-to-engine-to-loopback-provider regression using large nested integers.
Replace the incidental Go-type expectation with lossless semantic/wire checks;
do not normalize expected and actual values through float64. Retain strict
decoding, typed numeric validation, and trailing-token rejection.
Original entries: Correctness §1, Testing §1: numeric boundary coverage, Testing §7: numeric-representation assertion.
3. Filename Trimming Can Select The Wrong Input Artifact
Classification: Confirmed production defect; P3.
resolveLexicalPath trims significant filename whitespace. If padded and
unpadded names both exist, a valid request can silently read the other file;
otherwise the intended file may fail to load. Existing containment tests lack
the decisive identity case.
Preserve the request pathname through lexical cleaning/containment checks and verify distinct padded/unpadded files with different content. Keep configured artifact-root normalization separate. No stronger filesystem policy is needed.
Original entries: Correctness §2, Testing §1: filename-identity coverage.
4. Shared Engine Lifetime Is Not Protected At Server Composition
Classification: Behavioral test gap; P2 for shared admission. Current production construction is correct.
The handler capacity test injects one engine itself, while server tests do not overlap capacity-limited runs. A deliberately defective per-request-engine overlay passed the full suite, showing that the tests miss the lifetime-owning boundary despite the accepted shared-engine constraint.
Move/consolidate the representative capacity scenario into the real server harness: hold one provider call under a capacity-one/no-queue configuration and observe rejection without a second provider dispatch. Retain distinct privacy/retry checks and the cleanup protections in entry 7. Remove the lower-level duplicate only once the stronger scenario subsumes it.
Original entry: Testing §4: shared-engine lifetime.
5. HTTP Connection Lifetimes Need A Deployment Decision
Classification: Deployment-dependent resource weakness; additional policy choice, not a violated timeout guarantee.
The header timeout does not bound stalled request bodies, idle connections, or response delivery. The execution budget starts after decoding and excludes delivery. A real-server diagnostic confirmed a stalled body retained work beyond the header timeout; idle/write implications were assessed statically.
Select appropriate gateway controls or consider configurable application phase deadlines for direct deployments. Defaults and exposure assumptions need agreement. A short global write timeout can truncate legitimate inference; a context deadline alone does not interrupt a blocking body read. Keep the operation budget and shutdown contract unchanged unless separately decided.
Original entry: Resources §1.
6. Per-File Limits Do Not Establish An Aggregate Memory Budget
Classification: Deployment/capacity-planning decision; not a broken per-file limit or an admission-ordering defect.
A small request can reference many individually permitted files, whose materialized bodies and rendering/delivery copies accumulate. Backend admission already covers ordinary input acquisition, but one admitted run can still consume much more than one file cap. The source audit used a tiny two-file diagnostic, not a large-memory saturation test.
Size the full deployment envelope using inputs, rendering expansion, admitted runs, and delivery buffers. If harder bounds are needed, decide explicitly on aggregate acquisition/request admission, using native PromptKit capabilities or upstream extensions where appropriate. A gateway request-size cap alone cannot infer referenced-file bytes. Do not introduce unapproved rejection rules, duplicate orchestration, or per-request engines.
Original entry: Resources §2.
7. Capacity-Test Failure Paths Can Leak Workers Or Hang The Suite
Classification: Confirmed test-lifetime weakness; P3, test only.
TestHandlerSharesBackendCapacityAcrossConcurrentRequests releases/joins its
first worker only after assertions. Early failure bypasses cleanup, and a
regression admitting the synchronous second call can trap the test before
release. Happy-path timers do not bound that middle call.
Register test-controlled cancellation/release/join before launching workers, bound the second request, and keep channel closure single-owner. If entry 4 replaces this test, carry the protections into its replacement instead of maintaining two scenarios. No production time limit is implied.
Original entries: Concurrency §2, Resources: previously recorded cleanup, Error handling: previously recorded failures, Testing §6.
8. CLI Startup Failures Hide Actionable Resource Context
Classification: Operator-diagnostic weakness; P3, not a broken typed cause or a requirement to disclose arbitrary errors.
Malformed message templates, missing message files, and unusable listen
addresses produce generic terminal explanations. Useful context survives in
Outcome.Cause, but the executable returns only status and native presentation
does not print causes automatically. These constructor failures are not
ConfigKit LoadErrors; sharing the existing diagnostic helper alone will not
fix them.
Provide deliberate safe context through native explanations. Prefer upstream-supported structured capture diagnostics for native PromptKit workflows, requesting upstream support if necessary. Retain privacy, typed causes, and current statuses. Do not print arbitrary causes, parse error prose, or move template/resource capture into ordinary configuration inspection. The constructor test gap in entry 11 is related but independently addressable.
Original entry: Error handling §1.
9. Artifact Hash Tests Reuse The Production Implementation As Oracle
Classification: Behavioral test weakness; P3. No current hash defect was demonstrated.
The contained-file reader test computes its expected digest through the same
artifactHash helper used by production. A constant-hash overlay passed the
full suite. Use an independent expected digest for fixed content or an
appropriate public upstream comparison, with different content and meaningful
expectations. Keep body/URI/containment checks; no new hash-uniqueness guarantee
or exhaustive cryptographic testing is needed.
Original entry: Testing §2.
10. Collector Fixtures Cannot Detect Swapped Cache Usage Fields
Classification: Behavioral test weakness; P3. No current projection defect was demonstrated.
Cached-token and cache-write-token fixture values are both zero, and JSON
assertions count members rather than checking their names and values. A swap
of those mappings passed the full suite. Use distinct counts and meaningful
Known/Complete combinations; assert the required value, known, and
complete semantics. Preserve zero/unknown/incomplete distinctions without
duplicating upstream billing tests. These tests move with the collector if
entry 16 is adopted.
Original entry: Testing §3.
11. Server Engine-Construction Failure Lacks Boundary Coverage
Classification: Behavioral test gap; P3. Distinct from shared engine lifetime and from the diagnostic design proposal.
Server failure tests cover load/validation/listener failures, but not a resolved configuration whose engine construction fails on a missing message file or malformed template. Cover the typed failure, nonzero status, and absence of a listen attempt. Do not manufacture unreachable LoadErrors for coverage, move capture into configuration inspection, or freeze new diagnostic wording before entry 8's presentation approach is selected.
Original entry: Testing §4: constructor failure.
12. Removed-Flag Tests Can Pass Because The Prompt Operand Is Missing
Classification: Behavioral test weakness; P3.
The run rows in TestRemovedSourceAndSchemaFlagsAreRejected omit the required
prompt and check only Usage/status 2. Reintroducing a no-op --schema-dir flag
still passed the full suite because the command was invalid for another reason.
Use otherwise-valid invocations and distinguish the removed-flag rejection
with native typed evidence or a minimal flag-specific fragment. Keep the
selected hard-cutover protection rather than deleting the test.
Original entry: Testing §5.
13. HTTP Error-Mapping Tests Pin Noncontractual Prose
Classification: Incidental test coupling; P3.
Full-message equality caused five failures for a harmless generation-error rewording while status, code, shape, and privacy were unchanged. Replace exact noncontractual sentences with status/code/precedence, usable nonempty-message, and private-cause exclusion assertions. Retain any wording actually promised by a contract. This is the prose part of the original combined finding; its numeric-representation part is consolidated into entry 2.
Original entry: Testing §7: error-prose assertions.
14. HTTP Handler Responsibilities Are Hard To Review Independently
Classification: Optional maintainability improvement; originally medium.
ServeHTTP mixes routing, strict decoding, validation, request mapping,
observation, execution, error selection, and response projection. Extract a
few cohesive private decoding/mapping/projection helpers while retaining one
clear request lifecycle and existing behavioral tests. Preserve transport and
presence semantics; fix entry 2 explicitly rather than preserving its bug.
No middleware framework or interface-per-phase is warranted.
Original entry: Complexity §1.
15. CLI Diagnostic Adaptation Is Duplicated And Failure Selection Is Nested
Classification: Optional maintainability improvement; originally medium.
runPrompt and serveWithListener repeat ConfigKit result/error evidence
selection, native adaptation, and queuing. frameworkFailure has related
adaptation with a distinct heading/composition, and requestFailure nests
ordered classifications. Give the repeated bridge one small CLI-local helper
and flatten selection if helpful, preserving typed evidence, causes,
bootstrap delivery, and timeout/configuration precedence.
The equivalence audit confirms the bridge's shared behavioral requirement; it does not establish equivalence of every failure path. Keep native inspection presentation with ckconfig/ckprompt to avoid duplicate diagnostics. No shared CLI/HTTP classifier, cache, or reconstructed configuration model is needed. This cleanup does not itself resolve entry 8.
Original entries: Complexity §2, Equivalence §1.
16. HTTP Terminal-Report Ownership Spans Two Packages
Classification: Optional package-boundary refinement; low priority, not an import violation or dead-code finding.
internal/report owns HTTP-shaped JSON projection/collection while its sole
production consumer is the HTTP adapter. Co-locate it and its focused tests
with that consumer, or retain the isolated package while clarifying its
HTTP-specific purpose. Either choice can be reasonable; preserve wire shapes,
terminal-only observation, detached snapshots, and request isolation. Keep CLI
native reports distinct and avoid a speculative shared reporting framework.
Original entries: Complexity §3, Boundaries §1.
17. Optional Model Mapping Has Redundant Nil Handling
Classification: Optional local cleanup; low priority, not a runtime defect.
The HTTP converter handles nil input, but its only caller first excludes nil, making the helper's nil branch unreachable. Prefer calling the nil-aware converter unconditionally rather than imposing a new non-nil precondition. Preserve omitted/null versus explicit empty-object behavior and field presence; verify these distinctions when changing the mapping. No functionality needs to be removed.
Original entry: Dead code §1.
Source Coverage And Consolidation Check
| Audit | Coverage in this catalog |
|---|---|
| 01 Correctness | Findings 1–3 map to catalog entries 2, 3, and 1. |
| 02 Efficiency | No new finding; existing correctness findings are carried forward, not duplicated. |
| 03 Complexity | Findings 1–3 map to entries 14–16. |
| 04 Concurrency | Findings 1–2 map to entries 1 and 7. |
| 05 Resources | New findings 1–2 map to entries 5–6; repeated cleanup findings map to 1 and 7. |
| 06 Error handling | New finding 1 maps to entry 8; repeated failure findings map to 1 and 7. |
| 08 Testing | Finding 1 is folded into 1–3; 2→9; 3→10; 4 is split into 4 and 11; 5→12; 6→7; 7 is split between 2 and 13. |
| 10 Equivalence | Finding 1 corroborates the diagnostic-bridge portion of entry 15. |
| 11 Boundaries | Finding 1 corroborates entry 16. |
| 12 Dead code | Finding 1 maps to entry 17. |
Investigated non-findings remain non-findings. In particular, no algorithmic
rewrite, extra layer, coverage quota, broad compatibility removal, general
secret filter, forced handler drain, or new resource cap is selected here.
The deadcode-reported NewHandler constructor has a concrete test-support
purpose and is not a deletion task. Optional navigation cleanups mentioned
under rejected/non-action sections are not promoted into standalone findings.
Validation
Read all reports, checked finding-to-entry coverage and duplicate groupings, verified relative links and section anchors, and checked whitespace. The working baseline contains no intervening application/tool changes. Earlier test/diagnostic results remain evidence in their original reports; tests and experiments were not rerun for this documentation-only consolidation. No source report, production code, test, dependency, or policy was changed.