fix(7733): a rule with triggers holds or refuses only the acts they match
CI & Build / TypeScript typecheck (push) Successful in 35s
CI & Build / Plugin hooks (push) Failing after 19s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Python tests (push) Successful in 2m31s
CI & Build / integration (push) Successful in 2m18s
CI & Build / Build & push image (push) Canceled after 27s
CI & Build / TypeScript typecheck (push) Successful in 35s
CI & Build / Plugin hooks (push) Failing after 19s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Python tests (push) Successful in 2m31s
CI & Build / integration (push) Successful in 2m18s
CI & Build / Build & push image (push) Canceled after 27s
Rules 2, 4, 10 and 153 are set to hold and mounted on work.deliver. A push to dev therefore stopped four times in a row, once for each of them, although none of them governs a push to dev: their triggers (git push origin main, git tag, pytest, pull_request_write) name the acts they do govern. A rule that has triggers now stops an act only when one of them matched it. Reached by its moment alone, it is a line beside the work. A rule with no triggers still holds wherever it is mounted, because the mount is all that says where it applies. A mounted rule whose unscoped trigger also matched now counts as reached by the trigger, so it ranks as triggered and may stop the act. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1748,10 +1748,13 @@ async def run_moment_arm(
|
||||
by_moment = {hit["moment"]: hit for hit in reached}
|
||||
# (rule, at, where, specificity) for every candidate line.
|
||||
cands = []
|
||||
# A mounted rule whose unscoped trigger also matched this act was
|
||||
# reached by its trigger: it ranks, and may stop the act, as one.
|
||||
fired_ids = {rule.id for rule, _trig in fired}
|
||||
for rule, at in pairs or []:
|
||||
if board is not None and (rule.id, at) in board.gated:
|
||||
continue
|
||||
met = board is not None and (rule.id, at) in board.matched
|
||||
met = board is not None and ((rule.id, at) in board.matched or rule.id in fired_ids)
|
||||
cands.append((rule, at, f"at {at}, reached by {_reached_by(by_moment.get(at, {}))}",
|
||||
rule_order.BY_TRIGGER if met else rule_order.BY_MOUNT))
|
||||
taken = {c[0].id for c in cands}
|
||||
@@ -1762,9 +1765,16 @@ async def run_moment_arm(
|
||||
cands.append((rule, trig.key, f"its trigger {trig.describe()} matched this act",
|
||||
rule_order.BY_TRIGGER))
|
||||
# Read before retirement: a rule that enforces does so on every act it
|
||||
# reaches, however often this session has been shown it.
|
||||
# reaches, however often this session has been shown it. A rule with
|
||||
# triggers of its own stops only an act one of them matched: its
|
||||
# triggers name the acts it governs, and its moment is broader (a
|
||||
# rule about pushing to `main` mounted on work.deliver would hold
|
||||
# every push to `dev`). Reached by the mount alone, it is a line.
|
||||
triggered = board.triggered if board is not None else set()
|
||||
decision = act_decision(
|
||||
[(rule, at, where) for rule, at, where, _s in cands], held=moment.held,
|
||||
[(rule, at, where) for rule, at, where, spec in cands
|
||||
if spec == rule_order.BY_TRIGGER or rule.id not in triggered],
|
||||
held=moment.held,
|
||||
)
|
||||
gone = await _retired(io, moment, [rule for rule, _a, _w, _s in cands])
|
||||
if gone:
|
||||
|
||||
Reference in New Issue
Block a user