Skip to content

fix: arweave truncation, GraphQL pagination, versioning in spec, reconciliation re-fetch - #773

Merged
meshackyaro merged 2 commits into
trustflow-protocol:mainfrom
0xpreshh:fix/arweave-truncation-graphql-pagination-versioning-reconciliation
Oct 18, 2026
Merged

meshackyaro merged 2 commits into
trustflow-protocol:mainfrom
0xpreshh:fix/arweave-truncation-graphql-pagination-versioning-reconciliation

Conversation

@0xpreshh

Copy link
Copy Markdown
Contributor

Summary

This PR fixes four bugs across the dispute, escrow GraphQL, reputation, and reconciliation modules.

#756 — ArweaveArchiveService logs truncation but never truncates

The service logged a warning when the archive exceeded 256 KB but passed the full unmodified JSON to the uploader anyway. Now, when the size limit is exceeded, votes is sliced to 10 entries and stepHistory to 20. If the payload is still oversized after that, a minimal stub with only the essential saga identifiers is uploaded and _truncated: true is set so the record is clearly marked incomplete.

#763 — GraphQL escrows query has no pagination

The escrows query returned a flat [EscrowType] array with no way to page through results, unlike every REST list endpoint in the same module. It now accepts offset (default 0) and limit (default 20, max 100) args and returns an EscrowPage object { data, total, offset, limit } — matching the same shape the REST /escrows endpoints use. Integration spec updated accordingly.

#758 — Supertest integration tests always 404 due to missing versioning

The Supertest integration suite in reputation.controller.spec.ts tested against /v1/reputation/* routes but never called app.enableVersioning(), so the version prefix was never registered and every request 404'd. Added app.enableVersioning({ type: VersioningType.URI, defaultVersion: '1' }) before app.init() to mirror what configureApp does in production.

#750 — EscrowReconciliationService re-fetches full escrow list on every batch

The cursor-based pagination loop called this.escrowService.findAll() on every iteration, fetching the entire escrow table repeatedly and slicing with an in-memory offset — O(n²) in the number of batches. Replaced with a single findAll() call followed by an in-memory filter, which is the correct approach given findAll already returns the full dataset.


Closes #756
Closes #763
Closes #758
Closes #750

…nciliation re-fetch

- trustflow-protocol#756: ArweaveArchiveService now actually truncates oversized dispute archives
  instead of only logging a warning; falls back to a minimal stub if still too large
- trustflow-protocol#763: GraphQL escrows query now accepts offset/limit args and returns EscrowPage
  (data, total, offset, limit) matching the REST list pagination contract
- trustflow-protocol#758: Supertest integration tests enable URI versioning on the Nest app so
  /v1/reputation/* routes resolve instead of 404ing
- trustflow-protocol#750: EscrowReconciliationService fetches the full escrow list once and filters
  in-memory, eliminating the O(n) re-fetch loop that called findAll on every batch
@0xpreshh
0xpreshh requested a review from meshackyaro as a code owner October 18, 2026 12:34
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@0xpreshh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@meshackyaro
meshackyaro merged commit 1b26a2d into trustflow-protocol:main Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants