Refactor three pkg/workflow largefunc hotspots into local helpers#43195
pkg/workflow largefunc hotspots into local helpers#43195Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Hey
If you'd like a hand completing this, here's a ready-to-use prompt:
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/workflow largefunc hotspots into local helpers
PR Triage
Breakdown: Extracts 3 Next: Promote to ready when tests confirm no regressions; consider batching with other lint-monster refactors.
|
There was a problem hiding this comment.
Pull request overview
This pull request refactors three pkg/workflow “largefunc” hotspots by extracting local helper functions while aiming to preserve existing behavior, and adds targeted regression tests around the refactored flows.
Changes:
- Extracted per-input schema construction into helpers for
buildInputSchema. - Split Antigravity bash tool expansion into
appendAntigravityBashToolsplus a dedicated wildcard detector. - Extracted embedded action pin resolution from
ActionResolver.ResolveSHAintoresolveFromEmbeddedPins, and added regression coverage around cache non-persistence.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/build_input_schema.go | Extracts per-input schema building into helper functions. |
| pkg/workflow/build_input_schema_test.go | Adds coverage for invalid choice.options shape falling back to plain string schema. |
| pkg/workflow/antigravity_tools.go | Extracts bash tool mapping/wildcard detection into helpers. |
| pkg/workflow/antigravity_engine_test.go | Adds coverage for ignoring non-string bash command entries during tool expansion. |
| pkg/workflow/action_resolver.go | Extracts embedded-pin lookup into a dedicated resolver helper. |
| pkg/workflow/action_resolver_test.go | Adds regression coverage ensuring embedded pins do not write to the on-disk action cache. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Low
| inputType = "string" | ||
| inputDescription, inputRequired := getInputSchemaMetadata(inputName, inputDefMap, descriptionFn) | ||
| if typeStr, ok := inputDefMap["type"].(string); ok { |
There was a problem hiding this comment.
Fixed in the latest commit. Changed := to var inputDescription string + = assignment so inputRequired correctly assigns to the named return variable without shadowing.
|
@copilot please run the
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…ionPinByRepo, add ADR, fix pre-existing lint/golden issues Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Done:
CI needs a human re-trigger (close/reopen or |
This trims a small slice of the function-length backlog in
pkg/workflowby removing threelargefuncfindings without changing behavior. The refactor stays local to the existing package and focuses on helper extraction around existing control flow.Action resolver
ResolveSHAinto a dedicated helper.Antigravity tool mapping
computeAntigravityToolsCoreinto focused helpers.run_shell_command(...)generation unchanged, including normalization of entries likejq *.Input schema generation
buildInputSchema.description,required) from property assembly.number,boolean,choice, and fallback-to-string cases.Targeted regression coverage
choice.optionsshapes falling back to plain string properties.Example of the extracted
ResolveSHAflow: