From 4f27331636b44bd75e402c12fc6ab4c16fcb3899 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Fri, 27 Nov 2026 17:14:44 +0000 Subject: [PATCH] Verify shared glossary workflows and recovery --- docs/config.md | 5 +- docs/integrations/audita.md | 3 +- docs/operations.md | 4 +- docs/roadmap/implementation.md | 13 ++++- docs/roadmap/workspace.md | 12 ++--- examples/pipeline.full.annotated.yml | 1 + internal/app/compatibility_test.go | 27 +++++++++- .../app/prepared_session_roundtrip_test.go | 50 +++++++++++++++++++ 8 files changed, 103 insertions(+), 12 deletions(-) diff --git a/docs/config.md b/docs/config.md index 0103d7a..e8f7c7a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -321,6 +321,7 @@ Rules: | `pipeline.audita.binary` | string | No | `audita` | | `pipeline.audita.timeout` | duration | No | `3h` | | `pipeline.audita.credentials[]` | list[secret reference] | No | empty; exact environment-variable names forwarded to Audita | +| `pipeline.audita.debug` | bool | No | `false`; true requests Audita debug capture | | `pipeline.audita.overlay` | string | No | empty; no downstream overlay override | | `pipeline.audita.proposal_profile` | string | No | empty; no downstream proposal-profile override | | `pipeline.audita.validation_profile` | string | No | empty; no downstream validation-profile override | @@ -376,7 +377,9 @@ add no override. Narratio does not create Audita configuration or infer its selectors from a Narratio overlay. Configure the ordered Audita pipeline in Audita itself; the retired `pipeline.audita.modules` field is rejected. See [Audita's configuration guide](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md) -and the [integration contract](integrations/audita.md). +and the [integration contract](integrations/audita.md). `debug: true` requests +Audita debug capture; false or omission adds no debug override. Debug alone does +not invalidate a completed polish result. `pipeline.audita.credentials` contains exact environment-variable references, not values. Narratio resolves each name at pipeline load and forwards its value diff --git a/docs/integrations/audita.md b/docs/integrations/audita.md index ea6b3e7..f1a5f74 100644 --- a/docs/integrations/audita.md +++ b/docs/integrations/audita.md @@ -4,7 +4,8 @@ Narratio invokes Audita v4.2 for polishing. Its adapter supplies the prepared party, campaign, setting, and spells documents as repeated `--glossary-file` arguments, the merged transcript and requested output, and run-local report and work destinations. Optional config, overlay, profile, transcript-description, -and output-schema selectors are forwarded only when set. Audita owns its +and output-schema selectors are forwarded only when set. `audita.debug: true` +forwards `--debug`; false adds no debug override. Audita owns its configuration, ordered pipeline, profiles, and native discovery. Narratio does not generate a downstream configuration. See [Audita configuration](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md) and its [runtime glossary input contract](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/integrations/transcript-glossary-files.md). diff --git a/docs/operations.md b/docs/operations.md index 15d913c..c005a2d 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -316,8 +316,8 @@ Select the Narratio file with `--overlay testing` on the desired command. Each downstream selector is used only when its stage actually executes: `polish` for Audita and `extract` for Notarius. Production can omit both selectors. -Audita's selected configuration controls whether detailed debug capture is -requested. Narratio supplies the run-local `polish/debug` work destination and +Set `audita.debug: true` in Narratio to request Audita debug capture. Omission +or false adds no debug override. Narratio supplies the run-local `polish/debug` work destination and the separate `polish/logs` report destination. Notarius's debug directory does not enable capture; its `--debug` flag is not currently forwarded by Narratio. See the upstream [Audita configuration](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md) diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 3761e50..6835225 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -681,7 +681,18 @@ guarantee that successful preflight ensures later processing succeeds. ## Stage 19. Verify the complete sprint and remove retired machinery -Status: Pending +Status: Complete + +With Go 1.27.4, `go test ./...`, `go test -race ./...`, `go vet ./...`, +and `go build ./...` passed. The controlled catalog/Audita compatibility +checks passed against catalog `ff26b24172ff5efddbcf666c5179268ea1372b01` +and Audita `973b24e46618dc785751fa7c803e7c16c900353f`; the original +pinned schema was compared at catalog revision +`ecad94a5a53f87847b1fd81fd042eee9c8d3ea08`. Reviewed the cutover and +extended the prepared-input round trip through preflight failure and retry, +polish, publication, and restore. Confirmed native empty-list replacement and +instruction retention with the real Audita binary. No live-provider calls, +push, tag, or release were performed. Run focused checks during earlier stages as they become buildable. At this final stage use the maintained Go 1.27.4 toolchain and run: diff --git a/docs/roadmap/workspace.md b/docs/roadmap/workspace.md index d16b4e6..a254c39 100644 --- a/docs/roadmap/workspace.md +++ b/docs/roadmap/workspace.md @@ -66,8 +66,8 @@ physical layout. Relevant differences from the target are: - Prepared previous-session inputs occupy `previous/`. Narratio-owned reference snapshots supplied to Notarius occupy session `cache/notarius/references/`. These snapshots are distinct from Notarius's own execution caches. -- Audita's work destination is run-local; capture enablement remains downstream - configuration. Narratio does not expose Notarius debug capture, and Scriptorium +- Audita's work destination is run-local, and Narratio can request its debug + capture. Narratio does not expose Notarius debug capture, and Scriptorium render-debug placement varies. - Narratio maintains separate S3 audio cache and spool paths in addition to the prepared session audio copy. @@ -197,15 +197,15 @@ Narratio-managed navigation links without relying on arbitrary symlink traversal ### Debug controls and placement -Add selective Narratio configuration for Audita and Notarius debug capture using +Retain Narratio's Audita debug selector and add Notarius debug capture using their supported enabling CLI flags. An enabled Narratio selector requests capture; an omitted or false selector passes no debug override and preserves the application's configured/default behavior. Do not add a downstream disable flag. Supply the actual run-local debug directories, exposed through `debug/polish` -and `debug/extract`. Control the destination when capture can be enabled through -downstream configuration as well, including Audita overlays, using supported -destination controls without changing capture enablement. Audita's debug +and `debug/extract`. Control destinations when a downstream tool can enable +capture through its own configuration, using supported destination controls +without changing capture enablement. Audita's debug work-directory option selects diagnostic storage and belongs to this placement responsibility. diff --git a/examples/pipeline.full.annotated.yml b/examples/pipeline.full.annotated.yml index 68b51d1..6e74a26 100644 --- a/examples/pipeline.full.annotated.yml +++ b/examples/pipeline.full.annotated.yml @@ -97,6 +97,7 @@ audita: timeout: 3h # Names must match credentials on the configured Audita backends. credentials: [AUDITA_LLM_API_KEY] + debug: false # true requests a run-local Audita debug capture # Configure processing order in Audita configuration. overlay: "" proposal_profile: "" diff --git a/internal/app/compatibility_test.go b/internal/app/compatibility_test.go index b248273..e71e3f9 100644 --- a/internal/app/compatibility_test.go +++ b/internal/app/compatibility_test.go @@ -202,7 +202,7 @@ func TestAuditaBinaryCompatibility(t *testing.T) { } dir := t.TempDir() configPath := filepath.Join(dir, "config.yml") - mustWriteTestFile(t, configPath, "version: 3\nllm: {proposal_profile: proposal, validation_profile: review, correction_repair_attempts: 0}\npipeline: {stages: [{module: grammar}]}\nreporting: {enabled: false}\n") + mustWriteTestFile(t, configPath, "version: 3\nllm: {proposal_profile: proposal, validation_profile: review, correction_repair_attempts: 0}\npipeline: {stages: [{module: grammar}]}\nglossary_collections:\n spells: {instruction: Audita default., entries: [{id: stale, name: Stale, category: spell}]}\nreporting: {enabled: false}\n") mustWriteTestFile(t, filepath.Join(dir, "prompts.yml"), fmt.Sprintf("backends:\n - {id: local, endpoint: %q}\nprofiles:\n - {id: proposal, backend: local, model: proposal-model}\n - {id: review, backend: local, model: review-model}\n", server.URL+"/v1")) req, _, err := stage.BuildPolishRequest(paths, m, "", filepath.Join(dir, "out.json"), filepath.Join(dir, "reports"), filepath.Join(dir, "debug")) if err != nil { @@ -250,4 +250,29 @@ func TestAuditaBinaryCompatibility(t *testing.T) { if err == nil || result.ExitCode != 1 || calls.Load() != 2 { t.Fatalf("negative preflight: %+v %v calls=%d", result, err, calls.Load()) } + empty, err := glossary.Resolve(glossary.Sources{}, nil) + if err != nil { + t.Fatal(err) + } + emptyPath := filepath.Join(dir, "empty-spells.yml") + if err := os.WriteFile(emptyPath, empty["spells"], 0600); err != nil { + t.Fatal(err) + } + emptyArgs := append([]string(nil), args...) + for i := range emptyArgs { + if emptyArgs[i] == req.GlossaryFiles[3] { + emptyArgs[i] = emptyPath + } + } + output, err = exec.Command(binary, emptyArgs...).CombinedOutput() + if err != nil { + t.Fatalf("empty inspection: %v: %s", err, output) + } + if err := json.Unmarshal(output, &inspected); err != nil { + t.Fatal(err) + } + spells := inspected.Collections["spells"] + if len(spells.Entries) != 0 || spells.Instruction == nil || *spells.Instruction != "Audita default." { + t.Fatalf("empty prepared spells did not replace configured entries and retain instruction: %+v", spells) + } } diff --git a/internal/app/prepared_session_roundtrip_test.go b/internal/app/prepared_session_roundtrip_test.go index 2fb2840..9d8fc3a 100644 --- a/internal/app/prepared_session_roundtrip_test.go +++ b/internal/app/prepared_session_roundtrip_test.go @@ -2,12 +2,14 @@ package app import ( "context" + "fmt" "os" "path/filepath" "strings" "testing" "time" + "gitea.maximumdirect.net/eric/narratio/internal/adapters/audita" "gitea.maximumdirect.net/eric/narratio/internal/adapters/storage" "gitea.maximumdirect.net/eric/narratio/internal/artifactpolicy" "gitea.maximumdirect.net/eric/narratio/internal/artifacts" @@ -49,6 +51,54 @@ func TestPreparedSessionPublishAndRemoteLoad(t *testing.T) { if _, err := prepare.Run(ctx, env, m); err != nil { t.Fatal(err) } + preparedPaths := store.SessionPathsFor(m.Campaign, m.SessionID) + for _, descriptor := range artifactpolicy.GlossaryInputSources() { + if _, err := artifacts.ResolvePreparedInput(preparedPaths, m, descriptor.SourceID); err != nil { + t.Fatalf("downstream input %s: %v", descriptor.SourceID, err) + } + } + marker := filepath.Join(t.TempDir(), "fail-preflight") + mustWriteTestFile(t, marker, "fail") + wrapper := filepath.Join(t.TempDir(), "audita-wrapper.sh") + mustWriteTestFile(t, wrapper, fmt.Sprintf("#!/bin/sh\nif [ \"$1\" = preflight ] && [ -f %q ]; then exit 1; fi\nexec %q \"$@\"\n", marker, writeAuditaAppTestWrapper(t))) + if err := os.Chmod(wrapper, 0755); err != nil { + t.Fatal(err) + } + runner, err := audita.NewSubprocessRunner(audita.SubprocessRunnerConfig{Binary: wrapper, Timeout: time.Minute}) + if err != nil { + t.Fatal(err) + } + req, _, err := stage.BuildPolishRequest(preparedPaths, m, "", filepath.Join(runRoot, "polish", "outputs", "transcripts", "polished.json"), filepath.Join(runRoot, "polish", "logs"), filepath.Join(runRoot, "polish", "debug")) + if err != nil { + t.Fatal(err) + } + if result, err := runner.Preflight(ctx, req); err == nil || result.ExitCode != 1 { + t.Fatalf("expected preflight failure: %+v %v", result, err) + } + if _, ok := m.Stages["polish"]; ok { + t.Fatal("failed preflight recorded polish completion") + } + if err := os.Remove(marker); err != nil { + t.Fatal(err) + } + if result, err := runner.Preflight(ctx, req); err != nil || result.ExitCode != 0 { + t.Fatalf("preflight retry: %+v %v", result, err) + } + base := filepath.Join(preparedPaths.TranscriptsDir, "base.json") + mustWriteTestFile(t, base, `{"segments":[]}`) + setCurrentBuiltInEvidence(t, m, "merge", artifacts.TranscriptOutputKindBase, artifacts.ArtifactTranscriptBase, base) + env.Audita = runner + polish, err := stage.Select("polish") + if err != nil { + t.Fatal(err) + } + polished, err := polish.Run(ctx, env, m) + if err != nil { + t.Fatal(err) + } + if len(polished.Outputs) != 1 || polished.Metadata["glossary_evidence"] == nil { + t.Fatalf("polish result: %+v", polished) + } for _, name := range []string{"prepare", "transcribe", "merge", "polish", "normalize", "trim", "render", "analyze"} { m.MarkStageSucceeded(name, time.Now().UTC(), nil) }