Merged
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Add optional `area` query parameter that accepts an area ID or alias. When provided, the feed is filtered to only show activity for places within that area. Existing behavior (global feed) is unchanged when the parameter is omitted. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Only map QueryReturnedNoRows to 404 for area lookup; other errors (pool exhaustion, DB corruption) correctly propagate as 500. Add tests for comment and boost area filtering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace in-memory filtering with SQL subqueries that filter events and comments by area_element membership at the DB level. This avoids loading the full global dataset when an area is specified. Boosts still use in-memory filtering because the invoice table stores element_id in a description string, not a JOINable column. Extracted an in_area() helper to deduplicate the membership check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move select_created_between_for_area queries from the activity handler into the proper blocking_queries/queries layer for element_event and element_comment. The handler now calls the DB layer like all other endpoints. Also update AGENTS.md to explicitly state that raw SQL must never be embedded in REST/RPC handlers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5ad6bb0 to
aa006e3
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/rest/v4/activity.rs (1)
218-220: Minor inconsistency in time boundary for boosts.The boost time check uses
nowas the upper bound with inclusive comparison (> nowmeans<= nowfor inclusion), while events and comments useperiod_end(now + 1s) with exclusive SQL boundaries (< period_end). This creates a subtle difference where boosts exclude items created exactly atnow, but events/comments include items up to 1 second in the future.For consistency, consider using
period_end:♻️ Optional: Align time boundaries with events/comments
- if created_at < day_ago || created_at > now { + if created_at < day_ago || created_at > period_end { continue; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/rest/v4/activity.rs` around lines 218 - 220, The boost time filter in activity.rs currently uses `if created_at < day_ago || created_at > now { continue; }` which excludes items at exactly `now`; change it to use the same `period_end` upper bound used by events/comments and the same exclusive semantics: replace the check with `if created_at < day_ago || created_at >= period_end { continue; }`, referencing the `created_at`, `day_ago`, and `period_end` variables in the boosts processing logic so boosts align with events/comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/rest/v4/activity.rs`:
- Around line 218-220: The boost time filter in activity.rs currently uses `if
created_at < day_ago || created_at > now { continue; }` which excludes items at
exactly `now`; change it to use the same `period_end` upper bound used by
events/comments and the same exclusive semantics: replace the check with `if
created_at < day_ago || created_at >= period_end { continue; }`, referencing the
`created_at`, `day_ago`, and `period_end` variables in the boosts processing
logic so boosts align with events/comments.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bd465755-16f0-417d-8f02-0fe032765796
📒 Files selected for processing (6)
AGENTS.mdsrc/db/main/element_comment/blocking_queries.rssrc/db/main/element_comment/queries.rssrc/db/main/element_event/blocking_queries.rssrc/db/main/element_event/queries.rssrc/rest/v4/activity.rs
✅ Files skipped from review due to trivial changes (1)
- AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (4)
- src/db/main/element_event/queries.rs
- src/db/main/element_comment/queries.rs
- src/db/main/element_event/blocking_queries.rs
- src/db/main/element_comment/blocking_queries.rs
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.
Summary
Why not the Atom feed?
The /feeds/ endpoints serve XML, split events and comments into separate feeds, and don't include boosts. The /v4/activity endpoint already merges all three into one JSON timeline — adding area scoping there was a one-param change vs
building a parallel feed system.
Tests
PR description for btcmap.org-2nd:
Summary
Frontend MVP
MVP only. UI should be adjusted alter on if the API is clear
Summary by CodeRabbit
New Features
areaparameter.Documentation