Evaluate stack policy against the effective base and emit stack events #52

Open AtlantisPleb opened this 4h ago

Outcome

Policy for every stacked PR evaluates against the stack's trunk, never against an intermediate feature branch, and stack membership is visible in payloads and events.

Context

docs/stacked-prs.md sections 5.7–5.8, 11.1–11.2, and 16 define the split. A lower PR that edits CODEOWNERS or workflow definitions must not weaken requirements for the layers above it before it lands. The forge has no webhooks yet; event delivery uses the transactional outbox pattern already present (repository_provisioning_outbox, graph_mutation_outbox) plus PubSub broadcasts.

Acceptance criteria

  • Stack evaluation carries both bases: the direct base for diffs and display, the effective trunk base for policy resolution.
  • Policy configuration resolves from the effective base tree, not the parent branch tree; after a layer lands on trunk, later evaluations see the new policy legitimately.
  • PR payloads include stack context: number, position, size, health, and the effective base ref and OID.
  • The event catalog covers stack created, appended, restructured, dissolved, rebase started/conflicted/completed, and merge lifecycle events, each carrying stack id and number, operation id, version, actor, old and new ordering, and affected head OIDs.
  • Events persist through an outbox with consumer deduplication by event id.

Verification

Tests proving a CODEOWNERS edit in position 1 does not change requirements at position 2 pre-merge, payload shape assertions, and outbox delivery tests. Run mix precommit.

Dependencies

Stack schema (#47). Branch protection and rulesets do not exist yet on the forge; this issue delivers the plumbing and consumes them when they land.

  1. AtlantisPleb opened this issue 4h ago
Sign in with GitHub to comment on this issue.