Verify inherited configuration inspection commands
This commit is contained in:
@@ -315,7 +315,7 @@ reserved-key compatibility impact remains an explicit release-preparation item.
|
|||||||
Complete when canonical documentation and a tested copyable example describe
|
Complete when canonical documentation and a tested copyable example describe
|
||||||
the implemented adoption, without promoting new restrictions to policy.
|
the implemented adoption, without promoting new restrictions to policy.
|
||||||
|
|
||||||
## Stage 7: Verify the assembled inspection workflow and close the feature
|
## Stage 7: Verify the assembled inspection workflow and close the feature [x]
|
||||||
|
|
||||||
Purpose: establish that real command composition consumes the integrated
|
Purpose: establish that real command composition consumes the integrated
|
||||||
configuration correctly and finish the upgrade as a reviewable baseline.
|
configuration correctly and finish the upgrade as a reviewable baseline.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"io"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -110,6 +111,7 @@ func TestConfigArtifactsReportsOverlayFamilyContributors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigInspectionReportsInheritedCompositeSources(t *testing.T) {
|
func TestConfigInspectionReportsInheritedCompositeSources(t *testing.T) {
|
||||||
|
t.Setenv("NARRATIO_CONFIG_INSPECTION_KEY", "synthetic-inspection-secret")
|
||||||
pipelinePath, campaignPath := writeInspectionFamilyConfig(t)
|
pipelinePath, campaignPath := writeInspectionFamilyConfig(t)
|
||||||
dir := filepath.Dir(pipelinePath)
|
dir := filepath.Dir(pipelinePath)
|
||||||
parentPath := filepath.Join(dir, "families", "parent.yml")
|
parentPath := filepath.Join(dir, "families", "parent.yml")
|
||||||
@@ -125,6 +127,10 @@ campaigns:
|
|||||||
root: `+filepath.Join(dir, "campaigns")+`
|
root: `+filepath.Join(dir, "campaigns")+`
|
||||||
whisperx:
|
whisperx:
|
||||||
transcribe_url: https://transcription.example.com/transcribe
|
transcribe_url: https://transcription.example.com/transcribe
|
||||||
|
audita:
|
||||||
|
credentials: [NARRATIO_CONFIG_INSPECTION_KEY]
|
||||||
|
scriptorium:
|
||||||
|
extends: audita
|
||||||
`)
|
`)
|
||||||
mustWriteTestFile(t, parentPath, `scriptorium:
|
mustWriteTestFile(t, parentPath, `scriptorium:
|
||||||
artifact_families:
|
artifact_families:
|
||||||
@@ -156,8 +162,38 @@ whisperx:
|
|||||||
artifacts:
|
artifacts:
|
||||||
notes:
|
notes:
|
||||||
output_path: artifacts/notes-testing.md
|
output_path: artifacts/notes-testing.md
|
||||||
|
`)
|
||||||
|
expandedOverlayPath := filepath.Join(dir, "overlays", "expanded.yml")
|
||||||
|
mustWriteTestFile(t, expandedOverlayPath, `scriptorium:
|
||||||
|
extends: null
|
||||||
|
credentials: [NARRATIO_CONFIG_INSPECTION_KEY]
|
||||||
|
artifact_families:
|
||||||
|
character_note:
|
||||||
|
enabled: false
|
||||||
|
for_each: party.characters
|
||||||
|
prompt_id: dnd.character_note.testing
|
||||||
|
profile_id: testing
|
||||||
|
output_path_pattern: artifacts/characters/{character_id}/note.md
|
||||||
|
artifacts:
|
||||||
|
notes:
|
||||||
|
output_path: artifacts/notes-testing.md
|
||||||
`)
|
`)
|
||||||
args := []string{"--config", pipelinePath, "--campaign-file", campaignPath, "--overlay", "testing"}
|
args := []string{"--config", pipelinePath, "--campaign-file", campaignPath, "--overlay", "testing"}
|
||||||
|
if err := ConfigValidate(context.Background(), args, io.Discard); err != nil {
|
||||||
|
t.Fatalf("ConfigValidate() error = %v", err)
|
||||||
|
}
|
||||||
|
var effective bytes.Buffer
|
||||||
|
if err := ConfigShow(context.Background(), args, &effective); err != nil {
|
||||||
|
t.Fatalf("ConfigShow() error = %v", err)
|
||||||
|
}
|
||||||
|
for _, want := range []string{"NARRATIO_CONFIG_INSPECTION_KEY", "character_note_arannis:", "dnd.character_note.testing", "artifacts/characters/arannis/note.md"} {
|
||||||
|
if !strings.Contains(effective.String(), want) {
|
||||||
|
t.Errorf("effective show omitted %q:\n%s", want, effective.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if strings.Contains(effective.String(), "synthetic-inspection-secret") {
|
||||||
|
t.Fatal("effective show exposed a credential value")
|
||||||
|
}
|
||||||
|
|
||||||
var catalog bytes.Buffer
|
var catalog bytes.Buffer
|
||||||
if err := ConfigArtifacts(context.Background(), args, &catalog); err != nil {
|
if err := ConfigArtifacts(context.Background(), args, &catalog); err != nil {
|
||||||
@@ -165,6 +201,9 @@ whisperx:
|
|||||||
}
|
}
|
||||||
records := catalogRecordsByKey(t, catalog.String())
|
records := catalogRecordsByKey(t, catalog.String())
|
||||||
notes := records["notes"]
|
notes := records["notes"]
|
||||||
|
if strings.Contains(catalog.String(), "synthetic-inspection-secret") {
|
||||||
|
t.Fatal("artifact catalog exposed a credential value")
|
||||||
|
}
|
||||||
if notes[4] != "artifacts/notes-testing.md" {
|
if notes[4] != "artifacts/notes-testing.md" {
|
||||||
t.Fatalf("composed artifact output = %#v", notes)
|
t.Fatalf("composed artifact output = %#v", notes)
|
||||||
}
|
}
|
||||||
@@ -192,11 +231,25 @@ whisperx:
|
|||||||
"scriptorium.artifacts.notes.output_path\toverlay\t" + overlayPath,
|
"scriptorium.artifacts.notes.output_path\toverlay\t" + overlayPath,
|
||||||
"scriptorium.artifacts.character_note_arannis.output_path\tfamily\t" + childPath,
|
"scriptorium.artifacts.character_note_arannis.output_path\tfamily\t" + childPath,
|
||||||
"scriptorium.artifacts.character_note_arannis.prompt_id\tfamily\t" + overlayPath,
|
"scriptorium.artifacts.character_note_arannis.prompt_id\tfamily\t" + overlayPath,
|
||||||
|
"scriptorium.credentials\troot\t" + pipelinePath,
|
||||||
} {
|
} {
|
||||||
if !strings.Contains(sources.String(), want) {
|
if !strings.Contains(sources.String(), want) {
|
||||||
t.Errorf("effective source output missing %q:\n%s", want, sources.String())
|
t.Errorf("effective source output missing %q:\n%s", want, sources.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if strings.Contains(sources.String(), "synthetic-inspection-secret") {
|
||||||
|
t.Fatal("source inspection exposed a credential value")
|
||||||
|
}
|
||||||
|
var diff bytes.Buffer
|
||||||
|
if err := ConfigDiff(context.Background(), []string{"testing", "expanded", "--config", pipelinePath, "--campaign-file", campaignPath}, &diff); err != nil {
|
||||||
|
t.Fatalf("ConfigDiff() error = %v", err)
|
||||||
|
}
|
||||||
|
if diff.String() != "no differences\n" {
|
||||||
|
t.Fatalf("equivalent inherited/expanded overlays diff = %q", diff.String())
|
||||||
|
}
|
||||||
|
if strings.Contains(diff.String(), "synthetic-inspection-secret") {
|
||||||
|
t.Fatal("configuration diff exposed a credential value")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigArtifactsReportsBaseAndOverlayContributors(t *testing.T) {
|
func TestConfigArtifactsReportsBaseAndOverlayContributors(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user