Skip to content

Reduce fetchAndSaveRemoteIncludesWithOptions parameter count with options struct - #54407

Merged
pelikhan merged 2 commits into
mainfrom
copilot/lint-monster-lintmonster-parameter-count-cleanup
Aug 21, 2026
Merged

Reduce fetchAndSaveRemoteIncludesWithOptions parameter count with options struct#54407
pelikhan merged 2 commits into
mainfrom
copilot/lint-monster-lintmonster-parameter-count-cleanup

Conversation

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

LintMonster flagged fetchAndSaveRemoteIncludesWithOptions in pkg/cli/includes.go for exceeding the 9-parameter limit (max 8).

Refactor

  • Introduced includesFetchOptions struct to consolidate the constant parameters (spec, targetDir, verbose, force, tracker, fetchFn, strict), mirroring the existing frontmatterImportsOpts pattern already used elsewhere in the same file.
  • Reduced fetchAndSaveRemoteIncludesWithOptions signature from 9 params down to (ctx, content, opts).
  • Updated the recursive call site and the caller in fetchAllRemoteDependenciesWithOptions to construct/pass includesFetchOptions.
  • Updated existing unit tests in remote_workflow_test.go to use the new signature.
// Before
func fetchAndSaveRemoteIncludesWithOptions(ctx context.Context, content string, spec *WorkflowSpec, targetDir string, verbose bool, force bool, tracker *FileTracker, fetchFn includesFetcher, strict bool) error

// After
func fetchAndSaveRemoteIncludesWithOptions(ctx context.Context, content string, opts includesFetchOptions) error

Behavior is unchanged; the change is scoped strictly to the parameter-count finding and does not touch unrelated largefunc or mutable-state findings in the same package.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor fetchAndSaveRemoteIncludesWithOptions to reduce parameters Reduce fetchAndSaveRemoteIncludesWithOptions parameter count with options struct Aug 21, 2026
Copilot AI requested a review from pelikhan August 21, 2026 02:52
@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: refactor
  • Risk: medium
  • Priority score: 36/100 (impact 25 + urgency 0 + quality 11)
  • Recommended action: defer
  • Batch: refactor-cleanup-cluster
  • CI: no checks reported
  • Draft PR — recommend undrafting before review.

Generated by 🔧 PR Triage Agent · auto · 79.3 AIC · ⌖ 6.15 AIC · ⊞ 8.3K ·

@pelikhan
pelikhan marked this pull request as ready for review August 21, 2026 10:18
Copilot AI balanced review requested due to automatic review settings August 21, 2026 10:18
@github-actions

github-actions Bot commented Aug 21, 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 21, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #54407

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

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

No ADR enforcement needed: PR #54407 does not have the 'implementation' label and has only 56 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Reviewed PR #54407. No actionable blocking issues found in the diff; no PR comments or review submission needed.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@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.

Skills-Based Review 🧠

Applied /codebase-design — approving with one minor observation.

📋 Key Themes & Highlights

Key Themes

  • Struct introduction is well-scoped: includesFetchOptions mirrors the existing frontmatterImportsOpts pattern in the same file, fitting the established convention.
  • Recursive call is cleaner: Passing opts directly removes 7 positional arguments that were previously easy to mis-order.
  • Zero-value booleans in tests: Updated tests correctly omit verbose, force, and strict, taking advantage of Go zero-values.

One minor observation

opts.fetchFn is mutated in the local copy at the top of the function to default to FetchIncludeFromSource. Because opts is passed by value this is safe and correct, but a small inline comment (e.g. // opts is a value copy; mutation is intentional so recursive calls inherit the resolved fetchFn) would make the intent clear to future readers.

Positive Highlights

  • ✅ Behaviour is demonstrably unchanged — the refactor is mechanical.
  • ✅ The struct comment explains why content is the only varying parameter.
  • fetchAllRemoteDependenciesWithOptions call site uses named fields, making the fetchFn: nil omission explicit via zero-value convention.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 15.6 AIC · ⌖ 9.85 AIC · ⊞ 7.8K
Comment /matt to run again

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 remote include fetching to satisfy the parameter-count limit without changing behavior.

Changes:

  • Introduces includesFetchOptions.
  • Updates recursive and test call sites.
Show a summary per file
File Description
pkg/cli/includes.go Consolidates constant fetch parameters into an options struct.
pkg/cli/remote_workflow_test.go Adapts existing tests to the new signature.

Review details

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

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

@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.

Clean refactoring — replacing 9 positional parameters with an options struct improves call-site readability and makes future additions easier. The opts.fetchFn nil-check mutates a local copy (value receiver), so the default is applied correctly without affecting callers. Recursive calls pass the already-populated opts, which is correct. No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 16.4 AIC · ⌖ 8.78 AIC · ⊞ 5.7K

@github-actions github-actions Bot mentioned this pull request Aug 21, 2026
@pelikhan
pelikhan merged commit 241ca7f into main Aug 21, 2026
91 of 101 checks passed
@pelikhan
pelikhan deleted the copilot/lint-monster-lintmonster-parameter-count-cleanup branch August 21, 2026 10:48
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.4

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.

[lint-monster] LintMonster: includes parameter-count cleanup

3 participants