[FEATURE] show a spinner while filtering changed files of a git range

Open Beginner friendly
#2,795 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
git, javascript, node.js

Research direction

Start in lib/util/devops.js at createDeltaPkg and review lib/util/progress.js for createSpinner usage, including the Journey.js example. Run the relevant tests for delta package creation and spinner behavior; verify the spinner starts after the changed-file count, clears before the filtered-file message, and stops on errors without flooding non-TTY logs.

Written by the indexing model from the issue text.

Description

e/DevOps enhancement

What happens

When building a delta package from a git range (mcdev build, buildTemplate/buildDefinition with --range / createDeltaPkg), mcdev prints:

22:07:37 info: Found 6595 changed files in the commit range
22:09:17 info: Identified 882 relevant file changes after filtering file types and folders. Processing related metadata now.

Between these two lines nothing is shown for 1 min 40 s in this real-world example. To the user it looks like mcdev is stuck. Only after that does the Processing changes [...] progress bar appear.

What we want

Show a loading spinner while this step runs, e.g. Filtering changed files..., and stop it right before the Identified … relevant file changes line is printed.

We already have a spinner — reuse it instead of building a new one:

  • lib/util/progress.js → createSpinner() / Spinner (start/stop, cleans up the line on stop)
  • already used in lib/metadataTypes/Journey.js while waiting for journey publishing

Where

lib/util/devops.js, in createDeltaPkg:

  • start the spinner right after Util.logger.info(\Found ${diffSummary.files.length} changed files in the commit range`)`
  • stop it right before Util.logger.info(\Identified ${deltaFiltered.length} relevant file changes …`)`, also on error

Probable cause of the wait (worth a look while in there)

Most of the time is likely spent in filterAssetRegroupingChanges() (same file):

  • for every changed file it calls files.find(...) over all changed files → O(n²) for 6595 files
  • for every matching asset pair it runs two git rev-parse calls, one pair after the other (await inside the for loop), each starting its own git process

The spinner is the quick fix for the user experience. Making this step faster (e.g. a lookup map instead of find, batched or parallel rev-parse with the existing pLimit) can be done in the same ticket or split off.

Acceptance

  • a spinner is visible between the two log lines
  • it is stopped and its line cleared before the next log line / progress bar, also when an error is thrown
  • CI / non-TTY logs (e.g. Copado, pipelines) are not flooded with spinner frames
  • tests still pass
Dominant language
JavaScript
Stars
166
Forks
50
Avg merge
11h 4m
Merged PRs (30d)
36

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Accenture/sfmc-devtools

All issues in Accenture/sfmc-devtools

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.