Skip to content

Add GetDashboardV2 RPC to aggregate dashboard content - #9147

Draft
aapeliv wants to merge 3 commits into
developfrom
backend/feature/get-dashboard-v2
Draft

Add GetDashboardV2 RPC to aggregate dashboard content#9147
aapeliv wants to merge 3 commits into
developfrom
backend/feature/get-dashboard-v2

Conversation

@aapeliv

@aapeliv aapeliv commented Jun 19, 2026

Copy link
Copy Markdown
Member

Adds a single GetDashboardV2 RPC (on a new Dashboard service) that returns all the content the dashboard loads today in one call, instead of the frontend fanning out to ~6 separate RPCs (reminders, surfing & hosting host requests, my events, community events, and community discussions).

The win is removing the per-request round-trip and interceptor/write overhead paid 6× today (auth, last_active/UserActivity writes, connection-pool checkout), not reducing query count — the same queries run, now in one transaction.

The query logic for each section is extracted into module-level functions (get_reminders, list_host_requests, list_my_events, list_my_communities_discussions) that both the existing per-section RPCs and the new aggregator call, so there is no duplicated query/visibility/moderation logic. The existing servicer methods now delegate to these.

This is backend only and a draft — the web frontend wiring to consume the new RPC is intentionally not included yet.

Note: generated proto stubs are gitignored and regenerated by CI from dashboard.proto.

Testing

  • Added app/backend/src/tests/test_dashboard.py: asserts GetDashboardV2 is byte-identical to calling the 6 individual RPCs with the same parameters the web frontend uses, plus role-based bucketing (surfer vs host) and the empty-state.
  • make mypy and make format pass.
  • The dashboard test suite passed locally. The local testing DB went down before I could re-run the full requests/account/events/discussions suites to confirm the extraction is behavior-preserving — relying on CI for that; the extraction is a pure delegation so existing behavior should be unchanged.

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history (n/a — no DB changes)

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

This PR was created with the Couchers PR skill.

The dashboard fires ~6 separate RPCs on load (reminders, surfing/hosting
host requests, my events, community events, community discussions). Add a
single GetDashboardV2 RPC on a new Dashboard service that returns all of
them in one call, removing the per-request round-trip and interceptor
overhead.

The servicer methods that power each section take no instance state, so
the aggregator just instantiates the existing servicers and calls their
methods directly — no logic is duplicated or moved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CouchersBot

CouchersBot commented Jun 20, 2026

Copy link
Copy Markdown
Member

Mobile

Install the Dev Tool (iOS via TestFlight, iOS Simulator, or Android .apk) here.

Scan the QR with your phone camera, or tap Open in Dev Tool on the device, to open this branch in the installed Dev Tool dev client.

    iOS         Android    
    QR to open the iOS build         QR to open the Android build    
    Open in Dev Tool         Open in Dev Tool    
Deep links

iOS

couchers-devtool://expo-development-client/?url=https%3A%2F%2Fe7967bcd--ota.preview.couchershq.org%2Fios%2Fmanifest

Android

couchers-devtool://expo-development-client/?url=https%3A%2F%2Fe7967bcd--ota.preview.couchershq.org%2Fandroid%2Fmanifest

Web (Vercel)

View the Vercel web preview for this branch.

Backend

Schema Schema diff Sample emails

Other

Protos Backend coverage Web coverage

@nabramow

Copy link
Copy Markdown
Member

Shall we call this getDashboard not getDashboardV2 since we don't have a v1 for this?

Comment on lines +28 to +53
surfing=Requests().ListHostRequests(
requests_pb2.ListHostRequestsReq(
only_sent=True,
only_active=True,
status_in=[
conversations_pb2.HOST_REQUEST_STATUS_ACCEPTED,
conversations_pb2.HOST_REQUEST_STATUS_CONFIRMED,
],
sort_by=requests_pb2.HOST_REQUEST_SORT_BY_FROM_DATE,
),
context,
session,
),
hosting=Requests().ListHostRequests(
requests_pb2.ListHostRequestsReq(
only_received=True,
only_active=True,
status_in=[
conversations_pb2.HOST_REQUEST_STATUS_ACCEPTED,
conversations_pb2.HOST_REQUEST_STATUS_CONFIRMED,
],
sort_by=requests_pb2.HOST_REQUEST_SORT_BY_FROM_DATE,
),
context,
session,
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two blocks are identical except only_sent vs only_received. You could extract a small helper like _upcoming_host_requests_req(surfing: bool) so the parameters can't drift apart between the two?

@nabramow

Copy link
Copy Markdown
Member

@aapeliv I pushed some changes to add the exclude_attending logic I merged since you started this PR (and added a test).

I also went ahead and tested that the backend runs fine locally. Code looks good to me, just that one nit comment.

I'd love to get this merged so I can do #9286 on top of this logic instead of what we have now (as it would be cleaner IMO).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants