Migrate GitHub and Linear action resolution - #247
Conversation
|
@ndisidore Bonk workflow failed. Check the logs for details. View workflow run · To retry, trigger Bonk again. |
|
Review of #241 turned up a correctness bug in the foundation branch that this PR copies: The foundation branch (#238) has been amended: a When rebasing this PR onto the amended foundation, apply the same staged→stopped fix (and matching tests) to the gatekeepers here. |
8bbfdfe to
f204f6a
Compare
f204f6a to
ec85728
Compare
Stacked on #238. Migrates the GitHub and Linear gatekeepers to
applyActionsThrough, using the shared@gadgets/backend-utils/gatekeeper-actionhelpers (validateApplyThroughArgs,displayReason,SerialTaskQueue, and for LinearInvalidationLog). Both keep their existing disposal idioms and legacy per-action semantics (throw on unknown/settled — no silent no-ops).GitHub
resolveActionVetoesapplies direct vetoes plus GitHub's known dependency cascades (resource dependents of a vetoed creation; transitive reply chains, with direct-veto attribution precedence) to the stored records; the batch method retires the changed records and then applies pending actions ascending, stopping at the first failure with the specific apply error asstopped.reason. Attribution persists on retired records (GitHub's existing retire idiom), so repeated requests re-reportinvalidatedByVeto.Fixes over the straightforward port:
"pending"records — never"staged"ones whosesubmitAction()hasn't completed (the contract forbids it; the old sweep would have applied them).#putActionRecord/#retireActionRecordare the two storage chokepoints and clear#pendingActionsCachethemselves, so no veto path can leave stale simulation overlays (previously each call site had to remember; the batch veto path didn't).Tests move to
@cloudflare/vitest-pool-workersso they run inside workerd: unit coverage of the cascade resolution plus DO-level batch tests against a realGitHubGatekeeperImplfacet (real staging flow and facet storage) covering cascade + re-report on retry, the legacy path refusing a cascade-invalidated action, unknown-veto tolerance, RPC-boundary validation, and legacy-reject attribution durability.Linear
applyActionsThroughper the contract: vetoes first (recursive provisional-issue cascade and label cascade keep deleting, now recording attribution in aninvalidation:keyspace viaInvalidationLog), then pending actions ascending with a status guard (the legacyapplyActionhad none and would re-apply settled records if asked).enqueuenow writes records as"staged"and flips to"pending"only aftersubmitAction()resolves (read overlays include both), and rolls the record back if submit fails — previously a failed submit left an orphaned pending record.SerialTaskQueue.Tested with
pnpm build,pnpm lint:check, and the gatekeeper-github suite (17 tests, including the new DO-level batch tests).