Upload preference receipt helpers #461
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.
Related Issues
This pull request introduces a new set of utilities for handling and aggregating receipt files in the consent upload-preferences workflow. The main changes add functions to summarize receipt data, read failing updates, resolve receipt file paths, and apply these summaries to overall totals. Comprehensive unit tests are included for these new utilities. Additionally, there is a minor update to the way Node.js core modules are imported for consistency.
Receipt utilities and aggregation:
applyReceiptSummaryfunction, which merges receipt summary data into an aggregation object and collects failing updates. This function supports both upload and check modes and handles dry runs.summarizeReceiptutility to parse receipt JSON files and return dashboard counters, supporting both upload and check modes.readFailingUpdatesFromReceiptto extract rows of failing updates from a receipt file, including error details and source file context.resolveReceiptPathto locate the correct receipt JSON file for a given input, handling suffixes and selecting the most recent file.receipts/index.tsto export all new utilities for easier use elsewhere in the codebase.Testing:
applyReceiptSummaryandreadFailingUpdatesFromReceipt, covering merging logic, error handling, and edge cases. [1] [2]