Repository navigation
fix(dashboard): show servers the bot joins after sign-in, add Refresh server list - #388
Ferdinand99 wants to merge 8 commits into
Conversation
…efresh server list action A server the bot joined after someone signed in stayed out of their server list until they signed in again. A join now marks the lists on that platform as due and each identity is looked at once on its next request, through the bot's own view of the server. The server switcher gets a Refresh server list action (POST /api/v2/account/refresh-guilds, once per 30 seconds per account, own identities only).
There was a problem hiding this comment.
Graphify reviewed this change.
Code graph out of date: Health delta baseline: last indexed commit a9ec8af (diverged from this PR's base — delta is approximate). Impact and hotspot numbers below may be wrong.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 5 advisory finding(s) below merit a look before merge.
Not checked: tests were not run; no formal proof of the changed code.
Graphify review — findings
Adds automatic and on-demand discovery of servers the bot joins after someone has signed in, so they show up in the dashboard without a fresh platform login. The bot now records recent guildCreate joins on both Discord and Fluxer (ignoring the startup replay), and the account's next request re-checks only the identities whose list predates a join, reading rights through the bot rather than the user's OAuth token, with a cap of 25 member lookups per refresh. Adds a POST /api/v2/account/refresh-guilds endpoint and a "Refresh server list" action in the server switcher, limited to once per 30 seconds per account and to the caller's own sign-ins. If the refresh finds nothing, the user can still sign out and back in, and the docs and troubleshooting rows are updated to describe the new behaviour.
Worth a look
- Automatic refresh marks the identity as checked before the lookups run, so failed or capped servers are never retried —
src/web/lib/guildListRefresh.js:63· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
- The 25-lookup cap can permanently starve later guilds —
src/web/lib/guildListRefresh.js:37· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
- Manual refresh still filters non-owned servers by join time —
src/web/lib/guildListRefresh.js:82· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
- Manual refresh bypasses the per-identity in-flight dedup and can race the automatic refresh —
src/web/lib/guildListRefresh.js:81· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
- Per-request refresh can block every authenticated request on up to 25 platform lookups —
src/web/middleware/auth.js:262· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 775 functions depend on the 345 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
registerFluxerModuleEvents()— 7 callers, 13 callees - worse:
Shell()— 6 callers, 6 callees - worse:
SignedInShell()— 1 callers, 23 callees - worse:
serverRightsLive()— 6 callers, 3 callees - new:
refreshAfterJoins()— 2 callers, 7 callees - new:
addJoinedGuilds()— 2 callers, 6 callees - worse:
ServerSwitcher()— 3 callers, 4 callees
Verification — 775 functions in the blast radius were not formally verified this run (proofs are advisory here).
Health delta baseline: last indexed commit a9ec8af (diverged from this PR's base — delta is approximate).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 754 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
675 of 675 test file(s) selected (100%) via static blast radius.
Escalated to a full run for safety (
noncode-change,uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.
apps/sylo-ios/SyloKit/Tests/SyloKitTests/Access/DashboardAccessTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Access/Round3Tests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountConnectTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountModelTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/ConnectCallbackSourceTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/NoDashboardLinkSourceTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Appeals/AppealsReviewTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationFormsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationPassthroughTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationSubmissionsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationWireTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditHistoryTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditLogTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerAddressTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/KeychainTokenStoreTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/PKCETests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/SignInRequestTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/TokenStoreTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Changelog/ChangelogTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Commands/CommandOverridesTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/CollectiblePictureTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyAdminTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyMembersTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/InventoryTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopExtrasTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopItemsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopModelTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/EmbedDraftTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/ModuleLimitsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/CommunityReviewFixesTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/EventEndpointsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Giveaways/GiveawayActionsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/CommandPrefixTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/GuildSettingsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Health/HealthTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Import/P6Tests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Insights/InsightsTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Leaderboard/LeaderboardTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberDataTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberSearchTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesModelTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ModelDecodingTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ServerListTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Sylo52PolishTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/UnknownKeysTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Utf16TextLimitTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/Moderation/ModerationTests.swift— full-run-safetyapps/sylo-ios/SyloKit/Tests/SyloKitTests/ModuleSettings/AfkSettingsTests.swift— full-run-safety- … and 625 more
non-code file(s) changed (
docs/fluxer.md,docs/mobile-app.md,web-v2/src/styles.css) → running the full suite for safety (a code graph can't see config/fixture/data deps)
changed code file(s) with no mapped test (
docs/fluxer.md,docs/mobile-app.md,src/bot/events/adminSnapshot.js,src/web/lib/routeAccess.js,src/web/routes/v2Api.js) — a coverage gap or a missing link — running the full suite rather than only the selected tests
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
…und lookups The server-list refresh now looks at the newest joins first, fetches a cached member fresh when the members intent is off, shares a per-minute lookup budget across accounts, and does not repeat the automatic check in the manual refresh of the same request. More tests cover members without Manage Server, members with Manage Server or Administrator, and the 25 cap.
Problem
After adding the bot to a new server, the server did not appear in the dashboard's server list until the person signed out and in again. The list is stored per sign-in and only follows rights changes of servers it already knew about.
Changes
guildCreate, FluxerguildCreate) is noted in memory per platform (src/bot/lib/guildJoins.js). Startup replays and joins the platform dates long ago are ignored.src/web/lib/guildListRefresh.js, hooked intoattachAccount): a server's owner is found for free, anyone else costs one member lookup, and only for servers joined since the last look. After that no further work until the next join. Rights are read through the bot, so no platform OAuth call is made (Sylo does not keep OAuth tokens).POST /api/v2/account/refresh-guilds(classifiedselfinrouteAccess.js): refreshes only the caller's own identities, at most once per 30 seconds per account, at most 25 member lookups.docs/fluxer.md,docs/mobile-app.md).Tests
test/guildListRefresh.test.js: join registry, Discord and Fluxer join events, the next request refreshes once, per-platform isolation, refresh route (adds servers, 429 on the second call, only the caller's identities, sign-in and CSRF).web-v2/src/__tests__/ServerSwitcherRefresh.test.jsx: the button, the reloaded list, the error note, the busy state.test:v2andbuild:v2pass.