Expand test coverage for campaign injection logic#12310
Merged
Conversation
- Added edge case tests for nil handling and campaign ID inference - Added tests for complex configuration scenarios (Governance, Bootstrap, Workers) - Added tests for SafeOutputs and concurrency injection - Expanded normalizeCampaignID test coverage with 10 edge cases - Added tests for default value application Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve test quality for injection_test.go
Expand test coverage for campaign injection logic
Jan 28, 2026
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.
The campaign injection logic in
pkg/campaign/injection.gohad minimal test coverage (60 lines) despite handling complex edge cases around campaign detection, ID inference, governance policies, bootstrap configuration, and safe-output wiring.Changes
Edge case coverage: nil handling, campaign ID inference paths (WorkflowID → Name → default fallback), explicit vs inferred IDs
Configuration scenarios: Governance max overrides, bootstrap seeder workers, worker metadata with payload schemas
Safe-output wiring: dispatch-workflow configuration, concurrency control injection vs preservation
Default application logic: TrackerLabel, MemoryPaths, MetricsGlob, CursorGlob with explicit override tests
ID normalization expansion: 10 edge cases covering empty strings, whitespace, special characters, unicode, leading/trailing hyphens
Example
New table-driven test structure covering actual implementation behavior:
Result: 60 → 460 lines, 8 new test functions, proper
require.*vsassert.*usage throughout.Original prompt
This section details on the original issue you should resolve
<issue_title>[testify-expert] Improve Test Quality: pkg/campaign/injection_test.go</issue_title>
<issue_description>The test file
pkg/campaign/injection_test.gohas been selected for quality improvement by the Testify Uber Super Expert. This issue provides specific, actionable recommendations to enhance test quality, coverage, and maintainability using testify best practices.Current State
pkg/campaign/injection_test.gopkg/campaign/injection.goInjectOrchestratorFeatures)Test Quality Analysis
Strengths ✅
require.*andassert.*throughout"campaign injection should succeed")Areas for Improvement 🎯
1. Missing Edge Case Coverage
Current Gap: The source file has complex logic for detecting campaign vs. project-tracking workflows (lines 40-79), but tests only cover 2 scenarios.
Missing Test Cases:
Recommended Test Cases: