Repository navigation
Serialize updates to the pull request body #1230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
15878ae
3f5a27c
65ef54e
e48e7d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -467,7 +467,8 @@ def test_pr_body_is_unchanged_when_checks_are_unchanged(wt: Path, gh: FakeGh, ca | |
| before = len(gh.calls) | ||
| assert run(capsys, command)[0] == 0 | ||
| history = HISTORY_CALLS if command == "pr" else [] | ||
| assert [c["argv"][:2] for c in gh.calls[before:]] == history + LOOKUP_CALLS | ||
| refresh = [["api", f"repos/{REPO}/pulls/7"]] if command == "pr" else [] | ||
| assert [c["argv"][:2] for c in gh.calls[before:]] == history + LOOKUP_CALLS + refresh | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("body", [ | ||
|
|
@@ -498,6 +499,25 @@ def test_check_refresh_replaces_previous_head_without_losing_evidence( | |
| assert text in updated | ||
|
|
||
|
|
||
| def test_delayed_check_preserves_review_summary(wt, gh, fake_bin, capsys, monkeypatch): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Regression test checks the stale-read fix but not the lock
|
||
| head = prepare_review(wt, gh, fake_bin) | ||
| body = "# PR\n\n## Notes\nHuman evidence.\n" | ||
| gh.respond_pr_list([pr_json(headRefOid=head, body=body)]) | ||
| git(wt, "push", "-q", "-u", "origin", "lz/t1") | ||
| refresh = cli._refresh_pr_checks | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Delayed-check test no longer exercises a stale read The test now wraps |
||
|
|
||
| def delay(path, config): | ||
| assert run(capsys, "review")[0] == 0 | ||
| live = json.loads(gh.calls[-1]["--input"])["body"] | ||
| gh.respond(f"api repos/{REPO}/pulls/7", rest_pr_json(pr_json(headRefOid=head, body=live))) | ||
| refresh(path, config) | ||
|
|
||
| monkeypatch.setattr(cli, "_refresh_pr_checks", delay) | ||
| assert run(capsys, "check")[0] == 0 | ||
| final = json.loads(gh.calls[-1]["--input"])["body"] | ||
| assert all(text in final for text in ("Human evidence.", "Recorded for", "- primary, claude")) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("command,exit_code", [("check", 0), ("pr", 1)]) | ||
| def test_malformed_live_markers_do_not_mask_check_verdict( | ||
| wt: Path, gh: FakeGh, capsys, command: str, exit_code: int, | ||
|
|
@@ -1085,7 +1105,7 @@ def test_pr_updates_existing_open_pr(wt: Path, gh: FakeGh, capsys) -> None: | |
| code, out, _ = run(capsys, "pr") | ||
| assert code == 0 and out == URL + "\n" | ||
| assert [c["argv"][:2] for c in gh.calls] == ( | ||
| HISTORY_CALLS + LOOKUP_CALLS + [["api", f"repos/{REPO}/pulls/7"]]) | ||
| HISTORY_CALLS + LOOKUP_CALLS + [["api", f"repos/{REPO}/pulls/7"]] * 2) | ||
| assert "(no `loopzero check` run recorded)" in gh.calls[-1]["--input"] | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Paragraph has an awkward line break
The new sentence leaves 'CI and branch protection' alone on a short line, with 'provide the hosted enforcement' on the next line. Reflow the paragraph so the Markdown source reads normally.