Delete dead code and stale fixtures, fix config set reindent (closes #70)
check / check (pull_request) Failing after 1s

Remove the unused internal/models package (and its coverage-only test),
internal/cli/vaultik_snapshot_types.go (a second, dead SnapshotInfo that
shadowed the live type in internal/vaultik), and two fixtures
(test-config.yml, test/integration-config.yml) that use source_dirs and
other keys config.Config no longer has. All confirmed by grep against
origin/next; none has a production consumer.

config set now writes via yaml.NewEncoder with 2-space indent, matching
defaultConfigTemplate, so the first set no longer reindents the file it
promises to preserve. A test covers the round-trip.

Single commit rather than one commit per deletion, per task instruction.
test/integration-config.yml removed per the manager note on the issue.

Model: opus-4-8
This commit is contained in:
2026-09-21 13:05:22 +00:00
parent d2a0510cb4
commit 1071058f4e
7 changed files with 71 additions and 189 deletions
+41
View File
@@ -188,6 +188,47 @@ func TestYAMLPathSet(t *testing.T) {
}
}
// TestConfigSetPreservesFormatting asserts the `config set` write path
// (marshalConfigYAML) round-trips a 2-space-indented file without reindenting
// it to yaml.Marshal's 4-space default, and keeps comments.
func TestConfigSetPreservesFormatting(t *testing.T) {
t.Parallel()
root := parseTestYAML(t)
err := yamlPathSet(root, splitPath("s3.bucket"), "newbucket")
if err != nil {
t.Fatalf("set s3.bucket: %v", err)
}
out, err := marshalConfigYAML(root)
if err != nil {
t.Fatalf("marshal: %v", err)
}
text := string(out)
for _, want := range []string{"# top comment", "# inline comment"} {
if !contains(text, want) {
t.Errorf("round-tripped YAML dropped comment %q:\n%s", want, text)
}
}
// Nested map keys stay at 2-space indent; the bug reindented them to 4.
if !contains(text, "\n bucket: newbucket") {
t.Errorf("expected 2-space indent for s3.bucket, got:\n%s", text)
}
if contains(text, "\n bucket:") {
t.Errorf("s3.bucket reindented to 4 spaces:\n%s", text)
}
// Sequence items under a key also stay at 2 spaces.
if !contains(text, "\n - age1aaa") {
t.Errorf("expected 2-space indent for sequence item, got:\n%s", text)
}
}
func splitPath(s string) []string {
return strings.Split(s, ".")
}