docs(v4): document /v4/activity endpoint#88
Merged
escapedcat merged 1 commit intoApr 20, 2026
Conversation
The activity feed endpoint was shipped without a corresponding doc (same as #86's top-editors). Adds docs/rest/v4/activity.md covering parameters (days / area / areas / places), response shape, examples, and error cases, plus a link in the v4 README under "Implemented". Includes the `?places=` parameter added in #87, so this branch should merge after that one. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
dadofsambonzuki
approved these changes
Apr 20, 2026
escapedcat
added a commit
that referenced
this pull request
Apr 21, 2026
* feat(v4): add places filter to /v4/activity endpoint Accepts ?places=id1,id2 alongside existing ?areas= and ?area= params. Place IDs union with area-derived element IDs via HashSet so events covered by both a saved area and an explicitly saved place inside it are deduped naturally. When places are provided, event and comment fetches switch from the per-area optimized query to a global query + post-filter by the combined element set; boost filtering already goes through in_filter (renamed from in_area). Motivation: the FE will introduce a /user/activity page combining a signed-in user's saved places and saved areas into one feed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(v4): update stale in_area comment to in_filter The helper was renamed when places were added to the element filter; the boost comment still referenced the old name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(v4): reject unparseable places values with 400 Previously, ?places=foo silently dropped the invalid segment and fell through to an unfiltered global response — surprising behavior when the caller expects the filter to take effect. Switch filter_map(...ok()) to collect::<Result<_,_>>()? and return 400 Invalid Input on any non-integer segment. Mirrors how ?areas= 404s on an unknown area. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(v4): cap days window on /v4/activity at 3650 The endpoint is unauthenticated and select_created_between scans all events in the window. Without a ceiling on days, ?days=36500 forces a 100-year scan. Require 1 <= days <= 3650 (10y) and return 400 otherwise. 3650 leaves generous headroom for the area-feed UI's 30-day pagination (≈120 load-mores of headroom) while closing the unbounded-range DoS path; this also protects the pre-existing global fetch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(v4): cap places list length on /v4/activity at 500 An unbounded places list lets a caller build an arbitrarily large HashSet<i64> from query input. 500 covers realistic power-user saved lists (the planned /user/activity page on the FE); callers with more can fall back to saving the containing area. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(v4): parse places into HashSet to dedupe on input Addresses Copilot review on PR #87: - discussion_r3108284219: collect directly into HashSet<i64> rather than Vec then insert, removing the redundant conversion. - discussion_r3108284246: MAX_PLACES now caps unique IDs, so a request like places=1,1,1,... is no longer rejected on dup-inflated length. No behavior change for well-formed input; HashSet iteration order is non-deterministic but subsequent code only unions into another HashSet and final results are sorted by created_at. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(v4): cap places token count before parsing Addresses CodeRabbit review on PR #87 (discussion_r3108325028): enforce MAX_PLACES on the raw comma-separated token count before building the HashSet, so a pathological input can't allocate a large intermediate set before the guard rejects. Trade-off noted: this reverts the "unique IDs" framing from the prior commit. Legitimate clients (the planned /user/activity page joining session.savedPlaces) don't send duplicates, so a raw-token cap is correct in practice and closes the allocation window. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(v4): clarify places cap error message Addresses CodeRabbit nit on PR #87 (discussion_r3108598972): the cap is enforced on raw comma-separated tokens, but the error message said "IDs" which implies a uniqueness-aware limit. Switch to "comma-separated values" so the message matches what's actually counted. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(v4): document /v4/activity endpoint (#88) The activity feed endpoint was shipped without a corresponding doc (same as #86's top-editors). Adds docs/rest/v4/activity.md covering parameters (days / area / areas / places), response shape, examples, and error cases, plus a link in the v4 README under "Implemented". Includes the `?places=` parameter added in #87, so this branch should merge after that one. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
The activity feed endpoint was shipped without a corresponding doc (same as #86's top-editors). Adds docs/rest/v4/activity.md covering parameters (days / area / areas / places), response shape, examples, and error cases, plus a link in the v4 README under "Implemented".
Includes the
?places=parameter added in #87, so this branch should merge after that one.