Skip to content

Conversation

@michaelfarrell76
Copy link
Member

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:

  • Added applyReceiptSummary function, 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.
  • Added summarizeReceipt utility to parse receipt JSON files and return dashboard counters, supporting both upload and check modes.
  • Added readFailingUpdatesFromReceipt to extract rows of failing updates from a receipt file, including error details and source file context.
  • Added resolveReceiptPath to locate the correct receipt JSON file for a given input, handling suffixes and selecting the most recent file.
  • Updated receipts/index.ts to export all new utilities for easier use elsewhere in the codebase.

Testing:

  • Added thorough unit tests for applyReceiptSummary and readFailingUpdatesFromReceipt, covering merging logic, error handling, and edge cases. [1] [2]

@linear
Copy link

linear bot commented Aug 19, 2025

@michaelfarrell76 michaelfarrell76 force-pushed the michaelfarrell76/receipts-helpers branch from 3eb62c4 to 64e2de1 Compare August 19, 2025 03:45
@michaelfarrell76 michaelfarrell76 merged commit 92f2a2e into main Aug 19, 2025
11 checks passed
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.

3 participants