fix(cli): anchor test-report testPaths to the spec folder deterministically#23
Merged
Conversation
…ically `csdd spec test-report` recorded `testPaths` from the workspace-relative paths of whichever JUnit/coverage artifacts were parsed or auto-discovered, so the value drifted with `--path` and the runner's output location and could point outside the spec. Set `testPaths` to the spec's own folder (`specs/<feature>/`, forward-slash with trailing slash) once, after the nothing-to-record guard — deterministic over (root, feature) and independent of artifact locations. Remove the now-orphaned `appendUnique` helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
csdd spec test-reportpopulatedtest-report.json'stestPathsfrom theworkspace-relative paths of whichever JUnit/coverage artifacts were parsed or
auto-discovered (e.g.
coverage.out,tests/junit.xml). That value wasnon-deterministic — it drifted with
--pathand where the runner dropped files,and could point outside the spec.
This change makes
testPathsdeterministically point at the spec's own folder:exactly one entry
specs/<feature>/(forward-slash, trailing slash), set onceafter the nothing-to-record guard, independent of artifact locations and of how
the metrics were gathered (
--rundiscovery,--junit/--coverage, or explicitcounts). The now-orphaned
appendUniquehelper is removed; the staleTestPathsdoc comment in
internal/session/reports.gois corrected.Spec:
specs/test-report-spec-paths/(requirements → design → tasks all approved;csdd spec validategreen).Changes
internal/cli/spec.go— setrep.TestPaths = []string{filepath.ToSlash(workspace.Relative(r, sdir)) + "/"}; drop the twoappendUnique(rep.TestPaths, …Source)calls and the orphaned helper.internal/cli/test_report_test.go— assert the exact spec-folder value across--run,--junit/--coverage, and explicit-count origins; negative assertions that no artifact filename leaks.internal/session/reports.go— correct the now-falseTestPathsdoc comment (field/type unchanged).Verification
Risks
testPathsexpecting artifact file paths now gets the spec directory. The only in-repo consumer is thecsdd webdashboard, which renders it as astring[]— unaffected (a one-element array is still valid).test-report.jsonis regenerated on the next run.🤖 Generated with Claude Code