Skip to content

[TTAHUB-5374] Fix collab report export#3660

Merged
thewatermethod merged 8 commits into
mainfrom
mb/TTAHUB-5374/collab-reports-export
Jun 4, 2026
Merged

[TTAHUB-5374] Fix collab report export#3660
thewatermethod merged 8 commits into
mainfrom
mb/TTAHUB-5374/collab-reports-export

Conversation

@thewatermethod

Copy link
Copy Markdown
Collaborator

Description of change

The export table isn't operating correctly; when you select export table you get only the first 10 entries. This PR fixes the parameter mismatch causing the issue

We don't currently need to add streaming or other solution to large exports to this, in my opinion. After nearly six months, we have between 100-200 reports and performance is near instantaneous.

How to test

Attempt to export collab reports; observe that all reports are exported.

Issue(s)

Checklists

Every PR

  • Meets issue criteria
  • JIRA ticket status updated
  • Code is meaningfully tested
  • Meets accessibility standards (WCAG 2.1 Levels A, AA)
  • API Documentation updated
  • Boundary diagram updated
  • Logical Data Model updated
  • Architectural Decision Records written for major infrastructure decisions
  • UI review complete
  • QA review complete

Before merge to main

  • OHS demo complete
  • Ready to create production PR

Production Deploy

  • PR created as Draft
  • Staging smoke test completed
  • PR transitioned to Open (this ready_for_review transition triggers the Slack/Jira automation)
  • Reviewer added after the PR is Open (elainaparrish is the authorized approver under normal circumstances)
    • Sequence: Draft PR → Smoke test → Open PR (automation runs) → Add reviewer
    • Confirm that the Slack notification was sent after the PR was opened
    • Confirm that linked Jira ticket(s) transitioned as expected; if not, review the GitHub Actions workflow logs

After merge/deploy

  • Update JIRA ticket status

thewatermethod and others added 2 commits May 28, 2026 18:10
All tests in the getCSVReports describe block now create their own
approved CollabReport records in beforeAll and clean them up in afterAll.
Queries are scoped via 'id.in' to prevent interference from ambient
database state, replacing fragile 'length >= 2' assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes collaboration report CSV export so the backend defaults to returning all matching reports instead of applying the paginated table default.

Impact assessment: Benefits: medium. Risks: low.

Changes:

  • Updates getCSVReports default limit from 10 to 'all'.
  • Adjusts service tests to scope CSV export assertions to dedicated seeded reports.
  • Updates expectations to reflect all matching records being returned by default.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/services/collabReports.ts Changes CSV export default pagination behavior.
src/services/collabReports.test.js Updates CSV export tests and fixtures for the new default behavior.

Comment thread src/services/collabReports.test.js Outdated
…default

Creating only 2 records meant the old REPORTS_PER_PAGE=10 default would
still return all records, so the 'uses default parameters' test passed
regardless of whether the limit was 'all' or 10.

With 11 records (one more than REPORTS_PER_PAGE), arrayContaining(csvReportIds)
can only succeed when the query has no limit — proving getCSVReports truly
omits pagination for CSV exports.

Also updates the sort test's toHaveLength(2) to toHaveLength(csvReportIds.length)
to stay accurate with the larger fixture set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@thewatermethod thewatermethod marked this pull request as ready for review May 28, 2026 23:36
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

⚠️ Review count advisory: 1 of 2 required human approvals. 1 more needed. Current approvers: AdamAdHocTeam.

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

Diff size: 120 lines — within the 500-line guideline.

@thewatermethod thewatermethod added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 9b49e5a Jun 4, 2026
15 checks passed
@thewatermethod thewatermethod deleted the mb/TTAHUB-5374/collab-reports-export branch June 4, 2026 18:17
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

📊 Review Metrics

Auto-generated by the PR Review Metrics workflow. Observe-only — no action required.

Metric Value
PR Status ✅ Merged
Reviewer Count 1
Reviewers @AdamAdHocTeam
First-Review Turnaround 89.6 hr
Total Review Events 1

Review Timeline

State Reviewer Submitted At
✅ APPROVED @AdamAdHocTeam 2026-06-01 17:15 UTC

hardwarehuman pushed a commit that referenced this pull request Jun 4, 2026
* Fix collab report export

* test: make getCSVReports tests self-contained with own fixtures

All tests in the getCSVReports describe block now create their own
approved CollabReport records in beforeAll and clean them up in afterAll.
Queries are scoped via 'id.in' to prevent interference from ambient
database state, replacing fragile 'length >= 2' assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: expand getCSVReports fixtures to 11 records to prove unlimited default

Creating only 2 records meant the old REPORTS_PER_PAGE=10 default would
still return all records, so the 'uses default parameters' test passed
regardless of whether the limit was 'all' or 10.

With 11 records (one more than REPORTS_PER_PAGE), arrayContaining(csvReportIds)
can only succeed when the query has no limit — proving getCSVReports truly
omits pagination for CSV exports.

Also updates the sort test's toHaveLength(2) to toHaveLength(csvReportIds.length)
to stay accurate with the larger fixture set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update collab report model with a transformed virtual field

* Fix unit tests for transformers

* Add encoding, update test

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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