refactor(render): migrate phases 1 and 3 to parmap.Map#173
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the component render/update parallel phases to use a new bounded parallel map helper (internal/utils/parmap.Map) instead of hand-rolled semaphore + goroutine + channel patterns.
Changes:
- Added
internal/utils/parmappackage (errgroup + SetLimit) with per-item ordered results and a “cancelled-before-start” signal. - Migrated
component renderphase 1 (prepare) and phase 3 (finish) toparmap.Map. - Migrated
component updateparallel source-identity resolution toparmap.Map, including a synchronous pre-filter step for “fresh” components.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/utils/parmap/parmap.go | New bounded parallel map helper used by render/update refactors |
| internal/utils/parmap/parmap_test.go | Unit tests for parmap.Map behavior (ordering, limits, cancellation, progress) |
| internal/app/azldev/cmds/component/render.go | Refactors render phases 1 & 3 to use parmap.Map |
| internal/app/azldev/cmds/component/update.go | Refactors parallel identity resolution to use parmap.Map + pre-filter |
| go.mod | Adds golang.org/x/sync dependency |
| go.sum | Adds checksums for golang.org/x/sync |
d522650 to
1c52356
Compare
1c52356 to
8e7782f
Compare
Contributor
Author
|
@copilot resolve the merge conflicts in this pull request |
Replaces the hand-rolled semaphore + waitgroup + resultsChan pattern in both `parallelPrepare` (phase 1) and `parallelFinish` (phase 3) with calls to `parmap.Map`. - Drops the `prepWithSemaphore` indirection in phase 1; the worker is now just `prepareOneComponent` (validate + prepare). - Drops the semaphore parameter from `finishOneComponent` and the trailing manual fanout loop in phase 3. - Removes the `prepResult.index` field — parmap returns results in input order, so callers index into them directly. - Cancellation-before-start (worker never invoked) surfaces via `Result.Cancelled` and is mapped to `renderStatusCancelled` at the loop callsites, matching the pre-refactor behaviour. - Drops the unused `sync` import; adds `context` and `parmap`. No behaviour change. `mage unit` + `mage scenario` pass.
8e7782f to
a149660
Compare
reubeno
approved these changes
May 13, 2026
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.
Replaces the hand-rolled semaphore + waitgroup + resultsChan
pattern in both
parallelPrepare(phase 1) andparallelFinish(phase 3) with calls toparmap.Map.prepWithSemaphoreindirection in phase 1; theworker is now just
prepareOneComponent(validate + prepare).finishOneComponentandthe trailing manual fanout loop in phase 3.
prepResult.indexfield — parmap returns resultsin input order, so callers index into them directly.
Result.Cancelledand is mapped torenderStatusCancelledat the loop callsites, matching the pre-refactor behaviour.
syncimport; addscontextandparmap.No behaviour change.
mage unit+mage scenariopass.