Decide gates the way terragucci does, with chant's gate modules #15
Labels
No labels
terraform-plane
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jhgaylor/sluice#15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
(bug, shows once the sandbox runs terragucci past 0.4.10; #10 is unblocked)
Part of the terraform-plane epic (arugula-salad/arugula#1141). Lands after terragucci's next release, the first built on chant 0.124.41 or later (chant#4287); npm's newest is still 0.4.40, on chant 0.124.24.
sluice decides gates with a line-for-line port of terragucci 0.4.0's
decideGate(src/services/ledger.ts) and writes resolutions itself. The record format is still accepted by chant 0.124.27 and terragucci 0.4.39. The decision isn't. Each of these makes the inbox say one thing and the wave do another:Involvement (0.4.13, #1044 there): an approval from the PR author, a commit author or the agent's requester doesn't count, and their deny is dropped (terragucci
apply.tsbeforeGateRules/resolutionRefusal,involved.ts). sluice marks the row approved and resumes; terragucci writes a fresh pending fact and waits; a new row appears. The pending record'sexcludednames them.approval_rules(0.4.35): the outcome line iswave N waits (rules): ...(apply.ts:3574), whichparseOutcomedoesn't read, and after the first approval terragucci exits 1 withapproval_rules not met(apply.ts:3470), so the run is marked failed.require_signed:isSealed()(src/console/routes.tsx:49) checks onlyapproval === "sealed", so the button writes lines that never count. Related to #8.Spent approvals (0.4.11):
_gates/tf-apply/applied.jsonlmakes a spent approval of another digest "waiting", not "refused". The port has noappliedinput.State migrations (0.4.5): wave 1 can wait on
_gates/tf-migrate.jsonlwithmigration <name> waits: ...(apply.ts:3625). sluice parses wave 0, files a tf-apply approval and watches the wrong ledger.Decision-point gates (
apply.point, chant ws-091): onlychant workspace points answerpasses them; a resolution from sluice counts for nothing while its port says approved.Base gate (0.4.40, terragucci#1202): each wave takes the stricter of
--gateand the top-levelgateat the first parent (environmentWaveGates,apply.ts:1195). sluice reads the config at the run's sha (executor.tsconfigAtSha), so a merge that loosens the gate toneverstill waits under 0.4.40+ while sluice's config saysnever. The plan note warns about a loosening since 0.4.40 (report/stage.tsgateLoosening); sluice's console doesn't.Under
gate: nevera wave still waits forcost.approve_above,on_failure: approve, a policy hold, an environment's own gate, and wave 1 of a migration (terragucciguides/run-without-approvals.mdx, #1203).Next release:
approval_rulesare judged by chant's quorum (terragucci#1217 deletedapproval-rules.ts), and in pr-review mode a reviewer's role counts only when.chant/trust.jsongrants it to their principal,github:<lowercased login>(forgejo@<host>:<login>on Forgejo;apply.tsreviewerPrincipal). A grant to a bare login no longer counts.actorOfwritesgithub:on Forgejo estates too. Policy argv and answers come from chant'sgate-policy(#1218), and a policy hold makes the gate wait for an approval of the plan's own digest, even undergate: never(chant#4294).Porting stops being the way to keep up: terragucci now delegates most of this to chant, and chant's modules import into Bun. Bundled from the 0.124.41 tarball:
@intentius/chant/op/gate-quorum(13KB, node:crypto; also re-exported fromgate-decision): use it.gate-decision: its pure parts.trustRolesAt,gateSignersAtandidentityGatesAtspawn git; pass them text read from the forge.gate-policy: leave it to the sandbox (it spawns the policy engine).Pin whatever sluice imports to the chant version the pinned terragucci uses.
Done when:
@intentius/chant/gate-decision(latestResolutionForPlan,isApprovalSpent,parseAppliedGateLines; bundle-safe since chant #3763/#3778) instead of the port, and verifies seals with itsgateSealRefusalbefore resuming.TG_OUTCOME_JSON(#10), includingexcluded, rules and the gate's ledger, so a migration gate files againsttf-migrate.approval_rulesare judged withgate-quorum(quorumOf, mapping roots to targets and not_author to notAuthor;quorumRuleProgress,quorumWaiting), and the base decision plus spent approvals withdecideGateApproval({ spend: true })(waiting and mismatched map to refused). Involvement (involved.ts) is still ported; chant doesn't have it. The pending fact keepsroots/not_authorinapproval_rules(approval.tsruleReport), so the inbox can keep parsing it.forgejo@<host>:<login>on Forgejo estates.never.gate: neverhold and a loosening merge.From a review of sluice against terragucci 0.4.39 and chant 0.124.27 (2026-10-20). Proposal for the maintainer; PRs would come from lex00/sluice.
Updated 2026-10-22 for terragucci main (pins chant 0.124.41, terragucci#1212–#1223) and chant 0.124.41–0.124.42.
Decide gates the way terragucci 0.4.39 doesto Decide gates the way terragucci does, with chant's gate modules