Remove unused helpers and retired path fields

This commit is contained in:
2026-12-02 21:11:59 +00:00
parent d3b4f25f71
commit 3e0f455b6d
17 changed files with 21 additions and 177 deletions

View File

@@ -41,9 +41,10 @@ their scope. Unless assigned otherwise, a finding remains independent audit
remediation. Shared code does not make a refactoring a prerequisite or assign remediation. Shared code does not make a refactoring a prerequisite or assign
the whole finding to a roadmap. the whole finding to a roadmap.
Twenty-one entries are closed by the safety, transfer, audio discovery, S3 Twenty-five entries are closed by the safety, transfer, audio discovery, S3
planning, prerequisite-history, publication-import, CLI classification, planning, prerequisite-history, publication-import, CLI classification,
inspection aggregation, test maintenance, and associated documentation work; 22 remain open. **Planned** identifies inspection aggregation, test maintenance, dead-code removal, and associated
documentation work; 18 remain open. **Planned** identifies
an agreed remedy awaiting implementation. **Potentially eliminated** requires verification that the offending an agreed remedy awaiting implementation. **Potentially eliminated** requires verification that the offending
lifecycle is removed. **Coordinate** identifies shared changes, not a commitment lifecycle is removed. **Coordinate** identifies shared changes, not a commitment
that a related feature implements the entire finding. Findings close only after their that a related feature implements the entire finding. Findings close only after their
@@ -895,7 +896,10 @@ meaningful boundary tests.
### CAT-36 — P3: Remove confirmed orphaned production and test helpers ### CAT-36 — P3: Remove confirmed orphaned production and test helpers
Status: Open Status: Closed
**Closure.** The listed orphan helpers and their unused imports were removed after a source
reference check; focused package tests and `go vet ./...` pass.
Original findings: [DD-01](12-deadcode.md#dd-01--p3-completely-orphaned-helper-functions-remain-in-production-and-tests). Original findings: [DD-01](12-deadcode.md#dd-01--p3-completely-orphaned-helper-functions-remain-in-production-and-tests).
@@ -910,7 +914,10 @@ replacement abstraction or compatibility shim is needed.
### CAT-37 — P3: Remove unused constants and retired workspace path fields ### CAT-37 — P3: Remove unused constants and retired workspace path fields
Status: Open Status: Closed
**Closure.** The listed unused constants and retired session path fields were removed;
active layout and publication defaults remain covered by package tests.
Original findings: [DD-02](12-deadcode.md#dd-02--p3-unused-constants-and-retired-workspace-paths-advertise-obsolete-concepts). Original findings: [DD-02](12-deadcode.md#dd-02--p3-unused-constants-and-retired-workspace-paths-advertise-obsolete-concepts).
@@ -955,7 +962,10 @@ Related: [CAT-01](#cat-01--p1-coordinate-whole-session-deletion-with-active-invo
### CAT-40 — P3: Remove the superseded publish-default mutation helper ### CAT-40 — P3: Remove the superseded publish-default mutation helper
Status: Open Status: Closed
**Closure.** The obsolete publish-default writer and its no-op test call were removed;
ConfigKit derivation and explicit-destination tests remain.
Original findings: [DD-05](12-deadcode.md#dd-05--p3-a-superseded-publish-default-mutation-helper-survives-only-in-a-no-op-test-call). Original findings: [DD-05](12-deadcode.md#dd-05--p3-a-superseded-publish-default-mutation-helper-survives-only-in-a-no-op-test-call).
@@ -984,7 +994,10 @@ neighboring source-kind and missing-input cases, which protect different behavio
### CAT-42 — P3: Discard the unused normalized-path result while retaining validation ### CAT-42 — P3: Discard the unused normalized-path result while retaining validation
Status: Open Status: Closed
**Closure.** Input hashing discards the unused normalized value while retaining the
confinement check; stage tests pass.
Original findings: [DD-06](12-deadcode.md#dd-06--p3-input-hashing-stores-a-normalized-path-that-is-never-consumed). Original findings: [DD-06](12-deadcode.md#dd-06--p3-input-hashing-stores-a-normalized-path-that-is-never-consumed).

View File

@@ -141,7 +141,7 @@ Validation: `go test ./internal/artifactmodel ./internal/config ./internal/stage
## Stage 3: Remove Verified Orphans And Inert Model Elements ## Stage 3: Remove Verified Orphans And Inert Model Elements
CAT IDs: CAT-36, CAT-37, CAT-40, CAT-42. Status: Pending. CAT IDs: CAT-36, CAT-37, CAT-40, CAT-42. Status: Complete.
Read [DD-01](audit/12-deadcode.md#dd-01--p3-completely-orphaned-helper-functions-remain-in-production-and-tests), Read [DD-01](audit/12-deadcode.md#dd-01--p3-completely-orphaned-helper-functions-remain-in-production-and-tests),
[DD-02](audit/12-deadcode.md#dd-02--p3-unused-constants-and-retired-workspace-paths-advertise-obsolete-concepts), [DD-02](audit/12-deadcode.md#dd-02--p3-unused-constants-and-retired-workspace-paths-advertise-obsolete-concepts),

View File

@@ -12,7 +12,6 @@ import (
"gitea.maximumdirect.net/eric/narratio/internal/adapters/subprocess" "gitea.maximumdirect.net/eric/narratio/internal/adapters/subprocess"
"gitea.maximumdirect.net/eric/narratio/internal/fileops" "gitea.maximumdirect.net/eric/narratio/internal/fileops"
"gitea.maximumdirect.net/eric/narratio/internal/notariusref" "gitea.maximumdirect.net/eric/narratio/internal/notariusref"
"gitea.maximumdirect.net/eric/narratio/internal/pathsafe"
) )
const maxReportBytes = 1 << 20 const maxReportBytes = 1 << 20
@@ -241,21 +240,6 @@ func validateBundleRoot(outputRoot, bundleRoot string) (string, error) {
return bundle, nil return bundle, nil
} }
func resolveRegularFile(root, logicalPath string) (string, error) {
resolved, err := pathsafe.JoinSlashRelativeUnderRoot(root, logicalPath)
if err != nil {
return "", err
}
relative, err := filepath.Rel(root, resolved)
if err != nil {
return "", err
}
if err := requireRegularFileTree(root, relative); err != nil {
return "", err
}
return resolved, nil
}
func requireDirectoryTree(root, relative string) error { func requireDirectoryTree(root, relative string) error {
if err := requireDirectory(root); err != nil { if err := requireDirectory(root); err != nil {
return err return err
@@ -270,24 +254,6 @@ func requireDirectoryTree(root, relative string) error {
return nil return nil
} }
func requireRegularFileTree(root, relative string) error {
components := strings.Split(relative, string(filepath.Separator))
if len(components) == 0 {
return fmt.Errorf("regular file path is required")
}
if err := requireDirectory(root); err != nil {
return err
}
current := root
for _, component := range components[:len(components)-1] {
current = filepath.Join(current, component)
if err := requireDirectory(current); err != nil {
return err
}
}
return requireRegularFile(filepath.Join(current, components[len(components)-1]))
}
func requireDirectory(path string) error { func requireDirectory(path string) error {
info, err := os.Lstat(path) info, err := os.Lstat(path)
if err != nil { if err != nil {

View File

@@ -553,11 +553,3 @@ func assertTextFile(t *testing.T, path, want string) {
t.Fatalf("ReadFile(%q) = %q, want %q", path, string(data), want) t.Fatalf("ReadFile(%q) = %q, want %q", path, string(data), want)
} }
} }
func cloneMap(source map[string]any) map[string]any {
result := make(map[string]any, len(source))
for key, value := range source {
result[key] = value
}
return result
}

View File

@@ -65,28 +65,3 @@ func validateScopedTarget(root, target, policy string, requireDir bool) (scopedD
} }
return scopedDir{RootAbs: rootAbs, TargetAbs: targetAbs, Exists: true}, nil return scopedDir{RootAbs: rootAbs, TargetAbs: targetAbs, Exists: true}, nil
} }
func validateCleanRoot(root, policy string) (string, bool, error) {
cleanRoot := strings.TrimSpace(root)
if cleanRoot == "" {
return "", false, fmt.Errorf("cleanup policy %s: root path is required", policy)
}
rootAbs, err := filepath.Abs(cleanRoot)
if err != nil {
return "", false, fmt.Errorf("cleanup policy %s: resolve root %q: %w", policy, cleanRoot, err)
}
info, err := os.Lstat(rootAbs)
if err != nil {
if os.IsNotExist(err) {
return rootAbs, false, nil
}
return "", false, fmt.Errorf("cleanup policy %s: stat root %q: %w", policy, rootAbs, err)
}
if info.Mode()&os.ModeSymlink != 0 {
return "", false, fmt.Errorf("cleanup policy %s: refusing to clean symlink root %q", policy, rootAbs)
}
if !info.IsDir() {
return "", false, fmt.Errorf("cleanup policy %s: root %q is not a directory", policy, rootAbs)
}
return rootAbs, true, nil
}

View File

@@ -11,7 +11,6 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"testing" "testing"
"time"
"gitea.maximumdirect.net/eric/narratio/internal/artifacts" "gitea.maximumdirect.net/eric/narratio/internal/artifacts"
"gitea.maximumdirect.net/eric/narratio/internal/manifest" "gitea.maximumdirect.net/eric/narratio/internal/manifest"
@@ -506,21 +505,6 @@ narratio:
return campaignPath return campaignPath
} }
func writeManifestPathForExecute(t *testing.T) string {
t.Helper()
store := &manifest.LocalStore{}
m := manifest.New("2026-05-03", time.Date(2026, 5, 3, 10, 0, 0, 0, time.UTC))
m.MarkStageSucceeded("prepare", time.Date(2026, 5, 3, 10, 1, 0, 0, time.UTC), nil)
path := filepath.Join(t.TempDir(), "manifest.json")
if err := store.Save(context.Background(), path, m); err != nil {
t.Fatalf("save manifest: %v", err)
}
return path
}
func mustWriteTestFile(t *testing.T, path, contents string) { func mustWriteTestFile(t *testing.T, path, contents string) {
t.Helper() t.Helper()
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {

View File

@@ -45,13 +45,6 @@ func TestExecuteConfigUsesInvocationPipelineLoader(t *testing.T) {
} }
} }
func writeInspectionOverlays(t *testing.T, pipelinePath, production, testing string) {
t.Helper()
overlaysDir := filepath.Join(filepath.Dir(pipelinePath), "overlays")
mustWriteTestFile(t, filepath.Join(overlaysDir, "production.yml"), production)
mustWriteTestFile(t, filepath.Join(overlaysDir, "testing.yml"), testing)
}
func writeInspectionFamilyConfig(t *testing.T) (string, string) { func writeInspectionFamilyConfig(t *testing.T) (string, string) {
t.Helper() t.Helper()
dir := t.TempDir() dir := t.TempDir()

View File

@@ -1,16 +0,0 @@
package app
import (
"testing"
"gitea.maximumdirect.net/eric/narratio/internal/artifacts"
)
func mustPreviousArtifactPathForCampaign(t *testing.T, root, campaign, sessionID, relative string) string {
t.Helper()
path, err := artifacts.SessionPreviousArtifactPathForCampaign(root, campaign, sessionID, relative)
if err != nil {
t.Fatalf("SessionPreviousArtifactPathForCampaign() error = %v", err)
}
return path
}

View File

@@ -22,8 +22,6 @@ type SessionPaths struct {
TranscriptsDir string TranscriptsDir string
TranscriptsRawDir string TranscriptsRawDir string
ArtifactsDir string ArtifactsDir string
ReportsDir string
ConfigDir string
LogsDir string LogsDir string
DebugDir string DebugDir string
ReferencesDir string ReferencesDir string
@@ -240,8 +238,6 @@ func buildSessionPathsFromRoot(workspaceRoot, campaign, sessionID, root string)
TranscriptsDir: filepath.Join(root, config.PathTranscriptsSegment), TranscriptsDir: filepath.Join(root, config.PathTranscriptsSegment),
TranscriptsRawDir: filepath.Join(root, filepath.FromSlash(config.PathTranscriptsRaw)), TranscriptsRawDir: filepath.Join(root, filepath.FromSlash(config.PathTranscriptsRaw)),
ArtifactsDir: filepath.Join(root, config.PathArtifactsDirSegment), ArtifactsDir: filepath.Join(root, config.PathArtifactsDirSegment),
ReportsDir: filepath.Join(root, config.PathReportsDirSegment),
ConfigDir: filepath.Join(root, config.PathConfigDirSegment),
LogsDir: filepath.Join(root, config.PathLogsDirSegment), LogsDir: filepath.Join(root, config.PathLogsDirSegment),
DebugDir: filepath.Join(root, "debug"), DebugDir: filepath.Join(root, "debug"),
ReferencesDir: filepath.Join(root, config.PathInputsDirSegment, "references"), ReferencesDir: filepath.Join(root, config.PathInputsDirSegment, "references"),

View File

@@ -33,7 +33,6 @@ const (
DefaultScriptoriumBinary = "scriptorium" DefaultScriptoriumBinary = "scriptorium"
DefaultScriptoriumTimeout = "10m" DefaultScriptoriumTimeout = "10m"
DefaultScriptoriumArtifactOutputRoot = "artifacts"
DefaultScriptoriumStickySessionVarName = "session_id" DefaultScriptoriumStickySessionVarName = "session_id"
DefaultScriptoriumStickySessionVarPrefix = "narratio-session-" DefaultScriptoriumStickySessionVarPrefix = "narratio-session-"
@@ -65,24 +64,17 @@ const (
PathTranscriptsSegment = "transcripts" PathTranscriptsSegment = "transcripts"
PathTranscriptsRaw = "transcripts/raw" PathTranscriptsRaw = "transcripts/raw"
PathArtifactsDirSegment = "artifacts" PathArtifactsDirSegment = "artifacts"
PathReportsDirSegment = "reports"
PathConfigDirSegment = "config"
PathLogsDirSegment = "logs" PathLogsDirSegment = "logs"
PathRunsDirSegment = "runs" PathRunsDirSegment = "runs"
PathPreviousDirSegment = "previous" PathPreviousDirSegment = "previous"
PathManifestFile = "manifest.json" PathManifestFile = "manifest.json"
PathLockFile = ".lock" PathLockFile = ".lock"
PathTranscriptBase = artifactmodel.TranscriptPathBase
PathTranscriptPolished = artifactmodel.TranscriptPathPolished
PathTranscriptFinal = artifactmodel.TranscriptPathFinal
PathTranscriptFinalTrimmed = artifactmodel.TranscriptPathFinalTrimmed PathTranscriptFinalTrimmed = artifactmodel.TranscriptPathFinalTrimmed
S3CampaignsSegment = "campaigns" S3CampaignsSegment = "campaigns"
S3SessionsSegment = "sessions" S3SessionsSegment = "sessions"
S3RunsSegment = "runs" S3RunsSegment = "runs"
S3CurrentSegment = "current" S3CurrentSegment = "current"
S3ManifestFile = "manifest.json"
S3RunIDFile = "run_id.txt"
S3CommitFile = "commit.json" S3CommitFile = "commit.json"
S3CommitPointerFile = "commit-pointer.json" S3CommitPointerFile = "commit-pointer.json"
S3SessionSnapshotFile = "session-manifest.json" S3SessionSnapshotFile = "session-manifest.json"

View File

@@ -2,8 +2,6 @@ package config
import ( import (
"fmt" "fmt"
"path/filepath"
"strings"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
@@ -27,12 +25,6 @@ func EffectivePipelineImports(cfg *PipelineConfig) []string {
return append([]string(nil), cfg.resolution.imports...) return append([]string(nil), cfg.resolution.imports...)
} }
// NormalizedConfigurationPath returns a clean absolute path when possible for
// display-only configuration provenance.
func NormalizedConfigurationPath(path string) string {
return normalizedProvenancePath(path)
}
// MarshalEffectivePipeline materializes completed configuration for persistence. // MarshalEffectivePipeline materializes completed configuration for persistence.
// Credentials retain reference names; domain catalogs remain separate. // Credentials retain reference names; domain catalogs remain separate.
func MarshalEffectivePipeline(cfg *PipelineConfig) ([]byte, error) { func MarshalEffectivePipeline(cfg *PipelineConfig) ([]byte, error) {
@@ -61,14 +53,3 @@ func MarshalEffectivePipeline(cfg *PipelineConfig) ([]byte, error) {
} }
return output, nil return output, nil
} }
func normalizedProvenancePath(path string) string {
if strings.TrimSpace(path) == "" {
return ""
}
abs, err := filepath.Abs(path)
if err != nil {
return filepath.Clean(path)
}
return filepath.Clean(abs)
}

View File

@@ -119,7 +119,6 @@ func TestProductDestinationsPreserveExplicitRemotePaths(t *testing.T) {
Notarius: &NotariusConfig{Enabled: true, Outputs: map[string]NotariusOutputConfig{"people": {LaneID: "people", Filename: "people-local.json"}}}, Notarius: &NotariusConfig{Enabled: true, Outputs: map[string]NotariusOutputConfig{"people": {LaneID: "people", Filename: "people-local.json"}}},
Publish: &PublishConfig{Outputs: []PublishOutputRule{{Source: "narratio.extraction.people", Dest: "archive/session/people.json"}}}, Publish: &PublishConfig{Outputs: []PublishOutputRule{{Source: "narratio.extraction.people", Dest: "archive/session/people.json"}}},
} }
applyMissingPublishDestinations(cfg.Publish, nil, cfg.Notarius)
if got := cfg.Publish.Outputs[0].Dest; got != "archive/session/people.json" { if got := cfg.Publish.Outputs[0].Dest; got != "archive/session/people.json" {
t.Fatalf("remote destination = %q", got) t.Fatalf("remote destination = %q", got)
} }

View File

@@ -38,18 +38,6 @@ func validateRelativeSafePath(fieldName, value string) error {
return nil return nil
} }
func validatePathWithinRoot(fieldName, value, root string) error {
normalizedValue := filepath.ToSlash(filepath.Clean(strings.TrimSpace(value)))
normalizedRoot := filepath.ToSlash(filepath.Clean(strings.TrimSpace(root)))
if normalizedValue == normalizedRoot {
return nil
}
if strings.HasPrefix(normalizedValue, normalizedRoot+"/") {
return nil
}
return fmt.Errorf("%s must be under %s/", fieldName, normalizedRoot)
}
func validateDuration(fieldName, value string) error { func validateDuration(fieldName, value string) error {
trimmed := strings.TrimSpace(value) trimmed := strings.TrimSpace(value)
if trimmed == "" { if trimmed == "" {

View File

@@ -33,12 +33,6 @@ func deriveMissingPublishDestinations(cfg *PublishConfig, scriptorium *Scriptori
return derived return derived
} }
func applyMissingPublishDestinations(cfg *PublishConfig, scriptorium *ScriptoriumConfig, notarius *NotariusConfig) {
for _, derived := range deriveMissingPublishDestinations(cfg, scriptorium, notarius) {
cfg.Outputs[derived.index].Dest = derived.dest
}
}
func validateStorage(cfg StorageConfig) error { func validateStorage(cfg StorageConfig) error {
backend := strings.ToLower(strings.TrimSpace(cfg.Backend)) backend := strings.ToLower(strings.TrimSpace(cfg.Backend))
switch backend { switch backend {

View File

@@ -259,7 +259,7 @@ func hashAnalyzeInputFile(paths artifacts.SessionPaths, path string) (string, in
if err != nil { if err != nil {
return "", 0, fmt.Errorf("resolve input below session root: %w", err) return "", 0, fmt.Errorf("resolve input below session root: %w", err)
} }
relative, err = pathsafe.NormalizeRelativeDestination(filepath.ToSlash(relative)) _, err = pathsafe.NormalizeRelativeDestination(filepath.ToSlash(relative))
if err != nil { if err != nil {
return "", 0, fmt.Errorf("input path is outside session root: %w", err) return "", 0, fmt.Errorf("input path is outside session root: %w", err)
} }

View File

@@ -954,8 +954,6 @@ type extractFixture struct {
inputPath string inputPath string
} }
func stringPointerForExtractTest(value string) *string { return &value }
func extractFixtureFromEnv(t *testing.T, env *Env, m *manifest.Manifest) extractFixture { func extractFixtureFromEnv(t *testing.T, env *Env, m *manifest.Manifest) extractFixture {
t.Helper() t.Helper()
paths := sessionPathsForEnv(env, m.SessionID) paths := sessionPathsForEnv(env, m.SessionID)

View File

@@ -752,17 +752,6 @@ func findManifestInput(t *testing.T, inputs []manifest.InputRecord, kind string)
return manifest.InputRecord{} return manifest.InputRecord{}
} }
func assertManifestInputsSorted(t *testing.T, inputs []manifest.InputRecord) {
t.Helper()
for index := 1; index < len(inputs); index++ {
previous := inputs[index-1]
current := inputs[index]
if previous.Kind > current.Kind || (previous.Kind == current.Kind && previous.Path > current.Path) {
t.Fatalf("manifest inputs are not sorted at %d: %#v before %#v", index, previous, current)
}
}
}
func mustReadFileEquals(t *testing.T, path, want string) { func mustReadFileEquals(t *testing.T, path, want string) {
t.Helper() t.Helper()
data, err := os.ReadFile(path) data, err := os.ReadFile(path)