Skip to content

feat: add dry-run mode to ledger backfill tool (#1182) - #1289

Open
0xjerah wants to merge 3 commits into
Pulsefy:mainfrom
0xjerah:feat/1182-ledger-backfill-dry-run
Open

0xjerah wants to merge 3 commits into
Pulsefy:mainfrom
0xjerah:feat/1182-ledger-backfill-dry-run

Conversation

@0xjerah

@0xjerah 0xjerah commented Sep 27, 2026

Copy link
Copy Markdown

Summary

  • Adds a dryRun flag to LedgerBackfillService.triggerBackfill that previews what a backfill run would create/update without persisting anything or enqueuing a job
  • Extracts the read/detection logic (existing-entry lookup + on-chain fetch) into a shared detectLedgerRange helper used by both the real run (processLedgerRange) and the new preview path (previewBackfill), so dry-run and real-run behavior can't drift apart
  • Dry-run output includes total counts, counts grouped by ledger entity type (eventType: lock/unlock/disburse), and a capped sample (20 records) of affected entries
  • Wires dryRun through POST /admin/ledger/backfill on LedgerAdminController and updates the Swagger docs
  • Documents the new flag and response shape in app/backend/README.md's existing Ledger Backfill usage notes

Closes #1182

Test plan

  • npx jest ledger-backfill.service.spec.ts — all 13 tests pass, including new dry-run coverage (no checkpoint/job created, counts and sample match detected entries)
  • tsc --noEmit — no type errors in changed files

Adds a dryRun flag to triggerBackfill that reports what a run would
create/update (counts by entity type plus a sample of affected
records) without persisting anything or enqueuing a job. The dry-run
and real run share the same read/detection logic via a new
detectLedgerRange helper, so the preview cannot drift from reality.
@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@0xjerah 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

@Cedarich

Copy link
Copy Markdown
Contributor

Hi @0xjerah - CI is failing on build-and-test, at the lint step - three prettier/prettier formatting errors in app/backend/src/onchain/ledger-backfill.service.ts (lines 112, 355, 543), all multi-line-wrapping issues on parameter/type lists.

These are auto-fixable. From app/backend, run:

eslint "src/onchain/ledger-backfill.service.ts" --fix

(or just pnpm --filter backend run lint, which runs with --fix already) and commit the result. No logic changes needed.

Auto-fixed multi-line parameter/type wrapping flagged by CI lint step.
@0xjerah

0xjerah commented Sep 28, 2026

Copy link
Copy Markdown
Author

Hi @Cedarich Done

…ckfill-dry-run

# Conflicts:
#	app/backend/src/onchain/ledger-backfill.service.ts
@0xjerah

0xjerah commented Oct 8, 2026

Copy link
Copy Markdown
Author

@Cedarich Please kindly review and merge. I have fixed everything

This branch has not been deployed

No deployments
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.

Add a Dry-Run Mode to the Ledger Backfill Tool

2 participants