Skip to content

Split update-actions implementation into focused modules - #52084

Open
pelikhan with Copilot wants to merge 6 commits into
mainfrom
copilot/file-diet-refactor-update-actions
Open

Split update-actions implementation into focused modules#52084
pelikhan with Copilot wants to merge 6 commits into
mainfrom
copilot/file-diet-refactor-update-actions

Conversation

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

pkg/cli/update_actions.go exceeded the repository file-size threshold and combined release resolution, caching, lockfile updates, and workflow reference rewriting. This refactor separates those responsibilities without changing the public API.

  • Dependency and caching

    • Added update_actions_deps.go for dependency injection and shared GitHub-read memoization.
  • Release resolution

    • Added update_actions_release.go for action classification, API/git release lookup, SHA resolution, and cooldown fallback.
  • Lockfile updates

    • Kept UpdateActions and lockfile orchestration in the reduced update_actions.go.
  • Workflow references

    • Added update_actions_workflow_refs.go for uses: and skill source: updates in workflow Markdown.
// Public entry points remain unchanged.
func UpdateActions(ctx context.Context, allowMajor, verbose, disableReleaseBump bool, coolDown time.Duration) error
func UpdateActionsInWorkflowFiles(ctx context.Context, workflowsDir, engineOverride string, verbose, disableReleaseBump, noCompile bool, coolDown time.Duration, approve bool) error

Run: https://github.com/github/gh-aw/actions/runs/31511130973> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.27 AIC · ⌖ 5.37 AIC · ⊞ 8.5K ·

Comment /souschef to run again

Copilot AI and others added 3 commits August 11, 2026 15:10
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor pkg/cli/update_actions.go into smaller files Split update-actions implementation into focused modules Aug 11, 2026
Copilot AI requested a review from pelikhan August 11, 2026 15:22
@pelikhan
pelikhan marked this pull request as ready for review August 11, 2026 15:29
Copilot AI balanced review requested due to automatic review settings August 11, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors action-update logic into focused modules while preserving public APIs.

Changes:

  • Separates dependency caching, release resolution, and workflow rewriting.
  • Retains lockfile orchestration in update_actions.go.
  • Refreshes unrelated generated workflow version metadata.
Show a summary per file
File Description
pkg/cli/update_actions.go Retains lockfile update orchestration.
pkg/cli/update_actions_deps.go Adds shared dependencies and caching.
pkg/cli/update_actions_release.go Houses release and SHA resolution.
pkg/cli/update_actions_workflow_refs.go Houses workflow reference rewriting.
.github/workflows/daily-pr-review-cursor.lock.yml Updates generated Copilot version metadata.

Review details

Tip

Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Balanced

@@ -1,4 +1,4 @@
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"f51fba46e48ad3e580030bf320ba97a7c033bfb2eed6bb72a787807047d8694a","body_hash":"bf1cf21f4246f5ae31a56495c39972606baec878241331ad7f299696d6230278","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.78","copilot-sdk":"1.0.8"}}
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"f51fba46e48ad3e580030bf320ba97a7c033bfb2eed6bb72a787807047d8694a","body_hash":"bf1cf21f4246f5ae31a56495c39972606baec878241331ad7f299696d6230278","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.79","copilot-sdk":"1.0.8"}}
}
}

// UpdateActions updates GitHub Actions versions in .github/aw/actions-lock.json
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #52084

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.individual.githubcopilot.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.individual.githubcopilot.com"

See Network Configuration for more information.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 67 AIC · ⌖ 6.75 AIC · ⊞ 7.1K
Comment /matt to run again

// the latest major version; pass disableReleaseBump=true to only update core
// (actions/*) references.
func UpdateActionsInWorkflowFiles(ctx context.Context, workflowsDir, engineOverride string, verbose, disableReleaseBump bool, noCompile bool, coolDown time.Duration, approve bool) error {
return updateActionsInWorkflowFiles(ctx, defaultActionUpdateDeps(), updateActionsOptions{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] UpdateActionsInWorkflowFiles passes defaultActionUpdateDeps() (uncached) to the inner function, bypassing the memoization layer built in update_actions_deps.go. When multiple workflow files reference the same actions, this triggers redundant GitHub API calls.

💡 Suggested fix
return updateActionsInWorkflowFiles(ctx, newCachedActionUpdateDeps(defaultActionUpdateDeps()), ...)

update_command.go line 202 already does this correctly — the public entry point should match.

@copilot please address this.

cooldowns := make(map[string]coolDownCheckResult)

cached := base
cached.getLatestRelease = func(ctx context.Context, repo, currentVersion string, allowMajor, verbose bool) (string, string, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] newCachedActionUpdateDeps memoizes getLatestRelease, runGHReleasesAPI, getActionSHAForTag, and checkCoolDown but not getLatestReleaseViaGit. The git-fallback path (triggered when the GitHub API returns an auth error or empty release list) bypasses the cache entirely — a single actions/checkout reference could trigger multiple uncached git ls-remote calls across workflow files.

💡 Suggested fix

Add a memoization wrapper for getLatestReleaseViaGit inside newCachedActionUpdateDeps, keyed on repo|currentVersion|allowMajor.

@copilot please address this.

}
}

// UpdateActions updates GitHub Actions versions in .github/aw/actions-lock.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] The GoDoc block for UpdateActions is placed here in update_actions_deps.go at line 117, but the exported function lives in update_actions.go. Go's documentation tool (go doc) associates a comment block with the immediately following declaration — this comment is not adjacent to the function, so it is orphaned and won't appear in go doc output. The existing review comment on this line confirms the issue; the fix is straightforward.

💡 Suggested fix

Remove the comment block from update_actions_deps.go and place it directly above func UpdateActions in update_actions.go.

@copilot please address this.


type skillRefUpdateResolver func(ctx context.Context, repo, currentRef string, allowMajor, verbose bool, coolDown time.Duration) (string, error)

func updateSkillRefsInContent(ctx context.Context, content string, allowMajor, verbose bool, coolDown time.Duration) (bool, string, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] updateSkillRefsInContent (and its WithResolver variant) does not accept deps actionUpdateDeps, so skill source: updates never use the shared memoized client — each skill ref lookup goes through its own uncached resolveLatestRef path. If a workflow file has both uses: and source: references to the same repo, the API is hit twice.

💡 Suggested fix

Thread deps actionUpdateDeps through updateSkillRefsInContent (and its resolver), or ensure resolveLatestRef internally uses the same cache. The simplest path is to pass deps from updateActionsInWorkflowFiles into updateSkillRefsInContentWithResolver.

@copilot please address this.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Split update-actions implementation into focused modules

The module split is a clean mechanical extraction. All three new files (update_actions_deps.go, update_actions_release.go, update_actions_workflow_refs.go) stay in the cli package so cross-file references to updateLog, cooldownLog, and helper functions resolve correctly. Logic is identical to what was removed from update_actions.go.

Two existing inline comments capture the actionable items already found:

  1. Truncated godoc comment at EOF of update_actions_deps.go — the UpdateActions doc block was moved here but is now detached from the UpdateActions function (which lives in update_actions.go) and ends mid-sentence.
  2. Lock-file version bump in daily-pr-review-cursor.lock.yml is unrelated to this PR scope.

No additional blocking concerns found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 63.8 AIC · ⌖ 6.18 AIC · ⊞ 5.4K

Records the architectural decision to split pkg/cli/update_actions.go
into four focused modules, preserving the public API unchanged.
@github-actions

Copy link
Copy Markdown
Contributor

Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (918 new lines in pkg/cli/) but does not have a linked Architecture Decision Record (ADR).

Draft ADR committed: docs/adr/52084-split-update-actions-into-focused-modules.md — review and complete it before merging.

This PR cannot merge until an ADR is linked in the PR body.

What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI could not infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-52084: Split update-actions Implementation into Focused Modules

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 when they need to understand why the code is structured the way it is.

Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 52084-split-update-actions-into-focused-modules.md for PR #52084).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 · 77.6 AIC · ⌖ 19.7 AIC · ⊞ 8.7K ·
Comment /review to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the open review feedback, refresh the branch if needed, and use the pr-finisher skill before handing back.

Open review threads (newest reviewer feedback first):

No failed checks were reported in the compact candidate set for this run.
Branch update was requested by sous-chef in run https://github.com/github/gh-aw/actions/runs/31511130973.
Please make sure the ADR is linked in the PR body and run the pr-finisher skill before handing back.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.27 AIC · ⌖ 5.37 AIC · ⊞ 8.5K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage: #52084

  • Category: refactor
  • Risk: medium
  • Priority score: 55/100 (impact 20/50, urgency 15/30, quality 20/20) → medium
  • Recommended action: batch_review
  • Batch: deep-report-refactor-cluster (mechanical structural-split/consolidation PRs from the deep-report agent)

Automated triage — see labels for machine-readable classification.

Generated by 🔧 PR Triage Agent · auto · 45 AIC · ⌖ 2.09 AIC · ⊞ 7.8K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[file-diet] File Diet: pkg/cli/update_actions.go exceeds 800-line threshold (1144 lines)

4 participants