Skip to content

test: address 3 actionable Go test issues from AI code quality findings#37

Merged
ktsaou merged 1 commit into
mainfrom
test-quality-ai-findings-9-10-11
Jun 9, 2026
Merged

test: address 3 actionable Go test issues from AI code quality findings#37
ktsaou merged 1 commit into
mainfrom
test-quality-ai-findings-9-10-11

Conversation

@ktsaou

@ktsaou ktsaou commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Triages the 11 AI code quality findings reported under
security/quality/ai-findings and fixes the 3 that are real,
in-scope, test-level issues.

Findings triage

# File Verdict Action
1 .agents/skills/project-hygiene/SKILL.md valid but minor skipped (debatable practice)
2 SOW-0102 status line conflicts with project status conventions skipped
3 SOW-0102 line 39 unknown duplicate of line 3944 skipped
4 SOW-0102 'Final local results' valid rename skipped (SOW author context)
5 SOW-0102 slice ordering valid but acknowledged in SOW metadata skipped
6 SOW-0102 wildcard fallback valid but already partially addressed skipped
7 helper_contract_test.go tie-break false positive — test fully exercises 3-level tie-break skipped
8 canonical_test.go 5.6.7.0 defensive, same code path skipped
9 canonical_test.go sanitizer valid fixed
10 funcs_test.go mins t.Run valid fixed
11 funcs_test.go relTime flake valid fixed

Changes

  • pkg/downloader/canonical_test.goTestSanitizeReaderNormalizesProcessedStream is now table-driven via t.Run. New subtests: empty input, BOM-only input, mid-stream BOM (documented as preserved, not stripped).
  • pkg/markdown/funcs_test.goTestTemplateMinsFunction gains a name field and t.Run(tc.name, ...) per subtest, matching the TestTemplateCommaFunction pattern in the same file.
  • pkg/markdown/funcs_test.goTestTemplateRelTimeFunction gains t.Parallel(), t.Run per subtest, and the current case uses now.Add(-100 * time.Millisecond) so the assertion stays in the < 1 minute "just now" bucket even on a heavily loaded runner.

Validation

  • go test ./pkg/markdown/... ./pkg/downloader/... — pass
  • go test -race ./pkg/markdown/... ./pkg/downloader/... — pass

The 8 SOW-level findings (#1-#6, plus acknowledged by metadata in #5) are intentionally out of scope for this PR — they are SOW-lifecycle or skill-content decisions that should be discussed separately.

Triage and fix the three real Go test issues from the GitHub code
quality AI findings surface (security/quality/ai-findings). 11 findings
were reported across 5 files; 1 was a false positive (helper_contract
tie-break), 1 conflicted with project status conventions, 2 were
defensive/duplicates, and 4 were SOW-level concerns already addressed
or out of scope for a single test PR. The remaining 3 are fixed here:

- pkg/downloader: TestSanitizeReaderNormalizesProcessedStream now
  exercises empty input, BOM-only input, and mid-stream BOM via a
  table-driven t.Run pattern.
- pkg/markdown: TestTemplateMinsFunction gains name-based subtests and
  matches the t.Parallel()/t.Run pattern used by sibling tests.
- pkg/markdown: TestTemplateRelTimeFunction gains t.Parallel(),
  name-based subtests, and the 'current' case uses a 100ms-in-the-past
  offset to remove the exact-now flakiness when the runner crosses
  the 1-minute 'just now' boundary under load.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@ktsaou ktsaou enabled auto-merge (squash) June 9, 2026 07:48
@ktsaou ktsaou merged commit 9647a16 into main Jun 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant