Skip to content

fix(sdk): reach the head of account history and keep the savings fill on its own asset - #1404

Merged
feruzm merged 2 commits into
developfrom
bugfix/sdk-account-history-tail
Aug 11, 2026
Merged

fix(sdk): reach the head of account history and keep the savings fill on its own asset#1404
feruzm merged 2 commits into
developfrom
bugfix/sdk-account-history-tail

Conversation

@feruzm

@feruzm feruzm commented Aug 11, 2026

Copy link
Copy Markdown
Member

Two follow-ups to #1396. Both are in the SDK wallet queries, both are covered by tests that fail without the source change.

Fixes #1401
Fixes #1402

1. The walk could not reach the head of history

condenser_api.get_account_history asserts start >= limit - 1, since start is a 0-based index and the node walks limit entries back from it. The cursor added in #1396 is derived from num alone, so the last window before the start of history is necessarily shorter than limit and the request failed the assert instead of returning what was left.

The web wallet pages use limit: 1000, so this is two or three "load more" clicks away on a small account. Walking the merged cursor against a node:

step 0: start=1500 limit=1000 -> 1000 rows, num 501..1500
step 1: start=500  limit=1000 -> RPC ERROR:
        Assert Exception:args.start >= args.limit-1

Now the requested limit is narrowed to pageParam + 1 for that window, which asks for exactly the remaining rows:

start=500 limit=501 -> 501 rows, num 0..500, terminates

initialPageParam is -1, which is a sentinel rather than an index, so it passes through untouched and the first page still asks for the full limit. The cursor itself is unchanged. HBD and HP spread the HIVE options, so all three inherit this.

2. fill_transfer_from_savings ignored the per-asset filter

The operation was added to the fetch layer in #1396 but had no case in the per-asset select switches, so it reached the widened default:

default:
  return requestedOperations.has(item.type);

which keeps anything the caller named and never looks at the symbol. Picking Fill transfer from savings on the HIVE wallet also listed completed HBD withdrawals, rendered with their HBD amount, and the reverse on the HBD wallet. It now carries the same guard transfer_from_savings already had in both files.

Only reachable through an explicit filter pick, since an unfiltered request still falls through to false.

Also

collectRequestedOperations was documented as ignoring group aliases while it actually keeps them. Harmless, because a group name never equals an operation name, so the comment is what changed.

Verification

  • pnpm --filter @ecency/sdk test — 712 passed (50 files). Six new cases in account-history-pagination.spec.ts cover the sentinel passing through, a full window being left alone, the narrowed final window, the start >= limit - 1 invariant across the cursor values the walk can emit, and the HIVE/HBD symbol split for fill_transfer_from_savings. Reverting the two source files leaves exactly those six red.
  • pnpm typecheck — clean across packages and apps/web.
  • pnpm lint — clean, only the pre-existing a11y warnings in apps/web.

dist/ is not rebuilt here, that stays label-gated. Mobile is on @ecency/sdk@2.3.80, so this needs a release before ecency/vision-mobile#3480 picks it up.

… on its own asset

Two follow-ups to #1396.

condenser_api.get_account_history asserts start >= limit - 1. The cursor is
derived from num alone, so the last window before the start of history is
shorter than limit and the request failed the assert instead of returning the
rows that were left. The web wallet pages use limit 1000, so a small account hit
it a couple of "load more" clicks in. Narrow the requested limit to pageParam + 1
for that window; the -1 sentinel is not an index and passes through untouched.

fill_transfer_from_savings had no case in the per-asset select switches, so it
fell to the default, which keeps anything the caller named and never checks the
symbol. Filtering for it on the HIVE wallet also listed completed HBD
withdrawals, and the reverse on HBD. Give it the same guard transfer_from_savings
already has in both files.

Also corrects the collectRequestedOperations doc comment, which said it ignores
group aliases while it keeps them (harmless, they never match an operation name).

Fixes #1401
Fixes #1402
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@feruzm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d414b3bb-0269-42ac-b3f7-9b2990dd75a8

📥 Commits

Reviewing files that changed from the base of the PR and between 0f7f1cf and b36dca8.

📒 Files selected for processing (3)
  • packages/sdk/src/modules/wallet/queries/account-history-pagination.spec.ts
  • packages/sdk/src/modules/wallet/queries/get-hbd-asset-transactions-query-options.ts
  • packages/sdk/src/modules/wallet/queries/get-hive-asset-transactions-query-options.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@feruzm feruzm added the patch Bug fixes and patches (1.0.0 → 1.0.1) label Aug 11, 2026
@feruzm
feruzm merged commit 7db3a7a into develop Aug 11, 2026
3 checks passed
@feruzm
feruzm deleted the bugfix/sdk-account-history-tail branch August 11, 2026 12:30
feruzm added a commit to ecency/vision-mobile that referenced this pull request Aug 11, 2026
Picks up the account-history follow-ups from ecency/vision-web#1404, on top of
the pagination fix #3480 already relies on.

- the history walk can reach the head of an account's history instead of
  failing the node's `start >= limit - 1` assert on the last page
- `fill_transfer_from_savings` is filtered by asset, so the HIVE list no longer
  shows completed HBD savings withdrawals and the reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1)

Projects

None yet

1 participant