Refs #406: Honor activity feed limit#495
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe activity API accepts a validated ChangesActivity pagination limit parameter
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8633b087-ff8d-4e57-86c8-a83497bbbb19
📒 Files selected for processing (3)
app/activity.pyapp/serializers.pytests/test_activity.py
a0fd5e6 to
7f7ef96
Compare
|
Addressed CodeRabbit’s boundary-test request in Change:
Validation:
|
jtc268
left a comment
There was a problem hiding this comment.
Reviewed current head a7aa384bd8477bfd872e7573783b38307eecfa7e.
I would hold this for one public-docs gap before merge: the PR adds a public limit query parameter to both /api/v1/activity and /activity with Query(ge=1, le=100), but docs/api-examples.md still documents only the optional q parameter and the example curls omit limit. The project instructions say docs should be updated when public behavior changes, and an API reader would not learn the default/bounds or that limit slices only the recent rows while totals and contributor rollups still use all matching proof-backed activity.
Suggested fix: add one curl example such as /api/v1/activity?limit=25 and a short sentence that limit defaults to 100, accepts 1..100, and limits the returned recent payment rows.
Validation on this head:
uv run --extra dev python -m pytest tests/test_activity.py -q-> 3 passeduv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check origin/main...HEAD-> clean
|
Addressed the public docs request and the follow-up docs-range assertion warning. Changes:
Validation on
Current readback: CodeRabbit status is pending on the latest head; no additional source change was made beyond the docs assertion. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 238cd423-bc2f-474d-a3f6-62f7010bfbd2
📒 Files selected for processing (1)
tests/test_docs_public_urls.py
rebel117
left a comment
There was a problem hiding this comment.
Reviewed PR #495 at current head for Bounty #447.
Checked files: app/activity.py, app/serializers.py, docs/api-examples.md, tests/test_activity.py, tests/test_docs_public_urls.py.
Evidence:
- Ran the diff against
upstream/mainand inspected all 5 changed files. - Confirmed
activity_to_dictsignature change propagates correctly throughactivity_contextto both API and HTML routes. - Verified the
Annotated[int, Query(ge=1, le=100)]constraint matches the documented range and prevents thelimit=0andlimit=101edge cases covered by the new tests. - Checked that
recent[:recent_limit]replaces the old hard-codedrecent[:100]without changing behavior whenlimitis omitted (defaults to 100). - Confirmed the doc update mentions
limitdefaults to100, accepts1–100, and clarifies that onlyrecentrows are affected. - Checked the new test assertions:
limited_payload["totals"]equals the unfiltered totals (limit does not affect aggregates),invalid_limitreturns 422,invalid_high_limitreturns 422. - Ran
scripts/docs_smoke.pymentally — the newlimitexamples indocs/api-examples.mdare plain text additions, no link changes, so existing link checks are unaffected.
Verdict: Clean, focused PR. No blockers found. The change is backwards-compatible (default behavior preserved) and the test coverage is solid.
|
Added the final docs-range assertion requested by CodeRabbit in Change:
Validation on
No secrets or private data are included. |
Zejia
left a comment
There was a problem hiding this comment.
No blockers from my current-head pass.
I reviewed head 2f55311e5a0d4aec43a5674da5314c200440ce5e. The original docs gap from the earlier review is now covered: docs/api-examples.md documents /api/v1/activity?limit=25, the default 100, the 1..100 range, and that the limit only slices recent rows while totals and contributor rollups still cover all matching proof-backed payments.
Code path checked:
/api/v1/activityand/activityboth acceptlimit: Query(ge=1, le=100)and pass it throughactivity_context(..., recent_limit=limit).activity_to_dict()still builds totals/contributors from the full matched row set, then appliesrecent[:recent_limit]only at the returned recent list.- Tests cover
limit=1, lower boundlimit=0, upper boundlimit=101, and the docs text/range assertions.
Validation:
python -m pytest tests/test_activity.py tests/test_activity_routes.py tests/test_docs_public_urls.py::test_api_examples_document_activity_response_shape -q-> 5 passedpython -m pytest -q-> 414 passedpython scripts/docs_smoke.py-> docs smoke okpython -m ruff check app/activity.py app/serializers.py tests/test_activity.py tests/test_docs_public_urls.py-> passedpython -m ruff format --check app/activity.py app/serializers.py tests/test_activity.py tests/test_docs_public_urls.py-> 4 files already formattedpython -m mypy app-> successgit diff --check origin/main...HEAD-> clean
|
Reviewed PR #495 against the activity limit behavior and docs updates. Evidence checked:
Local verification on the PR branch:
No blocker found from static review. The route validation, serializer behavior, and docs assertions line up with the intended API contract. |
Refs #406
Summary:
limitquery parameter to/api/v1/activityand/activity.recentaccepted-work rows.Evidence:
GET https://api.mrwk.ltclab.site/api/v1/activity?limit=1returnedrecent: 100, the same aslimit=3andlimit=200.GET https://api.mrwk.ltclab.site/api/v1/activity?limit=1&q=github%3AGHX5T-SOLreturned all 9 matching recent rows.Validation:
uv run --extra dev python -m pytest tests/test_activity.py tests/test_activity_routes.py -q-> 4 passeduv run --extra dev python -m pytest -q-> 414 passeduv run --extra dev ruff check app/activity.py app/serializers.py tests/test_activity.py-> passeduv run --extra dev ruff format --check app/activity.py app/serializers.py tests/test_activity.py-> 3 files already formatteduv run --extra dev python -m mypy app-> success, no issues found in 30 source filesuv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check-> cleangit diff --no-ext-diff | gitleaks stdin --no-banner --redact --exit-code 1-> no leaks foundNo secrets, private data, wallet material, signatures, production mutation, price claims, exchange claims, liquidity claims, or off-ramp claims were used.
Summary by CodeRabbit
New Features
limitquery parameter to activity endpoints to control how many recent activities are returned (range: 1–100, default: 100).Bug Fixes
limitand reject out-of-range values;recentresults are capped to the requested size while aggregate totals remain complete.Tests
limitvalidation.Documentation
qfiltering andlimitbehavior.