Skip to content

refactor: change build strategy to merge#195

Merged
negarciacamilo merged 4 commits intomainfrom
feat/mockery-merge-logic
Feb 25, 2026
Merged

refactor: change build strategy to merge#195
negarciacamilo merged 4 commits intomainfrom
feat/mockery-merge-logic

Conversation

@negarciacamilo
Copy link
Contributor

Description

Se mergean todos los pkg en uno solo para performance

image

danteay
danteay previously approved these changes Feb 25, 2026
Copy link
Collaborator

@danteay danteay left a comment

Choose a reason for hiding this comment

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

LGTM -- solid refactor that replaces the concurrent multi-process mockery strategy with a single merged invocation. The ~270 net lines removed (concurrency plumbing, goroutine pool, semaphore, progress channels) are replaced by a much simpler merge-then-execute-once approach. CI checks pass.

A few non-blocking suggestions:

1. Potential temp file leak on createSingleTempConfig failure
In Exec(), defer m.cleanup() is declared after createSingleTempConfig() returns. If that function partially writes a temp file (it appends to m.tmpFiles before returning) and then fails, the defer is never registered. Consider moving defer m.cleanup() earlier in Exec(), e.g., right before the merge/create calls.

2. Redundant doneChan in runSingleInvocation
Both the spinner path (spin.Action(...).Run()) and the non-TTY path are synchronous, so <-doneChan is always a no-op by the time it's reached. The channel + goroutine pattern could be simplified by removing doneChan entirely and calling the work function directly.

3. Empty packages edge case
If all package configs lack a packages key (or it's not a map), mergeSingleConfig returns a config with no packages. Mockery will run with nothing to do. A warning or early return might be helpful.

4. Backward compatibility of --jobs-num removal
Worth verifying that no CI scripts or Makefiles in consuming repos pass --jobs-num / -j, as they would break with an "unknown flag" error.

Overall this is a clean improvement. Nice work.

Copy link
Collaborator

@danteay danteay left a comment

Choose a reason for hiding this comment

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

Second review pass -- all four suggestions from the first review have been properly addressed:

  1. Temp file leak -- defer m.cleanup() is now placed before createSingleTempConfig() with an explanatory comment. Correct.
  2. Redundant doneChan -- Entire channel/goroutine pattern removed. runSingleInvocation now calls work synchronously in both TTY and non-TTY paths. Clean.
  3. Empty packages edge case -- Explicit hasPackages check with warning and early return added after mergeSingleConfig. Correct.
  4. --jobs-num backward compatibility -- Acknowledged as a coordination concern, not a code defect.

Code quality is solid:

  • mergeSingleConfig correctly deep-merges duplicate package definitions so interfaces from multiple configs are preserved.
  • The overall flow in Exec() reads linearly and is easy to follow.
  • CI checks pass (lint + commit_lint).

Approving.

@negarciacamilo negarciacamilo merged commit b24152c into main Feb 25, 2026
2 checks passed
@negarciacamilo negarciacamilo deleted the feat/mockery-merge-logic branch February 25, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants