Skip to content

fix(bridge): one configurable link limit for the bridge and the mirror - #390

Open
Ferdinand99 wants to merge 3 commits into
feat/53-mirror-bridge-linkfrom
fix/53-bridge-limit
Open

Ferdinand99 wants to merge 3 commits into
feat/53-mirror-bridge-linkfrom
fix/53-bridge-limit

Conversation

@Ferdinand99

Copy link
Copy Markdown
Owner

What

The Bridge page could show "Bridged channels (35 of 10)" after a server mirror: the bridge capped a server at 10 links, while the mirror linked up to 50 on its own ceiling.

  • One limit for both, set by the operator with BRIDGE_MAX_LINKS (default 100, 1 to 500, anything else stops startup with a clear message). Documented in docs/self-hosting.md, .env.example, docs/modules/bridge.md and docs/mirror.md.
  • Links made by hand and by a mirror count toward the same limit. Accepting a request also checks the server that asked.
  • A mirror links up to the limit and reports the rest as "not linked: the server's bridge limit (N) is reached"; it stops trying instead of queueing more runs.
  • The Bridge page explains how to raise the limit (operator setting) when it is reached, and never shows a count above the limit ("(5)" with a note if the limit was lowered below what exists).
  • The relay queue spaces each webhook by its platform: Fluxer (60 sends, 30 edits and 30 deletes per webhook per minute) 1 s between sends and 2 s between edits and deletes; Discord about 450 ms. Fluxer allows 15 webhooks per channel and 1000 per server, and a link uses one webhook per channel, so a limit of at most 500 stays inside both.

Tests

  • test/bridgeLimit.test.js: parsing and bounds of BRIDGE_MAX_LINKS, default 100, request and accept refusals, the page count, platform spacing of the queue.
  • test/mirrorBridgeLink.test.js: the mirror stops at the limit (hand-made links count), reports the rest, and links them once the limit is raised.
  • web-v2/src/__tests__/Bridge.test.jsx: the count and the note at, below and above the limit.

…r (BRIDGE_MAX_LINKS, default 100)

The bridge capped a server at 10 links while the server mirror linked up to 50, so the page could show 35 of 10. Both now share one limit set by the operator with BRIDGE_MAX_LINKS (1 to 500, default 100). A mirror links up to it and reports the rest as not linked; the Bridge page explains how to raise it and never shows a count above the limit. The relay spaces each webhook by what its platform allows.

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 1 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 an operator-set BRIDGE_MAX_LINKS (default 100, range 1 to 500) that caps bridged channels per server, replacing the old fixed limits of 10 by hand and 50 via mirror. Hand-made links and server-mirror links now count against the same cap, and Sylo refuses to start if the value is not a whole number in range. When a mirror hits the cap, it links up to the limit and lists the remaining channels in its report as "not linked", and they get linked on a later "Copy again" once the limit is raised or links are removed. The bridge docs, self-hosting table and .env.example are updated to match, including how each platform's webhook rate limits shape the relay's send spacing.

Worth a look

  • Platform gap is skipped when a new enqueue arrives just after a lane goes idle — src/modules/lib/bridgeQueue.js:136 · Escalate · medium
    • NOT verified (no proof, no reproducing execution) — needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 278 functions depend on the 261 functions this change touches.

Health — this change adds coupling hotspots:

  • new: acceptLink() — 7 callers, 18 callees
  • new: linkMirroredChannels() — 4 callers, 18 callees
  • new: handleMessage() — 4 callers, 18 callees
  • new: requestLink() — 7 callers, 8 callees
  • new: failLink() — 5 callers, 9 callees
  • new: resumeLink() — 4 callers, 11 callees
  • new: createMirrorLink() — 2 callers, 18 callees
  • new: bridgeOverview() — 3 callers, 10 callees
  • …and 26 more — each is listed as a finding

Verification — 278 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: 278 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

696 of 696 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-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Access/Round3Tests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountConnectTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/ConnectCallbackSourceTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/NoDashboardLinkSourceTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Appeals/AppealsReviewTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationFormsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationPassthroughTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationSubmissionsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationWireTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditHistoryTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditLogTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerAddressTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/KeychainTokenStoreTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/PKCETests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/SignInRequestTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/TokenStoreTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Changelog/ChangelogTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Commands/CommandOverridesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/CollectiblePictureTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyAdminTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyMembersTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/InventoryTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopExtrasTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopItemsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/EmbedDraftTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/ModuleLimitsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/CommunityReviewFixesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/EventEndpointsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Giveaways/GiveawayActionsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/CommandPrefixTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/GuildSettingsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Health/HealthTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Import/P6Tests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Insights/InsightsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Leaderboard/LeaderboardTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberDataTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberSearchTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ModelDecodingTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ServerListTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Sylo52PolishTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/UnknownKeysTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Utf16TextLimitTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Moderation/ModerationTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/ModuleSettings/AfkSettingsTests.swift — full-run-safety
  • … and 646 more

non-code file(s) changed (.env.example, docs/mirror.md, docs/modules/bridge.md, docs/self-hosting.md) → 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/mirror.md, docs/modules/bridge.md, docs/self-hosting.md) — 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.

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.

1 participant