Files
notarius/docs/roadmap/audit/catalog.md

33 KiB

Consolidated Audit Findings

Purpose And Baseline

This catalog consolidates every finding in the ten audit reports in this directory, reviewed on 2026-11-24 at 6e98a4e36eb17ce27b682bd7a0ad4b4fa8fdee37. Their production-code baseline is 3887d89b763b7040efc866d4a57eb910d8778730; subsequent commits added the reports and corrected distribution-policy documentation. The original reports remain the owners of detailed evidence, counterexamples, qualifications, and validation results. This document adds prioritization and cross-report consolidation, not another code audit or an implementation plan.

The 45 original finding entries reduce to 33 outstanding catalog entries and one resolved documentation entry. Repeated responsibility findings are merged. Regression gaps are attached to the defects they protect rather than counted as additional runtime bugs. In particular, TEST-001, TEST-002, and TEST-004 each cover several distinct defects; TEST-003's native-fixture oracle and application-boundary assertions are included together in CAT-007.

The inventory below includes every audit report present. No reports numbered 07 or 09 exist in this directory; this catalog makes no claim about omitted audit topics.

Architecture Assessment

The reports consistently describe a coherent typed pipeline:

input -> chunk -> ordered steps [per-chunk extract -> merge -> normalize] -> output

The CLI composes native kits, registrars, physical state, publication, and reporting. The framework owns typed preparation, complete candidate assessment, native producer coordination, a bounded ready-job pool, generated handoffs, and accepted-result reuse. Artifact families own interpretation, identity, transformations, validation, codecs, and prompts. Assets remain content-only. ConfigKit, PromptKit, CommandKit, and ReleaseKit retain their selected native responsibilities. See the architecture policy and internal overview for canonical boundaries.

The audits found no checked import-direction violation, confirmed data race, deadlock, or ordinary resource-handle leak. They did find numerical edge defects, failure-path diagnostic loss, avoidable transcript-scale work and retention, and repeated application-level responsibilities. Passing tests and those bounded conclusions do not prove every composition correct. No replacement workflow, configuration, retry, or resource-management framework is indicated.

Priority And Status

Entries below are ordered by recommended attention: accepted-input correctness and high-impact ordinary-run efficiency first; failure visibility and narrow boundary defects next; high-leverage consolidation before smaller cleanup. Ordering considers reachability and practical impact, not just ease of fixing. Original P2/P3 ratings and relative refactoring priorities are retained for context; they are not one universal severity scale. No audit establishes a P1 incident or a measured end-to-end production speedup.

All CAT-001 through CAT-033 remain outstanding at the reviewed revision. "Refactoring" denotes a maintenance opportunity, not a confirmed runtime failure. CAT-024 explicitly requires revisiting an existing evidence-convenience choice. CAT-034 is resolved and excluded from outstanding counts. Related entries may share files without representing the same underlying issue; they should be coordinated rather than silently treated as duplicates.

Prioritized Findings

CAT-001 — Overflow In An Accepted Generic Chunk Size

Assessment: Reproduced correctness defect; original P2.

Sources: Correctness / Finding 1, TEST-001.

A valid small document with max_units = math.MaxInt passes option decoding but panics in ceiling-division preallocation. Use overflow-safe arithmetic or omit the optional preallocation; inspect endpoint addition at the same boundary. Add small supported-option regressions for the extreme value and normal overlap. Preserve the accepted option domain rather than adding an arbitrary maximum.

CAT-002 — Tiny Negative Timestamps Pass Input Validation

Assessment: Reproduced input-contract defect; original P2, extreme-value case.

Sources: Correctness / Finding 2, TEST-001.

A timestamp such as -1e-1000 underflows to floating-point negative zero and bypasses the sign check; the subsequently parsed exact rational is negative. Check its exact sign while retaining current finiteness and precision handling. Cover tiny negative/positive values, zero/negative zero, and precise ordering. No new timestamp-magnitude restriction is needed.

CAT-003 — Disabled Capture Still Builds Expensive Evidence

Assessment: Source-established resource-efficiency weakness; original P2.

Source: RES-001.

Ordinary runs construct text/base64, chunk, artifact, and output envelopes before the disabled writer returns. Some continuations construct all-chunk payloads concurrently. Guard expensive debug-only construction at its owning boundary, including deferred chunk outcomes. Keep required artifact encoding outside those guards and preserve enabled-capture content and failure behavior. This addresses unnecessary transient allocation, not a proven permanent leak.

CAT-004 — Sparse Citation Resolution Scans The Whole Transcript Per Record

Assessment: Source-established algorithmic opportunity; original P2.

Source: EFF-002.

CitationResolver.CitedText allocates document-sized buffers and scans every unit even for empty or single-unit citations. Resolve, sort, and coalesce ranges, then visit only the selected units. Preserve errors, source order, single inclusion of overlapping evidence, and newline joining. Protect empty/invalid, overlapping, disjoint, sparse, and non-monotonic-ID cases. The improvement removes the document dimension from each sparse lookup; it is not a measured overall runtime claim.

CAT-005 — Every Extraction Job Rebuilds The Whole-Source Index

Assessment: Source-established algorithmic opportunity; original P2.

Source: EFF-001.

Ten D&D extractors build the same document-position map per applicable chunk invocation, even before accepted-result lookup. Share one immutable run/source index, retaining local construction for standalone callers. This reduces the indexing component from Theta(J * D) to O(D + J) for J jobs and D units. Preserve whole-document resolution, current-source cache checks, and isolation between sources/runs; a chunk-only or process-global index is not equivalent.

CAT-006 — Completed Intermediate Values Remain Reachable Too Long

Assessment: Source-established resource-lifetime weakness; original P2.

Source: RES-002.

Lane reorder maps and extraction values survive completed continuation while slow siblings run. Returned RunOutput also retains private normalized bytes, reuse state, and diagnostic accumulators after public results are assembled. Drop owner references after their final consumers, on success and failure. Do not mutate shared backing storage or retire values before handoff, evidence, and output encoding finish. Coordinate diagnostic lifetime changes with CAT-008 and CAT-009 so cleanup does not erase completed-work information.

CAT-007 — Native Failed-Validation Handling Loses Meaning And Its Tests Miss It

Assessment: Static classification/detail defect with duplicated handling; original ERR-001 P3, TEST-003 P2, EQ-005 low refactoring priority.

Sources: ERR-001, EQ-005, TEST-003.

The producer and combat semantic validator correctly refuse unusable content, but discard native validation details and manufacture promptkit.ErrValidation, conflating a completed failed content check with an operational validation error. Give the small usability check one framework owner; distinguish missing results, failed checks, and actual native Go errors. Preserve producer disposition and validator unavailability as separate caller outcomes.

Correct the validator test that pins the wrong sentinel and cover retained details at both boundaries. Also tighten the separate reconciliation fixture that currently accepts any error after one provider call: require its intended nil-error/failed-result outcome. These are related test obligations, not proof that changing the runtime helper alone fixes the suite's oracle. Do not add semantic retries or enlarge native repair budgets.

CAT-008 — Completed Chunk Diagnostics Disappear On Later Lane Failure

Assessment: Static composed failure-path defect; original P3.

Sources: ERR-002, TEST-004.

Successful chunk diagnostics reach output only through completed continuation. A later failure can therefore erase earlier genuine warnings, even with one worker. After draining started work, gather completed diagnostics independently of artifact eligibility in canonical lane/chunk order, without double counting. Handle sparse result indices explicitly. Add same-lane failure and controlled out-of-order coverage; incomplete lanes must still produce no artifacts/handoffs.

CAT-009 — Failure Finalization Hides Diagnostic Aggregation Errors

Assessment: Static composed failure-path defect; original P3.

Sources: ERR-003, TEST-004.

Individually valid groups can exceed aggregate bounds, but failOutput ignores finalization errors and loses the available prefix. The nominal success path can repeat the failed aggregation. Retain the primary and aggregation causes, expose bounded available diagnostics as incomplete failure information, and avoid the duplicate pass. Test the combined failure, preserving existing warning bounds and failure semantics rather than silently truncating warnings into success.

CAT-010 — Process Signals Do Not Reach Cooperative Cancellation

Assessment: Static executable integration weakness; original P3.

Source: CONC-001.

The executable supplies context.Background; supported process signals terminate it without entering existing cancellation/drain/capture-finalization paths. Connect signals at the executable boundary with idiomatic context handling and deliberately choose repeated-signal behavior. Preserve caller-owned contexts for embedded use. A local fake-backend subprocess regression can protect the path; there was no signal-injection reproduction in the audit. Cooperative cleanup does not imply SIGKILL handling or a new shutdown deadline guarantee.

CAT-011 — Extreme Accepted Context Radius Can Empty Evidence

Assessment: Reproduced latent internal-API defect; original P3.

Sources: Correctness / Finding 3, TEST-001.

semanticreconcile.Prepare accepts a maximum integer radius but overflows while expanding an interval, returning ready material with empty windows. Current production normalizers use radius 2, so deployed defaults do not reach this case. Clamp by remaining source distance before adding; retain non-negative radii and the existing material byte budget. Test extreme/normal radii on tiny sources.

CAT-012 — Delimiter-Based Generated-Producer Keys Can Collide

Assessment: Static correctness counterexample, not executed; original P3.

Sources: BUG-001, TEST-002.

Resolver keys made from step + NUL + lane alias distinct accepted identifier pairs containing NUL. Validation can then check a generated reference against the wrong producer's kind. Reuse the struct-key representation already used by runtime handoff. Test colliding string encodings with different producer kinds; do not introduce an identifier-character prohibition. No wrong runtime handoff was demonstrated.

CAT-013 — Metadata Cycle Detection Rejects An Acyclic Slice View

Assessment: Static correctness counterexample, not executed; original P3.

Sources: BUG-002, TEST-002.

Tracking slice recursion by type/backing pointer confuses a shorter shared-prefix view with the active outer slice. Include the traversed visible view in tracking, handling empty views appropriately. Retain real cycle rejection, detached concrete containers, and useful paths. Cover finite prefix sharing and true cycles. This affects programmatic metadata, not ordinary decoded JSON; banning shared backing arrays or replacing copying with a JSON round trip would change the contract.

CAT-014 — Pipeline Composition Has Three Independent Interpreters

Assessment: High-leverage ownership/refactoring opportunity; original high.

Sources: CPLX-003, EQ-004, BND-001.

Configuration validation, runtime resolution, and CLI reference expansion repeat step/lane layout and selected-module/default/variant interpretation. Give pure layout and catalog-aware selected-target inventory a pipeline owner. Keep raw ConfigKit presence/provenance checks, CLI grammar/precedence, and full compatibility checks at their distinct boundaries. Inventory must work before CLI bindings satisfy required references; calling full resolution early is not a substitute. Retain independent expected selections in config, resolver, and CLI tests.

CAT-015 — Producer Lifecycle Depends On Coupled Closure State

Assessment: High-leverage local maintainability opportunity; original high.

Source: CPLX-001.

Preparation, cache lookup, capture, candidate interpretation/assessment, native continuation, and disposition share mutable closure state in RunProducer. Use small private phase/state results to make candidate invalidation and exits explicit. Preserve native execution/history ownership, final-turn assessment, cache hits, cancellation precedence, capture errors, and strict/permissive outcomes. Coordinate CAT-007's usability fix, but do not conflate that small defect with the wider readability refactor or create a new retry engine.

CAT-016 — Three Registry Normalizers Repeat Reconciliation Lifecycle Glue

Assessment: Shared lifecycle/refactoring opportunity; original high/medium.

Sources: CPLX-004, EQ-001, BND-005.

NPC, item, and location normalizers duplicate fixed-original preparation, proposal/evidence bookkeeping, correction, and fallback glue around the shared core and producer. Share only that demonstrated typed lifecycle, returning current proposal/omission information explicitly. Keep domain identity, currency guards, same-name location distinctions, prompts, and diagnostics with families. The core must not import concrete families; D&D-local adaptation can translate neutral results. Preserve fresh application of each proposal and independent family tests.

CAT-017 — Pipeline Value Copying Has Multiple Owners And Mixed Semantics

Assessment: Ownership/refactoring opportunity; original medium.

Sources: CPLX-007, EQ-003, BND-002.

Configuration and framework code separately clone pipeline-owned trees, while one clone also trims names and option switches support different containers. Provide pure copying at the type owner and make normalization explicit. Inventory supported representations before unifying behavior; retain omission/empty/zero distinctions and mutation-isolation tests at both boundaries. Do not build an arbitrary reflection copier or merge this with source-metadata validation.

CAT-018 — Pipeline Resolution Mixes Unrelated Responsibilities

Assessment: Local decomposition opportunity; original medium.

Source: CPLX-002.

Profile types, wire handling, reference normalization/precedence, generated dependencies, validator selection, copying, and digesting share a large file and nested routines. Extract cohesive same-package helpers/files and per-binding checks, not merely shorter files. Coordinate CAT-014/CAT-017 to avoid neater duplicate implementations. Preserve typed compatibility, capabilities, configured order, generated restrictions, and useful error context; no new package split or stage interpreter is established by this finding.

CAT-019 — Sorting Recomputes Invariant Evidence Keys

Assessment: Local algorithmic opportunity; original P3.

Source: EFF-003.

Occurrence/enemy comparators repeatedly scan evidence for earliest position; enemy tie-breakers also recanonicalize already-canonical evidence. Prepare stable scalar/evidence keys once per owned normalized record, following the combat normalizer's existing pattern. Preserve exact tie/invalid-reference order and general defensive comparators for unproven inputs. The earliest-key component can lose a repeated reference-scan factor; genuine citation tie comparison may still be linear. Protect literal domain outputs, not comparator call counts.

CAT-020 — Reusable Scene Rules Are Owned By A Selectable Validator Adapter

Assessment: Family cohesion/refactoring opportunity; original medium.

Source: BND-003.

Scene normalization imports shape validation that also builds unused corrective prose; sibling validators and the codec need some of the same pure predicates. Move genuinely reusable scene checks to a small family-domain owner, leaving adapter registration, extraction-only cardinality, assessment, and guidance in the validator. Share only identical codec primitives: codec acceptance currently differs from strict selectable validation. Do not make optional checks mandatory or move every family's checks without a demonstrated cross-stage need.

CAT-021 — Exact-Duplicate Group Bookkeeping Is Reimplemented

Assessment: Pure shared-helper opportunity; original medium.

Source: EQ-002.

NPC/location occurrences and combat turns repeat keep masks, first representatives, group lookup, removed original indices, and retained traversal. Share that pure bookkeeping with family-supplied eligibility/keys; include spells only if its nil/allocation behavior stays local. Item occurrences' bucket-plus-exact-equality guard must remain intact, even if that variant stays separate. Preserve family ordering, identity, cloning, and independent expected-output tests; this is not one universal normalizer or permission to combine evidence ranges.

CAT-022 — Runner Stage Flow Is Obscured By Evidence And Output Assembly

Assessment: Local maintainability opportunity; original medium.

Source: CPLX-005.

Runner.Run alternates stage control with large evidence and auxiliary-output construction. Extract cohesive private source, chunk/map, and output phases so the coordinator exposes order and failure boundaries. Keep physical publication in the CLI and preserve cancellation, fallback eligibility, diagnostics, ownership, and required-capture errors. Coordinate CAT-003/CAT-006/CAT-009, but their defects remain independently verifiable; avoid a generic string-named stage dispatcher.

CAT-023 — CLI Declaration And Invocation Lifecycle Are Entangled

Assessment: Local maintainability opportunity; original medium.

Source: CPLX-006.

The run command embeds loading, selection, preparation, identity/capture, execution, publication, and terminal presentation with captured mutable state. Keep the native declaration small and give invocation/finalization a cohesive private owner. Preserve one configuration/engine, supplied-value semantics, capture-before-preparation, cause retention, and distinct execution/publication/ report-delivery outcomes. This is CLI lifecycle work, separate from CAT-022; do not introduce another command framework or result envelope.

CAT-024 — Enabled Debug Capture Repeats Immutable Full-Source Inputs

Assessment: Capacity/convenience design opportunity; original P3; requires deliberate review of the existing evidence representation.

Source: RES-003.

Each extraction operation serializes the full source again, multiplying debug disk usage by chunk/lane count, even on cache hits. Consider bundle-local reuse of immutable source/references plus per-operation selections. ADR-0024 permits duplication and current tests expect self-contained inputs, so this is not a breached size promise or a preapproved removal. Account for direct EvidenceWriter consumers and keep actual inputs recoverable, native evidence complete, and required-capture failures visible. No silent truncation, quotas, or deletion.

CAT-025 — Extension Concurrency And Capture Obligations Are Implicit

Assessment: Documentation/extension-contract clarity gap; original P3; no current default implementation was found to race.

Source: CONC-002.

Prepared extractors/validators and codecs are reused across concurrent chunk jobs; source is read-only. Explicit capture writers are not serialized merely because each operation's NativeCapture has a mutex. Document actual shared-instance, callback, and operation-lifetime behavior in canonical internals and interface comments, linking upstream-owned client rules. Prefer clarifying existing caller-side writer obligations; serial-only writer support would be a separate choice, not a reason to add locks everywhere or promise universal thread safety.

CAT-026 — Prompt Tests Pin Authored English Instead Of Behavior

Assessment: Test-maintenance weakness; original P3.

Source: TEST-005.

Several asset/module tests require literal prose fragments; composition tests also use production wording as message-location markers. Remove those incidental assertions, use test-controlled supplied-content markers, and consolidate genuinely duplicate checks at the asset owner. Retain native preparation, input/schema/ default selection, required-property compatibility, cache hints, and follow-up binding contracts. Do not replace word checks with hashes/snapshots or remove all string assertions; authored prompt quality still needs review.

CAT-027 — Concurrency Tests Rely On Sleep Or Unbounded Handshakes

Assessment: Static reliability/diagnosability risk; original P3; no failure was observed in the audit's repeated runs.

Source: TEST-007.

A continuation test uses a five-millisecond sleep to induce required overlap; reverse-completion receives can wait until the global test timeout after an early error. Use explicit start/release gates with bounded, cancellation-safe failure handling and join started work. Keep meaningful worker-limit/order assertions. Test watchdogs do not imply a new runtime timeout guarantee or need for a general deadline framework.

CAT-028 — Maintained-Example Tests Mix Independent Contracts

Assessment: Test readability/refactoring opportunity; original low.

Source: CPLX-008.

One nested test combines loading, transcript handling, composition, generated references, inheritance, and listing. Its mutable parent map introduces fixture order dependence. Build explicit resolved fixtures and separate focused checks, obtaining the parent directly for comparison. Retain useful integration coverage and local expectations; do not replace it with an assertion DSL or new snapshots.

CAT-029 — Run-ID Test Freezes A Private Representation

Assessment: Incidental test restriction; original P3, small cleanup.

Source: TEST-006.

Remove the exact timestamp/hex-width run-ID regex while retaining uniqueness, path safety, allocation/collision, and partial-write protection. The separately versioned session-ID vector protects an expressly selected cross-run routing contract and should remain. This is not a blanket reason to remove exact-value assertions.

CAT-030 — Disconnected Policy Labels Suggest Nonexistent Behavior

Assessment: Confirmed private dead metadata; original medium for clarity, not runtime impact.

Source: DEAD-002.

Remove the 48 confirmed unused private constants: 44 deterministic-validator policy labels, three registry-identity correctionPolicy labels, and the scene normalizerPolicy. They do not affect validation or cache identity. Retain live domain identity constants, keys, reason codes, schemas, and guidance. In particular, identity policy bytes affect durable IDs. Do not resurrect cache fingerprints to justify unused labels.

The same finding identifies six exported NormalizationPolicy aliases for separate consumer-contract review. Their absence of repository callers is not enough to approve deletion. That conditional scope is not part of the confirmed 48-constant cleanup, and needs no absence/count change-detector test.

CAT-031 — Three Private Helpers Are Unused

Assessment: Confirmed dead declarations; original low; no runtime speedup is implied by deleting code that already does not execute.

Source: DEAD-001.

Delete config's cloneStringMap, pipeline's laneReferencesReuseEligible, and sortValidatorSpecs, cleaning only imports made unused. Keep the live spell helper with the same name, operation-specific reference eligibility, and other registry sorting. Do not wire the obsolete aggregate back into runtime behavior. Existing focused tests suffice; declaration-only deletion needs no new test.

CAT-032 — Reusable Native Capture And Pipeline Scoping Share A Home

Assessment: Low-priority package-cohesion opportunity, not an import violation.

Source: BND-004.

Request-level native evidence lifecycle is reusable by producers and validators, but lives with pipeline-specific operation paths. Consider one small sink-neutral framework owner, or a cohesive extension of debug, leaving scope paths in pipeline and physical lifecycle in CLI/recorder. Proceed only if the resulting API remains direct. Preserve prepared ownership, cause retention, admission behavior, and cache-hit evidence; add no telemetry service or replacement execution interface.

CAT-033 — Token Matching Has Avoidable Worst-Case Repeated Work

Assessment: Low-practical-priority algorithmic opportunity; original P3.

Source: EFF-004.

Restarting a token-sequence match at each source position is quadratic for long repeated-prefix queries, though ordinary short entity names are effectively linear. Consider a small prefix-function/KMP matcher after higher-impact work. Keep exact consecutive-token semantics, Unicode normalization, punctuation, empty-query behavior, and token boundaries; compare with an independent simple reference matcher. No fuzzy search dependency or name-length cap is indicated.

Resolved Finding

CAT-034 — Distribution Architecture Described A Retired Source-Only Workflow

Status: Resolved; original P3; no remaining remediation.

Source: DOC-001.

Commit 65ce8f7fe55b91244c4114ea95fb87494a1449b9 corrected the architecture's distribution summary and linked to the release-policy owner. Current wording describes ReleaseKit source publication and hosted binary/checksum delivery, retaining Linux support, best-effort macOS development, and no Windows support. The source audit records the earlier observation; it should not be reopened as an outstanding defect or treated as approval for additional targets/release gates.

Original-Finding Coverage

Every original finding is mapped below. Multiple source IDs in one catalog entry are corroborating observations or attached test obligations, not extra runtime defects. Conversely, a source test finding can map to several catalog entries because its fixtures omit several independent behaviors. Each catalog entry above links directly to every corresponding original finding.

Audit document Original finding → catalog entry
01-correctness.md Finding 1 → CAT-001; Finding 2 → CAT-002; Finding 3 → CAT-011
02-efficiency.md EFF-001 → CAT-005; EFF-002 → CAT-004; EFF-003 → CAT-019; EFF-004 → CAT-033; DOC-001 → CAT-034 (resolved)
03-complexity.md CPLX-001 → CAT-015; CPLX-002 → CAT-018; CPLX-003 → CAT-014; CPLX-004 → CAT-016; CPLX-005 → CAT-022; CPLX-006 → CAT-023; CPLX-007 → CAT-017; CPLX-008 → CAT-028; BUG-001 → CAT-012; BUG-002 → CAT-013
04-concurrency.md CONC-001 → CAT-010; CONC-002 → CAT-025
05-resources.md RES-001 → CAT-003; RES-002 → CAT-006; RES-003 → CAT-024
06-error-handling.md ERR-001 → CAT-007; ERR-002 → CAT-008; ERR-003 → CAT-009
08-testing.md TEST-001 → CAT-001/CAT-002/CAT-011; TEST-002 → CAT-012/CAT-013; TEST-003 → CAT-007; TEST-004 → CAT-008/CAT-009; TEST-005 → CAT-026; TEST-006 → CAT-029; TEST-007 → CAT-027
10-equivalence.md EQ-001 → CAT-016; EQ-002 → CAT-021; EQ-003 → CAT-017; EQ-004 → CAT-014; EQ-005 → CAT-007
11-boundaries.md BND-001 → CAT-014; BND-002 → CAT-017; BND-003 → CAT-020; BND-004 → CAT-032; BND-005 → CAT-016
12-deadcode.md DEAD-001 → CAT-031; DEAD-002 → CAT-030

Review Limits And Validation

This consolidation read all ten reports and verified the resolved policy change against Git history/current wording. It did not rerun the application suite, perform inference, measure production performance, or independently reproduce every earlier finding. The source reports record their own methods: reproduced numeric defects, static counterexamples, passing offline/race checks, and the testing audit's 89.2% cross-package statement coverage. Those results apply to the audited baseline, not to a new validation run performed for this catalog.

Catalog validation checks original-finding coverage, consecutive catalog IDs, local link/heading targets, and whitespace. No production code, tests, policies, or original audit reports are changed by this consolidation. Proposed cleanup does not add contracts, security restrictions, complexity thresholds, required benchmarks, or new release gates. Any later implementation should retain the original reports' qualifications and focused behavioral protection.