Files
narratio/docs/roadmap/remediation.md

162 lines
8.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Shared pipeline cutover review findings
Reviewed Narratio commit `2ec43305da6c47709909d5cee167c7be0358b311`
against all 23 stages in [implementation.md](implementation.md) and the target
in [pipeline.md](pipeline.md). The catalog migration and controlled consumer
boundaries were included. This document records required remediations; it does
not implement them or change the agreed operator contract.
## 1. Preserve available producer files after failed extraction
**Priority:** P2
**Status:** Pending
**Stages:** 11–12; failure-evidence and workspace requirements in 16 and 21–23.
**Evidence:** [extract.go](../../internal/stage/extract.go),
`extractStage.Run`, lines 154–164. Its deferred cleanup removes the entire
`notarius-output` root whenever `accepted` remains false. That includes a
subprocess failure, malformed completion, required-file failure, or failed
promotion after Notarius has already written files.
The roadmap's Notarius completion section explicitly accounts for report/capture
failure after artifact publication and requires retaining available files and
diagnostics without recovering success from them. The current cleanup discards
those producer files before an operator can inspect them. Separate stdout/stderr
logs and debug captures can survive, but they do not replace the discarded lane
payloads and optional domain evidence. This is a target-state gap, not a request
to treat partial results as successful extraction.
**Reproduction:** a temporary Go-overlay test used the existing
`nativeExtractFixture`, returned an adapter error representing failed completion
delivery, and checked an existing producer lane after `extractStage.Run` failed.
The lane was gone (`no such file or directory`). The test added no repository
file and made no model call.
**Required change:** retain the producing attempt's Notarius output tree on
failure, under its existing run-local destination. Keep the failure result and
existing canonical-promotion checks. Continue removing Narratio-owned temporary
product copies where appropriate. Failed producer output remains attempt
evidence subject to the ordinary run lifecycle; it gains neither automatic
success/reuse authority nor a new permanent-retention guarantee.
**Verification:** add a durable regression at the extraction stage boundary for
producer files present when report delivery fails, and for successful subprocess
completion followed by missing/invalid required lanes. Confirm files remain
inspectable, the stage fails, and no incidental output becomes available as a
successful extraction. Preserve prior canonical files where failure occurs
before promotion, as the existing staging test already requires.
## 2. Limit cleanup's managed-view validation to the views it owns
**Priority:** P2
**Status:** Pending
**Stages:** 15 and 20; requirement-strengthening review in 21–23.
**Evidence:** [attempt_views.go](../../internal/fileops/attempt_views.go),
`ManagedAttemptTargets`, especially lines 179–188;
[cleanup_retained_bundle.go](../../internal/stage/cleanup_retained_bundle.go),
lines 36–39. Cleanup enumerates every entry in the session's `logs/` and
`debug/` roots and passes each to `existingManagedView`. A regular file or
ordinary directory causes an error even when unrelated to a stage view or to
the run being cleaned.
For example, an operator's `logs/README.txt` blocks both cleanup execution and
cleanup resume checks with a managed-view conflict. Finder metadata or other
unrelated entries can have the same effect. This introduces an undocumented
requirement that those directory roots contain exclusively valid managed
symlinks. The selected contract requires protecting Narratio's latest-attempt
targets and rejecting conflicts at a view being installed; it does not require
rejecting unrelated operator content across the entire directory.
**Reproduction:** a temporary Go-overlay test created a valid extraction result
and managed attempt views, added `logs/README.txt`, and evaluated
`cleanRunWithRetainedBundle(..., false)`. It failed with
`managed logs view "README.txt" conflicts with existing content`, before any
deletion. The test changed no repository files.
**Required change:** identify and validate Narratio-managed views narrowly when
computing protected run targets. Leave unrelated entries untouched and do not
make them prerequisites for cleanup. Preserve confinement, avoid following
arbitrary links, and retain conflict rejection when an actual managed stage view
is created or replaced. Do not fix this by documenting or enforcing a new
exclusive-directory prohibition.
**Verification:** cover unrelated regular files/directories in both roots,
correct protection of valid latest links, and unchanged rejection of unsafe or
conflicting owned views. Exercise cleanup and its resume check; unrelated files
must remain untouched and eligible run cleanup must still complete.
## 3. Replace obsolete commands in runtime recovery guidance
**Priority:** P2
**Status:** Pending
**Stages:** 9, 12, 16, and the integration/documentation reconciliation in 21–23.
**Evidence:** [extract_references.go](../../internal/stage/extract_references.go),
line 278; [analyze_input_identity.go](../../internal/stage/analyze_input_identity.go),
lines 131, 137, 187, and 193; the built-in source recovery helpers in
[analyze.go](../../internal/stage/analyze.go) and
[render.go](../../internal/stage/render.go).
Missing or invalid prepared inputs, extraction outputs, and transcript inputs
still produce commands of the form `narratio run-stage prepare SESSION --force`.
The native CLI has no `run-stage` route. Running that recommended command exits
with status 2; running it without the flag confirms the unknown-command error.
The current CLI reference correctly documents `run SESSION --stage STAGE`.
This guidance predates the sprint, but remains active in the newly integrated
prepared-reference, analysis, and render workflows. Several existing tests assert
the obsolete command substring, so the green suite perpetuates the mismatch.
This is an inherited operator-recovery gap, not a regression introduced by the
Notarius protocol migration.
**Required change:** use `narratio run SESSION --stage STAGE --force` in active
recovery messages and reconcile the corresponding tests. Preserve useful source
and stage context. Historical release notes and migration tables may correctly
name retired commands and should not be rewritten. No compatibility alias is
needed.
**Verification:** exercise missing/corrupt prepared references, required analysis
inputs, and render inputs, and check that the suggested command has a supported
native route and flags. Test semantic recovery guidance rather than snapshotting
whole diagnostic strings. No generation or paid provider is needed to establish
CLI syntax compatibility.
## Review coverage and verification
| Implementation stages | Inspected boundaries |
| --- | --- |
| 1–3 | Offline schema compilation/resources, new-state rejection before execution/restore, and canonical workspace paths. |
| 4–6 | Shared roster profile and forwarding, campaign/session resolution and presence semantics, native inspection, initialization and template selection. |
| 7 | Catalog source migration, local validator/CI, schema provenance, and independent validation. |
| 8–10 | Standalone inputs and autocorrection, four individual and combined envelopes, reference snapshots, output naming/collisions and native controls. |
| 11–14 | Native completion/required products, fallback/reuse evidence, Audita inputs/destinations, and shared pipeline-aware readiness. |
| 15–17 | Managed views, producer log/debug/product routing, and single-copy audio acquisition. |
| 18–20 | Publication declarations, canonical restore/previous inputs and diagnostics, role-aware cleanup/retention. |
| 21–23 | Reuse and bounded workflows, maintained examples, controlled real consumers, canonical documentation, and attribution. |
Passing checks during review used Go 1.27.4:
- Narratio: `go test ./...`, `go test -race ./...`, `go vet ./...`, and
`go build ./...`; CGO-disabled CLI cross-builds for Linux amd64/arm64 and
darwin arm64. The macOS result establishes compilation, not native execution.
- Catalog: `go test ./...` and `go run ./cmd/validate`.
- The catalog compatibility script against the pinned Audita v4.3.0 and
Notarius v0.10.0 source builds with local HTTP provider fixtures. All ten
Notarius lanes passed; initial, cached, and forced runs used 9, 0, and 9
provider calls respectively. No paid provider was used.
- All six vendored schema/semantic files matched the released schema checkout
byte for byte. Consumer binary VCS revisions matched the roadmap baselines.
The two temporary regression probes reproduced findings 1 and 2 despite the
green existing suites. Finding 3 was confirmed against the built native CLI
and its existing diagnostic assertions. These expose coverage gaps, not flaky
default tests. No further required remediation was identified in the reviewed
scope.