Repository navigation
Description
Summary
Approval accounting is now ten functions inside dispatcher/decide.mjs, which is 86KB — four times the next dispatcher module. Each answers a different question about who has approved what, and a rule change moves them together, but they sit scattered through a file that also holds every other plan. status.mjs already shows the shape this wants: one module per concern, imported by decide.mjs.
Approach
Move these from dispatcher/decide.mjs into a new dispatcher/approvals.mjs, keeping private whatever is private once #290 merges:
| Symbol | decide.mjs |
Imported outside decide.mjs by |
|---|---|---|
proxyApproves |
:90 | gather.mjs:11, status.mjs:19 |
stalePlan |
:528 | — |
standingApprovals |
:540 | — |
buriedApprovals |
:561 | — |
botArmedOwnerPr |
:585 | — |
contractSyncPlan |
:727 | — |
proxyPlan |
:752 | — |
proxyVerdict |
:795 | status.mjs:19 |
armedByAuthor |
:807 | — |
vouched |
:825 | — |
Only proxyApproves and proxyVerdict cross a module boundary today, so the new module's exported surface is those two plus whatever decide.mjs itself calls.
Settle the cycle before moving code. decide.mjs would import approvals.mjs, and the moved functions call back into decide.mjs: the action constructors (dismissProxy, dismissStale, proxyApprove, armAutoMerge, disarmAutoMerge, requestReviewer, commentOnce, note), the login predicates (isBot, lower, fullTreatment, threadsWaiting), and HOLD_KEY / ARMED_HOLD_KEY / dispatcherMark. Move the action constructors and the predicates into a third module that both import. Passing them in as arguments instead keeps the file count down but grows every call site and hides the dependency in a signature, which is why it loses.
dispatcher/test/decide.test.mjs reaches most of these through evaluatePr, and test/status.test.mjs and test/contracts.test.mjs go through decide / evaluatePr too, so the suite should need no change beyond its imports.
Acceptance criteria
- No function from the table above remains in
dispatcher/decide.mjs -
dispatcher/approvals.mjsexports only what another module imports -
status.mjsandgather.mjsimportproxyApprovesandproxyVerdictfrom the new module, not fromdecide.mjs - No import cycle:
dispatcher/index.mjsloads with no circular-dependency warning and no import undefined at module scope - Behaviour is unchanged — only imports are edited in the test files, never an assertion
-
dispatcher/predicates.mjsholds the whole small, pure predicate family, not only the members the cycle forced out (review, Ardnived, 2026-11-21) -
loopMayNotMergeis indispatcher/approvals.mjs, somergePolicy's$commentnames one file (review, Ardnived, 2026-11-21) - The two dead exports the move surfaced are gone:
archiveCurrentwith itsapply.mjsarm, anddecide.mjs's_internal(review, Ardnived, 2026-11-21)
Verification checklist
-
node --test dispatcher/test/*.test.mjspasses, with the same test count as the run before the move -
node --test workflow/lib/*.test.mjspasses -
node -e "import('./dispatcher/index.mjs').then(() => console.log('ok'))"printsok -
wc -c dispatcher/*.mjsshowsdecide.mjsbelow 86KB -
grep -rn "from './decide.mjs'" dispatcher/names no moved symbol
Notes
Raised by the adversarial review on #290, which added stalePlan, standingApprovals and buriedApprovals and asked whether the total had outgrown the file. Nothing in #290 is wrong: this is about the total, not that change.
Keep it a pure refactor. A behaviour change moved alongside ten functions cannot be reviewed, and this repo cannot be tested by running it — a skill or dispatcher edit takes effect on the next run, never the current one.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Nov 20, 2026
@sydevs-bot implement
sydevs-bot commentedon Nov 20, 2026
🤖 no session running
approved by Ardnived
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.