Repository navigation
feat(provider-github): reopened issues and PRs reopen their closed work item - #287
Open
ccf-lisa[bot] wants to merge 1 commit into
Open
ccf-lisa[bot] wants to merge 1 commit into
ccf-lisa[bot] wants to merge 1 commit into
Conversation
gusfcarvalho
approved these changes
Dec 1, 2026
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.
Task:
reopen-2(reopen events, provider and rule)Summary
If you reopen a work item's primary issue or PR, the item now reopens too. When the primary link is closed,
close-on-primary-closedsetslifecycle: closedon the item, and from then onclosed-gatesuppresses every rule. The factory never mapped GitHub'sreopenedaction, so reopening the primary link didn't undo that. Real case: compliance-framework/docs#220 was closed and reopened. Its implement run then opened docs#229, but the review was never dispatched.Stack: this is PR 2 of 2. It is based on #286 (
fx/reopen-1-events-contract), which adds theissue.reopened/pr.reopenedevent types.Provider (
internal/provider/github/normalise.go)issues.reopenedmaps toissue.reopened, andpull_request.reopenedmaps topr.reopened. Each one gets the same object ref, facts (issue{title, labels, body}/pr{draft, head, base}) and contentRef asissue.closed/pr.closed.issue.closedin a train repo reads the train state.testdata/golden/, all intestdata/webhooks/:issues.reopenedissues.reopened-train: a train issue inworkflows, which carries notrainfactpull_request.reopenedCatalog
catalog/rules/shared/reopen-on-primary-reopened.yaml:[issue.reopened, pr.reopened].item.links.exists(l, l.primary == true && l.ref == event.object.ref).set: { lifecycle: open }.pack: shared. Every RuleSet selects the shared pack by label (matchExpressions … values: [<pack>, shared]), so the rule is included wherever close-on-primary-closed is, and no RuleSet changes.closed-gatestill does not listen on the reopened types; this is the one deliberate exception, and its header comment now says so.TestClosedGateexempts those two types, and fails if closed-gate ever lists one of them.catalog_test.go: the new rule is added to the rule list and tosharedRules, which covers the expected RuleSet overlap.factory rules testfixtures:catalog/testdata/reopened-epic-issue: a closed item whose primary issue is reopened ends withlifecycle: open, with one decision.catalog/testdata/reopened-non-primary-pr: a closed item whose non-primary PR is reopened has no decisions and staysclosed.GitHub App subscription
The App already subscribes to Issues and Pull request (
deploy/poc/README.md, Events row), and GitHub delivers thereopenedaction as part of those events. No manifest in the repo lists actions, so nothing changes there.Verification
go test ./internal/provider/github/ -run 'TestNormalise': the new rows and goldens pass, and no existing golden changed.go run ./cmd/factory rules test --catalog catalog --coverage: 68 cases, 68 ok, 0 differ, and 22 of 22 selected rules fire in some case.make reviewable: check-generated, lint (0 issues), catalog and openapi-lint (100/100) pass. All tests pass exceptTestBaseScriptRuns(internal/agent/host/provision). That test fails the same way onmainon macOS, because it needs/etc/os-release. It is unrelated to this PR, and CI runs it on Linux.Notes
github-provider.mdstill says there are 35 payloads. That count was already out of date before this PR.🤖 Generated with Claude Code