Fix UI race when showing package count #2839
Merged
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.
Today we show package count on the UI to help the user get a sense of the progress during cataloging:
(note :
Packages [17 packages]
)This value has been found to be inconsistent with the final package count, on subsequent runs showing different values for the same input:
In this particular circumstance two packages identified by the binary cataloger were removed since a more authoritative package type supersedes the binary packages.
The current implementation that tracks package count that drives the UI polls in the background. Ideally the the package count should be event driven when added to the collection, however we don't want bus interactions to be embedded into core objects. For this reason this PR adjusts the package account to be event driven within the internal SBOM builder object. The specific change is to add
onWrite
callbacks that can be provided to the SBOM builder, in which a callback function that updates the monitor object on any write to the SBOM.Fixes #2304