Skip to content

Commit 3aba8cd

Browse files
anth-volkclaude
andcommitted
Say every PR needs a tracking issue, and test two more lookup paths
- README: every PR needs a tracking issue, not only non-trivial work, now that the PR description check fails without one. - AGENTS.md: list the PR description job alongside the rest of PR CI. - Test that gh api's HTTP 410 (a deleted issue) reports a missing issue, like HTTP 404. - Test that the dependency-update script replaces a "Fixes #" line that is the open update PR's whole description. The new tests cover existing behaviour, so they passed when added. Part of #861. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0957d7b commit 3aba8cd

4 files changed

Lines changed: 24 additions & 4 deletions

File tree

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ same-repository draft PR.
7979
- API integration tests live in `projects/policyengine-apis-integ`.
8080
- PR CI runs simulation unit tests, Ruff format checks, quality guards
8181
(including the rules registry), Docker build, and local integration tests.
82+
A separate `PR description` job checks that every open PR's description
83+
starts with `Fixes #ISSUE_NUMBER` for an open issue in this repository.
8284
- There is currently no repository-wide changelog fragment requirement.
8385

8486
## Safety Boundaries

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ See [AGENTS.md](AGENTS.md) and
147147
for the canonical same-repository draft PR workflow.
148148

149149
1. Create a feature branch (never commit to `main`).
150-
2. Open a GitHub issue for non-trivial work; put `Fixes #ISSUE_NUMBER` as the
151-
first line of the PR description.
150+
2. Open a GitHub issue for the work; put `Fixes #ISSUE_NUMBER` as the first
151+
line of the PR description. Every PR needs one: the `PR description` check
152+
fails otherwise.
152153
3. Make changes and run the relevant tests locally.
153154
4. Open a same-repository draft PR: `make push-pr-branch`, then
154155
`gh pr create --draft`.

‎projects/policyengine-simulation-entry/tests/test_pr_description_check.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,17 @@ def test_a_pull_request_number_fails(fakes, tmp_path):
309309
assert "#857 is a pull request, not an issue." in _error_annotation(result)
310310

311311

312-
def test_a_missing_issue_fails(fakes, tmp_path):
312+
@pytest.mark.parametrize(
313+
"gh_error",
314+
[NOT_FOUND_STDERR, "gh: This issue was deleted (HTTP 410)"],
315+
)
316+
def test_a_missing_issue_fails(fakes, tmp_path, gh_error):
313317
result = _run_check(
314318
fakes,
315319
tmp_path,
316320
"Fixes #999999\n",
317321
FAKE_GH_STDOUT=NOT_FOUND_STDOUT,
318-
FAKE_GH_STDERR=NOT_FOUND_STDERR,
322+
FAKE_GH_STDERR=gh_error,
319323
FAKE_GH_EXIT="1",
320324
)
321325

‎projects/policyengine-simulation-entry/tests/test_workflow_scripts.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,19 @@ def test_create_pr_replaces_an_earlier_fixes_line_on_the_open_update_pr(
461461
assert descriptions == f"Fixes #870\n{rest}\n"
462462

463463

464+
def test_create_pr_replaces_a_fixes_line_that_is_the_whole_description(fakes, tmp_path):
465+
result, descriptions = _create_pr(
466+
fakes,
467+
tmp_path,
468+
FAKE_OPEN_PR="900",
469+
FAKE_OPEN_PR_BODY="Fixes #860",
470+
FAKE_OPEN_ISSUES="870\n",
471+
)
472+
473+
assert result.returncode == 0, result.stderr
474+
assert descriptions == "Fixes #870\n"
475+
476+
464477
def test_create_pr_leaves_an_open_update_pr_that_names_the_tracking_issue(
465478
fakes, tmp_path
466479
):

0 commit comments

Comments
 (0)