Repository navigation
fix(mirror): role and channel order in the shape Fluxer takes - #391
Ferdinand99 wants to merge 2 commits into
Conversation
Fluxer answers PATCH /guilds/{id}/roles with 204 No Content, and the SDK's guild.setRolePositions() maps over that empty answer as if it were the role list, so the order was set and then reported as failed. The adapter now calls both order routes through the SDK's REST client.
Discord numbers text and voice channels separately, so sorting a category by raw position could put a voice channel between text channels. Fluxer applies channel moves one at a time and refuses a move that leaves a voice channel above a text channel (400 Invalid form body). The order is now built the way Discord shows it (text-like first, then voice; loose channels before categories), sent text moves before voice moves, and positions count only the channels that exist on Fluxer.
A refused order now says what Fluxer said, and that the copied roles keep waiting for their powerful permissions; Copy again sends it again. The bridge step sums itself up in one sentence across batches.
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.
No verdict: the code graph is out of date. Static checks found no blocking issues, but they compared against an outdated graph. The next push after the repository re-indexes gets a full review.
Not checked: tests were not run; no formal proof of the changed code.
Graphify review — findings
Fixes the mirror's channel ordering so Fluxer gets the order Discord shows (text-like channels before voice inside a category, uncategorised channels before categories), leaving channels made natively on Fluxer where they are. Refused role and channel orders now fail with Fluxer's own reason (including field errors from a 400, which previously said only "Invalid form body"), and the roles stay without their powerful permissions until Copy again resends the order and grants them. The bridge-linking step reports one running sentence for the whole step, e.g. "35 channels linked, 2 were linked already, 1 not linked (see the notes)", even when it runs in several batches, and the report shows only the latest batch's sentence.
Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 95 functions depend on the 88 functions this change touches.
Health — this change adds coupling hotspots:
- new:
scenario()— 4 callers, 8 callees - new:
buildPlan()— 1 callers, 15 callees - new:
fakeFluxer()— 3 callers, 5 callees - new:
createEngine()— 5 callers, 3 callees
Verification — 95 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: 95 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
697 of 697 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 647 more
non-code file(s) changed (
docs/mirror.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) — 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.
Summary
The first live run of the server mirror against a real Fluxer server finished with two failed steps: "Role order: Cannot read properties of undefined (reading 'map')" and "Channel order: Invalid form body.". This fixes both and makes the bridge line of the report readable.
Role order
Fluxer answers
PATCH /guilds/{id}/roleswith 204 No Content.@fluxerjs/core3.3.0'sguild.setRolePositions()maps over the response as if it were the role list, so it threw after Fluxer had already applied the order. The adapter now calls the route through the SDK's REST client with[{ id, position }].Channel order
Discord numbers text-like and voice channels separately, so sorting a category by raw position could put a voice channel between text channels. Fluxer applies channel moves one at a time (
position= index among the new siblings) and refuses any move that leaves a voice channel above a text channel in a category (400INVALID_FORM_BODY,VOICE_CHANNELS_CANNOT_BE_ABOVE_TEXT_CHANNELS).channelOrder()now follows Discord's display order: text-like before voice in each category, loose channels before categories. It sends the text moves for every category before the voice moves.channelPositionUpdates()counts positions only among channels that exist on Fluxer. It places the mirror's voice channels after every text-like channel in the category, including channels made on Fluxer.[{ id, position, parent_id, lock_permissions: false }].Failures, Copy again, report
errorsfield of the 400 response. For roles, it also says the copied roles keep waiting for their powerful permissions. Rate limits, network errors and permission errors are handled as before.Tests
test/mirrorFluxerContract.test.jsuses the real SDKGuildand REST client against a local recording HTTP server. It checks the method, path, auth header and raw JSON body for both routes, the 204 handling, and that a Fluxer 400 body is classified with its field reason.test/mirrorOrder.test.jscovers: