[repository-quality] 🎯 Repository Quality Improvement Report - Codemod Registry Drift & Idempotency Coverage Gap #42771
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Repository Quality Improvement Agent. A newer discussion is available at Discussion #42975. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Analysis Date: 2026-07-01
Focus Area: Codemod Registry Drift & Idempotency Coverage Gap
Strategy Type: Custom
Custom Area: Yes — gh-aw has 62 codemods, a growing migration surface requiring robust test coverage.
Executive Summary
The codemod sub-system (
pkg/cli/codemod_*.go) is a critical migration engine with 62 registered codemods. Three test-coverage gaps compound as the registry grows: (1)TestGetAllCodemods_ContainsExpectedCodemodsonly asserts 42 of 62 IDs — 20 codemods (32%) could be silently removed without failing any test; (2) zero codemods have double-apply idempotency tests, leavinggh aw fixopen to silent file corruption on repeated runs; (3) only 2 of 62 codemods (3%) have fuzz tests despite performing complex line-level YAML manipulation.Full Analysis Report
Current State Assessment
Metrics Collected:
ContainsExpectedCodemodstestFindings
Strengths
TestGetAllCodemods_InExpectedOrderenforces exact ordering — reordering fails immediately.TestGetAllCodemods_NoduplicateIDsprevents ID collisions.Areas for Improvement
TestGetAllCodemods_ContainsExpectedCodemodsinpkg/cli/fix_codemods_test.go.applied == falseon a second run against already-transformed output.Detailed Analysis
20 IDs missing from
ContainsExpectedCodemods:add-comment-discussion-removal,mcp-mode-to-type-migration,install-script-url-migration,bash-anonymous-removal,activation-outputs-to-sanitized-step,roles-to-on-roles,bots-to-on-bots,engine-steps-to-top-level,assign-to-agent-default-agent-to-name,playwright-allowed-domains-migration,expires-integer-to-string,app-to-github-app,github-app-app-id-to-client-id,github-repos-to-allowed-repos,features-cli-proxy-to-tools-github-mode,features-difc-proxy-to-tools-github,sandbox-mcp-container-removal,sandbox-mcp-version-removal,sandbox-agent-false-removal,run-install-scripts-to-runtimes-node.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Expand
TestGetAllCodemods_ContainsExpectedCodemodsto Cover All 62 IDsPriority: High | Effort: Small | Focus Area: Registry Drift
Description: Add the 20 missing codemod IDs to the
expectedIDsslice inTestGetAllCodemods_ContainsExpectedCodemods(pkg/cli/fix_codemods_test.go, lines 64–116).Acceptance Criteria:
expectedIDs(not 42)go test ./pkg/cli/... -run TestGetAllCodemods_ContainsExpectedCodemods -tags "!integration"passesCode Region:
pkg/cli/fix_codemods_test.goTask 2: Add Idempotency Tests to 5 High-Risk Codemods
Priority: High | Effort: Medium | Focus Area: Codemod Correctness
Description: No codemod verifies that a second apply is a no-op. Add a
TestXxx_Idempotencyto:codemod_activation_outputs_test.go,codemod_steps_run_secrets_env_test.go,codemod_checkout_persist_credentials_false_test.go,codemod_permissions_test.go,codemod_mcp_network_test.go. Each test should apply the codemod twice and assertapplied == falseand identical output on the second call.Acceptance Criteria:
TestXxx_Idempotencyfunctionapplied == falseandresult1 == result2go test ./pkg/cli/... -run Idempotency -tags "!integration"passesCode Region:
pkg/cli/codemod_activation_outputs_test.go,pkg/cli/codemod_steps_run_secrets_env_test.go,pkg/cli/codemod_checkout_persist_credentials_false_test.go,pkg/cli/codemod_permissions_test.go,pkg/cli/codemod_mcp_network_test.goTask 3: Add Fuzz Tests for roles, bots, engine-steps Codemods
Priority: Medium | Effort: Medium | Focus Area: Fuzz Coverage
Description: Create
codemod_roles_fuzz_test.go,codemod_bots_fuzz_test.go,codemod_engine_steps_fuzz_test.gofollowing the pattern incodemod_checkout_persist_credentials_false_fuzz_test.go. Each needs 3 seed corpus entries and must asserterr == nil.Acceptance Criteria:
pkg/cli///go:build !integrationand ≥3 seed entriesgo test ./pkg/cli/ -fuzz=FuzzRolesCodemod -fuzztime=5sdoes not panicCode Region:
pkg/cli/codemod_roles.go,pkg/cli/codemod_bots.go,pkg/cli/codemod_engine_steps.goTask 4: Refactor
ContainsExpectedCodemodsto Derive fromexpectedCodemodOrder()Priority: Medium | Effort: Small | Focus Area: Drift Prevention
Description: Replace the static 42-entry
expectedIDsslice with a bidirectional check againstexpectedCodemodOrder(), so new codemods added toGetAllCodemods()without updating the order list fail the test immediately.Acceptance Criteria:
TestGetAllCodemods_ContainsExpectedCodemodsno longer has a static partial listGetAllCodemods()withoutexpectedCodemodOrder()fails both testsgo test ./pkg/cli/... -run TestGetAllCodemods -tags "!integration"passesCode Region:
pkg/cli/fix_codemods_test.go(TestGetAllCodemods_ContainsExpectedCodemods)📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
ContainsExpectedCodemods— Priority: HighShort-term Actions (This Month)
ContainsExpectedCodemods(Task 4) — Priority: Medium📈 Success Metrics
Next Steps
References:
Generated by Repository Quality Improvement Agent
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgSee Network Configuration for more information.
Beta Was this translation helpful? Give feedback.
All reactions