Skip to content

feat: presence enabled accepted as a valid to connect - #2071

Open
filipecabaco wants to merge 2 commits into
mainfrom
feat/presence-permission-allow-connect-real-942
Open

feat: presence enabled accepted as a valid to connect#2071
filipecabaco wants to merge 2 commits into
mainfrom
feat/presence-permission-allow-connect-real-942

Conversation

@filipecabaco

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

presence enabled accepted as a valid to connect

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

CRAP Score Report

Summary: files=229 functions=1139 scored=1139 worst_score=15944.76

** (Mix) CRAP threshold failed: max_score=30.00
High scores: 29
  lib/extensions/postgres_cdc_rls/subscription_manager.ex Extensions.PostgresCdcRls.SubscriptionManager.handle_info/2 score=37.16
  lib/realtime/adapters/postgres/oid_database.ex Realtime.Adapters.Postgres.OidDatabase.name_for_type_id/1 score=15944.76
  lib/realtime/application.ex Realtime.Application.setup_region_mapping/0 score=47.11
  lib/realtime/nodes.ex Realtime.Nodes.default_region_mapping/1 score=157.20
  lib/realtime/operations.ex Realtime.Operations.rebalance/0 score=42.00
  lib/realtime/operations.ex Realtime.Operations.kill_connections_to_tenant_id/2 score=90.00
  lib/realtime/tenants/connect.ex Realtime.Tenants.Connect.handle_info/2 score=37.63
  lib/realtime_web/channels/auth/jwt_verification.ex RealtimeWeb.JwtVerification.generate_signer/3 score=31.09
  lib/realtime_web/channels/realtime_channel.ex RealtimeWeb.RealtimeChannel.handle_info/2 score=62.45
  lib/realtime_web/channels/realtime_channel.ex RealtimeWeb.RealtimeChannel.handle_in/3 score=132.36
  lib/realtime_web/dashboard/feature_flags.ex RealtimeWeb.Dashboard.FeatureFlags.handle_event/3 score=702.00
  lib/realtime_web/dashboard/node_info.ex RealtimeWeb.Dashboard.NodeInfo.fetch_node_data/2 score=42.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.handle_event/3 score=552.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.handle_info/2 score=210.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.render_value/2 score=42.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.load_module_functions/1 score=42.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.parse_and_start/2 score=110.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.format_value/1 score=702.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.sort_entries/2 score=42.00
  lib/realtime_web/dashboard/recon_trace.ex RealtimeWeb.Dashboard.ReconTrace.parse_module/1 score=90.00
  lib/realtime_web/dashboard/sql_inspector.ex RealtimeWeb.Dashboard.SqlInspector.handle_event/3 score=72.00
  lib/realtime_web/dashboard/sql_inspector.ex RealtimeWeb.Dashboard.SqlInspector.execute_read_only/1 score=72.00
  lib/realtime_web/dashboard/sql_inspector.ex RealtimeWeb.Dashboard.SqlInspector.mask_sensitive_columns/1 score=42.00
  lib/realtime_web/dashboard/sql_inspector.ex RealtimeWeb.Dashboard.SqlInspector.compare_cells/2 score=42.00
  lib/realtime_web/dashboard/sql_inspector.ex RealtimeWeb.Dashboard.SqlInspector.format_cell/1 score=72.00
  lib/realtime_web/dashboard/tenant_migrations.ex RealtimeWeb.Dashboard.TenantMigrations.handle_info/2 score=118.65
  lib/realtime_web/dashboard/tenant_migrations.ex RealtimeWeb.Dashboard.TenantMigrations.run_pgdelta/2 score=61.39
  lib/realtime_web/live/inspector_live/event_log_component.ex RealtimeWeb.InspectorLive.EventLogComponent.category_variant/1 score=50.88
  lib/realtime_web/live/status_live/index.ex RealtimeWeb.StatusLive.Index.handle_event/3 score=42.00

@PragTob PragTob left a comment

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.

👋 Hi I have no idea what I'm doing. But I felt like reviewing to get a feel for the code. Hence I'm also not approving, as I don't feel like I know enough to approve yet.

All looks good to me, but this is the first time I'm taking a look at the code base 😅

You know me, but still: Hi I'm Tobi, I tend to leave a lot of comments with the intent to learn from each other. It's perfectly normal for me to leave 5+ comments but approve the PR because it's minor stuff that shouldn't stop delivery or just genuine question, interest or praise.

Here, I think the Map.values() one deserves a look as I hate flaky tests. The others are questions/praise/highly optional.

Image

Comment on lines +20 to +21
{:rc_fastlane, fastlane_pid, serializer, topic, log_level, tenant_id, replayed_message_ids, presence_read?,
broadcast_read?}

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.

maybe the creation/read speed for tuples outweighs this here, but otherwise feels like a struct may be beneficial (would cause less code changes on an update, as we don't need to reiterate all fields all the time)

Comment thread test/integration/rt_channel/presence_test.exs Outdated
Comment thread test/integration/rt_channel/presence_test.exs Outdated
end

assert Agent.get(TestSerializer, & &1) == 0
refute_receive _any

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.

we could consider switching it to refute_received or adjusting the timeout, depending on timeout this might wait 100ms which we may or may not want :)

@edgurgel edgurgel left a comment

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.

What happens if the user gains access to read broadcasts on a new refreshed token?

@filipecabaco

Copy link
Copy Markdown
Member Author

@edgurgel added the logic to be processed during a refresh token

@filipecabaco
filipecabaco force-pushed the feat/presence-permission-allow-connect-real-942 branch from 395f10d to 165ab1c Compare August 7, 2026 01:11
@coveralls

coveralls commented Aug 7, 2026

Copy link
Copy Markdown

Coverage Status

No base build to compare — feat/presence-permission-allow-connect-real-942 into main

@filipecabaco
filipecabaco force-pushed the feat/presence-permission-allow-connect-real-942 branch from 165ab1c to b89ce97 Compare August 7, 2026 01:31
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.

4 participants