-
Notifications
You must be signed in to change notification settings - Fork 25
test(engine): tighten test-suite hermeticity and parent-aware subtest references #137
Copy link
Copy link
Closed
Labels
area/testingIssues or PRs related to testing (unit, integration, e2e)Issues or PRs related to testing (unit, integration, e2e)kind/cleanupCategorizes issue or PR as related to cleanup of code, process, or technical debtCategorizes issue or PR as related to cleanup of code, process, or technical debtpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next releaseMust be staffed and worked on either currently, or very soon, ideally in time for the next releasetriage/acceptedIndicates an issue is ready to be actively worked onIndicates an issue is ready to be actively worked on
Metadata
Metadata
Assignees
Labels
area/testingIssues or PRs related to testing (unit, integration, e2e)Issues or PRs related to testing (unit, integration, e2e)kind/cleanupCategorizes issue or PR as related to cleanup of code, process, or technical debtCategorizes issue or PR as related to cleanup of code, process, or technical debtpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next releaseMust be staffed and worked on either currently, or very soon, ideally in time for the next releasetriage/acceptedIndicates an issue is ready to be actively worked onIndicates an issue is ready to be actively worked on
Type
Fields
Give feedbackNo fields configured for issues without a type.
Two test-quality follow-ups deferred from #136:
1. Scope
TestNoWorkflowLeakageInRepoSourceto git-tracked filesCurrently
TestNoWorkflowLeakageInRepoSource(pkg/engine/engine_test.go) walks the whole module root withfilepath.WalkDir. The skip set covers.git,vendor,node_modules, and.claude, but any other untracked local artifact (notes file, generated YAML, build scratch) containing one of the banned phrases will failgo test ./...even though no committed source violates the rule.Switch the walk to iterate only git-tracked files — e.g.
git ls-filesor an equivalent helper — so the guard is hermetic with respect to the working-tree state.2. Key
TestNoDanglingSubtestReferencesInSourceby parent + slugTestNoDanglingSubtestReferencesInSource(pkg/engine/engine_test.go) records discoveredt.Runslugs in a flatmap[slug]struct{}. A citation likeTestFoo/v1.12therefore passes as soon as any test in the package has av1.12subtest, even under a different parent — exactly the wrong-parent drift this guard claims to catch.Update the collector to parse each test file for the nearest preceding
func TestX(...)block and store subtests asmap[parent]map[slug]struct{}(or a flatparent/slugkey). The reference-checking loop should then look up the exact parent + slug, allowing prefix matches only within the same parent.Both items came up in CodeRabbit review on #136 and were deferred there to keep that PR focused on the apply-path regression and
MergeFileAsPatchhardening.