Skip to content

Fix Reports API status check to recognize DONE instead of COMPLETED - #68

Merged
crakter merged 1 commit into
masterfrom
claude/pending-reports-logic-error-bdy25g
Jul 23, 2026
Merged

Fix Reports API status check to recognize DONE instead of COMPLETED#68
crakter merged 1 commit into
masterfrom
claude/pending-reports-logic-error-bdy25g

Conversation

@crakter

@crakter crakter commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What

Fixed the ReportStatusResponse::isReady() method to correctly recognize Bring's actual report completion status (DONE) instead of the non-existent statuses (COMPLETED/READY). Also fixed the downloadUrl fallback logic to properly use xmlUrl and xlsUrl fields from the actual API response.

Why

The previous implementation checked for COMPLETED or READY statuses that Bring's Reports API never returns. The actual API returns NOT_DONE while generating and DONE when ready. This caused all polled reports to appear perpetually unfinished, allowing pending-report tables to accumulate rows that were never collected.

Additionally, the real API response exposes the finished report location via xmlUrl/xlsUrl fields, not downloadUrl. The fallback logic now correctly chains through these fields so the download URL isn't perpetually null on real responses.

Test plan

  • Added comprehensive unit tests in ReportStatusResponseTest.php covering:
    • DONE status recognition as ready
    • NOT_DONE status as not ready
    • Case-insensitive status matching
    • Missing status handling
    • Download URL fallback chain (downloadUrlxmlUrlxlsUrl)
    • Regression test for previously non-functional statuses (COMPLETED, READY)

Bring docs link

https://developer.bring.com/api/reports

https://claude.ai/code/session_01JjoZoqzCvueSLzHbbhMo1Z

ReportStatusResponse::isReady() checked the report status against
COMPLETED / READY, but Bring's Reports API never returns those values.
It reports NOT_DONE while a report is still generating and DONE once it
is ready to download (the same contract the legacy StatusOfReport client
encodes with `getStatus() === 'DONE'`).

Because isReady() never matched a real response, every polled report
looked perpetually unfinished: pending-report pollers downloaded and
processed nothing and never flipped their tracking rows off `pending`,
so the tracking table filled with reports that were never collected.

Match the real API by treating DONE (case-insensitively) as ready. Also
fall back through the real xmlUrl / xlsUrl fields when mapping the
download URL, since Bring has no `downloadUrl` field. Adds a regression
test covering the ready/not-ready statuses and the URL fallback.
@crakter
crakter merged commit 25b5802 into master Jul 23, 2026
18 checks passed
@crakter
crakter deleted the claude/pending-reports-logic-error-bdy25g branch July 23, 2026 21:34
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.

2 participants