refactor(workflow): extract helpers to fix function-length lint violations#44008
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…r helpers Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
🤖 PR Triage · Run §28868091227
Score breakdown: Impact 10 · Urgency 5 · Quality 13 Rationale: Draft. Extracts helpers from 4 over-limit functions in Labels:
|
|
✅ PR Code Quality Reviewer completed the code quality review. |
|
✅ Test Quality Sentinel completed test quality analysis. No test files were added or modified in this PR. Test Quality Sentinel skipped. |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. |
There was a problem hiding this comment.
Pull request overview
Refactors several pkg/workflow functions that slightly exceeded the largefunc lint limit by extracting focused, package-private helpers while preserving existing behavior and keeping the logic co-located.
Changes:
- Extracted embedded action-pin semver matching into
lookupEmbeddedActionPinfromActionResolver.ResolveSHA. - Extracted bash neutral-tool expansion into
appendBashToolsfromcomputeAntigravityToolsCore. - Extracted JSON Schema property construction into
buildChoiceInputPropertyandbuildInputPropertyfrombuildInputSchema. - Extracted MCP-tool environment-variable collection into
addMCPToolEnvVarsfromCodexEngine.getShellEnvironmentPolicyVars.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/action_resolver.go | Extracts embedded action-pin lookup into a helper to reduce ResolveSHA length without changing resolution behavior. |
| pkg/workflow/antigravity_tools.go | Extracts bash tool mapping/expansion logic into appendBashTools to shorten computeAntigravityToolsCore. |
| pkg/workflow/build_input_schema.go | Extracts schema property construction helpers to reduce duplication and shorten buildInputSchema. |
| pkg/workflow/codex_engine.go | Extracts MCP tool → required env var mapping into addMCPToolEnvVars to shorten getShellEnvironmentPolicyVars. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Low
There was a problem hiding this comment.
The four extractions are clean behavioral-preserving refactors. Each helper is well-named, co-located, and package-private.
Specifically verified:
lookupEmbeddedActionPin: semver loop moved intact;resolverLogis package-level and accessible.appendBashTools: early-return on wildcard is equivalent to the originalhasWildcardflag — per-command iteration is correctly skipped in both cases.buildChoiceInputProperty:(nil, false)fall-through preserves the original "no options → scalar string" path.addMCPToolEnvVars: noCodexEnginefields used; correctly promoted to a package-level function.
No behavior changes detected. LGTM.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 26.4 AIC · ⌖ 5.79 AIC · ⊞ 4.8K
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (135 new lines in 📄 Draft ADR committed:
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. ❓ Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
PR is merge-ready. Here's the current state:
Hand-off: A maintainer should resolve the two review threads and re-trigger CI (close/reopen or |
|
@copilot please run the
|
No new action needed — the PR remains in the same state as the last run:
Hand-off: A maintainer needs to resolve the two review threads and re-trigger CI before merging. |
|
@copilot please run the Unresolved review threads to address (newest first):
|
Both threads were fully addressed in commit
The threads remain unresolved only because |
|
@copilot please run the
|
No change in state since the last run. All review feedback is addressed in |
|
\n@copilot please run the skill, make this PR merge-ready, address all unresolved review feedback, and rerun checks once the branch is up to date.
|
🤖 PR Triage (updated)
Rationale: Promoted from draft. Clean function-length lint refactor (230+/109−, 6 files). Added to Run §28909358158
|
|
🎉 This pull request is included in a new release. Release: |
Addresses a slice of the
largefunclint backlog (limit: 60 lines) inpkg/workflow. Four functions just over the limit were split into focused helpers with no behavior changes.Extractions
action_resolver.go—ResolveSHA(67→~52 lines): extractedlookupEmbeddedActionPin, which encapsulates the embedded-pin semver matching loopantigravity_tools.go—computeAntigravityToolsCore(65→~35 lines): extractedappendBashTools, which handles the bash neutral-tool →run_shell_commandexpansion including wildcard and per-command casesbuild_input_schema.go—buildInputSchema(69→~56 lines): extractedbuildChoiceInputProperty(enum/choice schema) andbuildInputProperty(scalar schema), removing an inline map-construction block repeated for choice vs. non-choice pathscodex_engine.go—getShellEnvironmentPolicyVars(61→~27 lines): extractedaddMCPToolEnvVars, which owns the switch mapping known MCP tool names (github,agentic-workflows,safe-outputs, custom) to their required environment variablesAll new helpers are package-private and co-located with the refactored function.