[code-simplifier] test: remove duplicate benchmark and dead code in test files#27154
Conversation
- pkg/repoutil/repoutil_test.go: Remove BenchmarkSplitRepoSlug which is an exact duplicate of BenchmarkSplitRepoSlug_Valid (both benchmark the same valid slug 'github/gh-aw'). Keep the descriptively-named _Valid variant which pairs clearly with BenchmarkSplitRepoSlug_Invalid. - pkg/constants/constants_test.go: Remove dead-code variable block in TestTypeSafetyBetweenSemanticTypes. The jobStr/stepStr variables were assigned and immediately discarded via '_ =' assignments with no assertions, providing no test coverage. String conversion is already tested by the preceding assertions in the same function. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR simplifies test code by removing redundant benchmark coverage and eliminating a dead-code block in a semantic-type test, without changing behavior.
Changes:
- Removed a duplicate
BenchmarkSplitRepoSlugbenchmark inpkg/repoutil/repoutil_test.go(keeps_Valid/_Invalidbenchmarks). - Removed a dead-code variable assignment/discard block in
TestTypeSafetyBetweenSemanticTypesinpkg/constants/constants_test.go.
Show a summary per file
| File | Description |
|---|---|
| pkg/repoutil/repoutil_test.go | Deletes a redundant benchmark, retaining the meaningful valid/invalid benchmarks. |
| pkg/constants/constants_test.go | Removes non-asserting dead code from a test, keeping only the assertions that provide coverage. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
🧪 Test Quality Sentinel ReportTest Quality Score: N/A (cleanup-only PR)✅ No new tests introduced — pure dead code removal
What Changed
Both modified files retain their Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators. References: §24622917721
|
This PR simplifies recently modified test files to remove redundant code while preserving all functionality.
Files Simplified
pkg/repoutil/repoutil_test.go— Remove duplicateBenchmarkSplitRepoSlugpkg/constants/constants_test.go— Remove dead-code variable blockImprovements Made
Removed Duplicate Benchmark
BenchmarkSplitRepoSlug(added alongside the newrepoutilpackage) was an exact duplicate ofBenchmarkSplitRepoSlug_Valid. Both functions benchmarked the identical valid slug"github/gh-aw"with the same loop body:The
_Valid/_Invalidnaming pair is more expressive and self-documenting.Removed Dead-Code Variables
TestTypeSafetyBetweenSemanticTypesinconstants_test.gocontained a block that assigned variables and immediately discarded them with_ =— making no assertions and providing no coverage:String conversion is already verified by the assertions directly above this block, and more thoroughly in
TestHelperMethodsandTestSpec_SemanticTypes_StringAndIsValid.Changes Based On
Recent changes from:
pkg/repoutil)Testing
go test ./pkg/repoutil/ ./pkg/constants/)make build)Review Focus
Please verify:
_Validvariant)References: §24622549455
Note
🔒 Integrity filter blocked 5 items
The following items were blocked because they don't meet the GitHub integrity level.
pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".pkg/agentdrain#27107pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: