From 9b2d0297b7803dfde8025cb664613e41bf1a7e9d Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Mon, 6 Jul 2026 17:24:15 +0000 Subject: [PATCH] Clean up DnD shared prompt asset tests --- internal/cli/run_test.go | 10 +++++ .../dnd/spells/scriptorium_assets_test.go | 45 ------------------- 2 files changed, 10 insertions(+), 45 deletions(-) diff --git a/internal/cli/run_test.go b/internal/cli/run_test.go index 8a76b1a..b498065 100644 --- a/internal/cli/run_test.go +++ b/internal/cli/run_test.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "errors" + "io/fs" "os" "path/filepath" "reflect" @@ -208,6 +209,15 @@ func TestProductionPromptAssetsRegisterAndPrepareDndPrompts(t *testing.T) { t.Fatalf("PromptFS().Open(%q) error = %v, want nil", name, err) } } + for _, name := range []string{ + "common-dnd-system.md", + "common-dnd-transcript.md", + "common-dnd-references.md", + } { + if _, err := promptFS.Open(name); !errors.Is(err, fs.ErrNotExist) { + t.Fatalf("PromptFS().Open(%q) error = %v, want not exist", name, err) + } + } options, err := registry.ScriptoriumOptions() if err != nil { diff --git a/internal/modules/extract/dnd/spells/scriptorium_assets_test.go b/internal/modules/extract/dnd/spells/scriptorium_assets_test.go index d64935a..cfe251d 100644 --- a/internal/modules/extract/dnd/spells/scriptorium_assets_test.go +++ b/internal/modules/extract/dnd/spells/scriptorium_assets_test.go @@ -7,9 +7,7 @@ import ( "testing" "time" - "gitea.maximumdirect.net/eric/notarius/internal/framework/contracts" "gitea.maximumdirect.net/eric/notarius/internal/framework/llm" - "gitea.maximumdirect.net/eric/notarius/internal/modules/sharedassets/dnd" "gitea.maximumdirect.net/eric/scriptorium" ) @@ -52,49 +50,6 @@ func TestScriptoriumPromptPreparesWithMissingOptionalReferences(t *testing.T) { } } -func TestReferencePromptInputRenderingIsDeterministic(t *testing.T) { - slot := contracts.ResolvedReferenceSlot{ - Items: []contracts.ReferenceItem{ - { - SlotName: "roster", - MediaType: "text/plain", - Content: []byte("second"), - Digest: "sha256:bbb", - Origin: contracts.ReferenceOrigin{Type: "file", URI: "file:///b.txt"}, - SizeBytes: 6, - }, - { - SlotName: "roster", - MediaType: "text/plain", - Content: []byte("first"), - Digest: "sha256:aaa", - Origin: contracts.ReferenceOrigin{Type: "file", URI: "file:///a.txt"}, - SizeBytes: 5, - }, - }, - } - first := string(dnd.ReferencePromptInput(slot)) - second := string(dnd.ReferencePromptInput(slot)) - if first != second { - t.Fatalf("reference rendering was not deterministic:\nfirst=%q\nsecond=%q", first, second) - } - if !strings.Contains(first, "Reference 1\nOrigin-Type: file\nOrigin-URI: file:///a.txt\nDigest: sha256:aaa") { - t.Fatalf("first reference heading was not stable: %q", first) - } - if strings.Index(first, "first") > strings.Index(first, "second") { - t.Fatalf("references were not sorted deterministically: %q", first) - } -} - -func TestSingleReferencePromptInputKeepsContentOnly(t *testing.T) { - got := string(dnd.ReferencePromptInput(contracts.ResolvedReferenceSlot{ - Items: []contracts.ReferenceItem{{Content: []byte("single reference")}}, - })) - if got != "single reference" { - t.Fatalf("single reference rendering = %q, want raw content only", got) - } -} - func TestScriptoriumPromptDiagnosticsOmitRawMaterials(t *testing.T) { transcript := []byte(`{"secret":"source text"}`) reference := "private party note"