fix(connectors): one reading of the gate for the hold label, and the selector pinned to it (TASK-160) - #1938
Merged
Conversation
…selector pinned to it (TASK-160) Two pre-existing residues from #1935/TASK-156, split off rather than grown there. (1) `cardHoldReason: 'gate_off'` restated the gate ternary in both bridges (`telegramBridgeService.ts:288`, `slackBridgeService.ts:209`). Both now read `!isGatedPodTarget(integration, podId)` — the same predicate the relay uses — so the "why is this held" reason a user is shown cannot go stale when gate semantics change. The `scope === 'user'` test stays: it asks a different question than the gate read does. (2) `activeHandlersForPod`'s Mongo `$match` and the bridges' rule were only ever asserted apart. The unit tier can drive the aggregate (mongodb-memory-server, the existing dispatcher suite), so the agreement test the row allowed for is built rather than a comment: one fixture matrix — member / non-member × gate on / off / absent — walked through BOTH the selector and `isRoutedPodTarget`, asserting they reach the same verdict on every cell, plus the concrete expectation so the two drifting together to "no" reddens too. Fixture note worth keeping: `install` seeds the installed pod's gate ON, so the absent cell unsets the key rather than skipping the write — absent and false are different inputs and only absent exercises `$exists`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finishes "one reading of
config.gates" — the two residues split off #1935/TASK-156 rather than grown inside a gate-pending PR. Both are pre-existing and neither is an authorisation path. Row TASK-160.Residue (1) — the hold label read its own copy of the gate
cardHoldReason: 'gate_off'restated the ternary atslackBridgeService.ts:209andtelegramBridgeService.ts:288. Both now read!isGatedPodTarget(integration, podId)— the predicate the relay itself uses, so the "why is this held" reason a user sees cannot go stale when gate semantics move. Thescope === 'user'test stays: it asks a different question than the gate read does (the label means this person's gate for that pod is off, not this connector owns that pod), and the comment says so.Residue (2) — the selector is a query and the rule is a predicate
activeHandlersForPod(services/installable/eventHandlers.ts:59) selects connectors with a Mongo$matchoverconfig.gates.<podId>.enabledplus membership;connectorRelayPolicy.isRoutedPodTargetreads the same two halves. They had only ever been asserted apart.The unit tier can drive the aggregate, so the row's agreement test is built rather than replaced by a comment: the existing dispatcher suite already runs real models against
mongodb-memory-serverandactiveHandlersForPodis exported. One fixture matrix — member / non-member × gate on / off / absent — is walked through both the selector andisRoutedPodTarget, and each cell asserts:isGatedPodTarget),Fixture note the test now carries:
installseeds the installed pod's gate ON, so the absent cell unsets the key rather than skipping the write. Absent and false are different inputs, and only absent exercises$exists.Witnesses
decisionCardRelay.bridges.test.jsgate_offpair (Telegram + Slack) reddens under a predicate change — M1gate_offarm reddens, Slack's survives[gateEnabledPath]: true) → the two member gate-off/absent cells reddencreatedBy) → the non-member gate-on cell reddensisGatedPodTargetalways on) → the four gate-off/absent cells and both label arms reddenLedger — 6 mutations, baseline and restore 29/29
gate_offarm survives; that is the drift this closesDisclosures.
Scope
isGatedPodTargetis untouched..tslint 0 errors (both bridges 0 diagnostics at head and atHEAD~1); 0 diagnostics on added.jslines (the file's ambientimport/extensionscount is 9, allrequires of the same shape as the new one, and backend.jsis not linted).Gate: Vera.