Skip to content

fix: failing trail test#968

Merged
mbevc1 merged 1 commit into
mainfrom
20260624_fix_trail_test
Jun 24, 2026
Merged

fix: failing trail test#968
mbevc1 merged 1 commit into
mainfrom
20260624_fix_trail_test

Conversation

@mbevc1

@mbevc1 mbevc1 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

We've added the '*' attestation type as a valid literal, therefore increasing the validation-error count from 3 to 4. This is making the test more resilient to future changes.

@mbevc1 mbevc1 added the bug Something isn't working label Jun 24, 2026
@mbevc1
mbevc1 enabled auto-merge (squash) June 24, 2026 09:24
@claude

claude Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Claude finished @mbevc1's task in 36s —— View job


Code Review: fix failing trail test

  • Gather context (diff, test file, testdata)
  • Analyze the change
  • Post review

This is a clean, well-scoped fix. The change replaces the hard-coded validation-error count in the golden regex and tidies the test fixture.

cmd/kosli/beginTrail_test.go:54 — Replacing the literal 3 with .*:

-goldenRegex: "Error: 3 validation errors for Template\n.*"
+goldenRegex: "Error: .* validation errors for Template\n.*"

Good call. The exact error count is a server-side implementation detail (it just changed from 3 → 4 when * became a valid attestation type), so asserting on it made the test brittle. The regex still meaningfully verifies that template validation failed.

cmd/kosli/testdata/invalid_template.yml — Trailing whitespace after trail: removed and a final newline added. Both are nice hygiene improvements and don't affect the test's intent (type: not-supported is still the invalid value being exercised).

Minor consideration (non-blocking)

The .* will also match 0 validation errors, so the assertion no longer guarantees that at least one error occurred. If you wanted to keep it slightly stricter while staying resilient, [1-9][0-9]* would assert a non-zero count:

goldenRegex: "Error: [1-9][0-9]* validation errors for Template\n.*"

That said, not-supported will always fail validation here, and the wantError: true flag already asserts a non-zero exit, so this is purely optional polish.

Summary

✅ Sound change that makes the test resilient to future validation-rule additions. No correctness, security, or performance concerns. Since this only touches a test and a fixture, the static-analysis checks (go build / go vet) on the production code are unaffected. LGTM. 👍
20260624_fix_trail_test

@mbevc1
mbevc1 merged commit bec7032 into main Jun 24, 2026
16 checks passed
@mbevc1
mbevc1 deleted the 20260624_fix_trail_test branch June 24, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants