* chore: add task spec for issue 258 * chore: add implementation plan for issue 258 * fix(spec): address CodeRabbit review comments on plan and spec - Plan: clarify git diff strategy (local HEAD vs CI origin/dev...HEAD) - Plan: add Phase 2 rename/delete/add handling via git diff --name-status - Plan: add N:M test file discovery (not just 1:1 mapping) - Plan: align Phase 3 with existing runTest() infrastructure - Plan: replace raw `go test ./...` fallback with runTest() call - Plan: correct file paths to internal/cmd/test/ (not cmd/core/cmd/) - Spec: explicitly scope as Go-only with note on future language support - Spec: wrap bare URL in angle brackets - Spec: add --base flag for CI/PR context - Spec: update acceptance criteria to match revised plan - Spec: add technical context pointing to existing infrastructure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * ci: retrigger checks after disabling default CodeQL setup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1.7 KiB
1.7 KiB
Issue 258: Smart Test Detection
Original Issue
https://github.com/host-uk/core/issues/258
Summary
Make core test smart — detect changed Go files and run only relevant tests.
Scope: Go-only. The existing
core testcommand (internal/cmd/test/) targets Go projects (requiresgo.mod). Future language support (PHP, etc.) would be added as separate detection strategies, but this issue covers Go only.
Commands
core test # Run tests for changed files only
core test --all # Run all tests (skip detection)
core test --filter UserTest # Run specific test pattern
core test --coverage # With coverage report
core test --base origin/dev # Compare against specific base branch (CI)
Acceptance Criteria
- Detect changed
.gofiles viagit diff(local:HEAD, CI:origin/dev...HEAD) - Handle renames, deletes, and new files via
git diff --name-status - Map source files to test files using N:M discovery (
foo.go→foo_test.go,foo_integration_test.go, etc.) - Warn when changed files have no corresponding tests
- Execute tests through existing
runTest()infrastructure (not rawgo test) - Support
--allflag to skip detection and run all tests - Support
--filterflag for test name pattern matching - Support
--coverageflag for coverage reports - Support
--baseflag for CI/PR diff context
Technical Context
- Existing
core testcommand:internal/cmd/test/cmd_main.go - Existing test runner:
internal/cmd/test/cmd_runner.go(runTest()) - Output parsing:
internal/cmd/test/cmd_output.go - Command registration:
internal/cmd/test/cmd_commands.goviacli.RegisterCommands() - Follow existing patterns in
internal/cmd/test/