Fix gh aw update dropping object-form (uses/with) imports - #53704
Merged
Conversation
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix update workflows cmd to retain valid imports
Fix Aug 18, 2026
gh aw update dropping object-form (uses/with) imports
mnkiefer
approved these changes
Aug 18, 2026
Collaborator
|
@copilot Please address the remaining merge blockers on this PR, then run the pr-finisher skill and report back with validation results and any remaining blockers. |
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Contributor
Author
Fixed the merge blocker: CI's pr-finisher validation:
Nothing else is actionable from this agent; ready for a maintainer to re-trigger CI and merge. |
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.
gh aw updatecould silently replace a validimports:collection withimports: []when the only entries were object-form (e.g.- uses: shared/control.mdwith awith:map). This broke nested import chains and caused their generated steps (e.g.Precompute control facts) to disappear from the recompiled lock file, even though the upstream import was unchanged.Root cause
processImportsWithWorkflowSpec(pkg/cli/imports.go) rewritesimports:entries to workflowspec format (owner/repo/path@sha) during updates and merges.collectStringImports, which only extracted plain-string entries from theimportsarray and silently dropped object-form entries (uses/with,path/inputs).Fix
collectStringImports+processImportPathswithprocessImportItems, which handles every entry type:path/usesvalue is rewritten,inputs/withand any other keys are preservedaw:subfield) forms ofimports, and guarantees the output list is never shorter than the input — preventing a non-empty imports collection from silently collapsing to[].This entry now survives an update/merge intact instead of vanishing.
Tests
TestProcessImportsWithWorkflowSpec_ObjectFormPreserved— object-form import withwithfields survives rewriting.TestMergeWorkflowContent_PreservesUnchangedObjectFormImports— three-way merge scenario where only the upstream prompt body changes and nested frontmatter imports remain unchanged.