Conversation
* fix: preserve requested transaction filter across pagination
`TransactionPreviewsBatch.next_batch()` re-derived the filter from `self.filter`,
which is scraped from the response HTML. FunPay omits the hidden `filter` input in
some responses, so `self.filter` became `None` and `self.filter or ''` silently
widened the filter to `TransactionFilter.ALL` — every page after the first returned
the entire transaction feed instead of the requested category.
`TransactionFilter.ALL` is `''` and therefore falsy, so no `or`-based fallback on
this enum can distinguish "no filter" from "unknown filter".
Thread the requested filter through the method context, the same way `GetSales`
threads `order_preview_type`, and let `next_batch()` fail loudly on an unknown
filter instead of defaulting to the widest one — mirroring
`OrderPreviewsBatch.next_batch()`.
- `GetTransactions` now passes `context={'transaction_filter': ...}`.
- `TransactionPreviewsBatch` prefers the requested filter over the scraped one.
- `next_batch()` raises `ValueError` when the filter is unknown.
- `GetTransactionsPage` marks its batch as `ALL` (the balance page is unfiltered).
- `GetTransactions()` no longer fails validation when called without arguments
(`from_transaction_id` defaulted to `None` against an `int` field).
Adds a regression suite covering the end-to-end path with a response that has no
hidden `filter` input.
* chore: remove pagination filter tests
Requested by maintainer.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: drop pytest config from pyproject
Requested by maintainer.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor: stamp transaction filter on the batch instead of the validation context
Passing the requested filter through the pydantic validation context leaked it to
every nested model: pydantic hands the same context object to each nested
`model_validate`, so `header`, `app_data`, every `MoneyValue` and every
`TransactionPreview` saw `transaction_filter`, not just the batch it belongs to.
Stamp the filter directly on the batch in the building method instead:
- `GetTransactions.transform_result` sets `batch.filter` to the requested filter.
- `GetTransactionsPage.transform_result` marks its nested batch as `ALL`.
- Drop the context-reading `model_post_init` from `TransactionPreviewsBatch`; the
HTML-scraped value stays as a fallback for hand-built objects.
The validation context now carries only `bot`. Filter propagation is verified
end-to-end against a response with no hidden `filter` input.
* small improvements
* moved filter logic to method init
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: qvvonk <qvvonk@gmail.com>
Scope reduced to what dev still needs: the `mypy --strict` work this branch carried has since landed on dev, and the transaction-filter fix moved to the reviews/transactions pagination PR. What is left is the one file that still breaks `ruff check` and `ruff format --check`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ruff check pass again
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что изменилось по сравнению с исходной версией PR
Ветка была открыта, когда
ruff check,ruff format --checkиmypy --strictпадали на всём проекте. С тех пор эта работа приехала на
devсо сторонымейнтейнера: на
0.10.0rc3mypy --strictчист, аruffспотыкается ровнона одном файле.
Поэтому PR ужат до этого остатка. Второй коммит ветки — фикс потери фильтра
транзакций при пагинации (#40) — на
devне приезжал и переехал в#41, где он лежит
рядом с таким же фиксом для отзывов.
Что осталось
make ciпрогоняетruff checkиruff format --check, и оба падают наfunpaybotengine/types/offers.py:typing_extensions.Selfимпортируется, но не используется (F401);ruff format.Диф — 5 строк в одном файле, поведение не меняется.
Проверки
🤖 Generated with Claude Code