Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(ci): preserve GraphQL identifier types (#6173)

LearningCircuitaffc6cf26b6e
diff --git a/scripts/ci/update_oldest_auto_merge_pr.py b/scripts/ci/update_oldest_auto_merge_pr.py
index cfae7ae958..a9d51701b4 100644
--- a/scripts/ci/update_oldest_auto_merge_pr.py
+++ b/scripts/ci/update_oldest_auto_merge_pr.py
@@ -399,9 +399,9 @@ def update_pull_request(
"graphql",
"-f",
f"query={UPDATE_BRANCH_MUTATION}",
- "-F",
+ "-f",
f"pullRequestId={current['id']}",
- "-F",
+ "-f",
f"expectedHeadOid={expected_head_sha}",
]
)
diff --git a/tests/ci/test_update_oldest_auto_merge_pr.py b/tests/ci/test_update_oldest_auto_merge_pr.py
index 08e6216fbf..124c7f362f 100644
--- a/tests/ci/test_update_oldest_auto_merge_pr.py
+++ b/tests/ci/test_update_oldest_auto_merge_pr.py
@@ -285,11 +285,16 @@ def test_empty_selection_is_a_successful_no_op(monkeypatch, tmp_path):
def test_update_revalidates_and_uses_expected_head_sha(monkeypatch, tmp_path):
calls = []
summary = tmp_path / "summary"
+ # ``gh api -F`` only coerces a value to a JSON number when it parses
+ # within int64 (max ~1.8e19); an all-``1`` 40-char SHA overflows that
+ # range and would already be sent as a string. Use a SHA whose digits
+ # parse within int64 so this test exercises the coercion ``-f`` avoids.
+ int64_coercible_head_sha = "0" * 37 + "123"
def fake_gh(args):
calls.append(args)
if args[:2] == ["pr", "view"]:
- return pull_request(55)
+ return pull_request(55, headRefOid=int64_coercible_head_sha)
return {
"data": {"updatePullRequestBranch": {"pullRequest": {"number": 55}}}
}
@@ -300,7 +305,7 @@ def test_update_revalidates_and_uses_expected_head_sha(monkeypatch, tmp_path):
"example/project",
"main",
number=55,
- expected_head_sha=HEAD_A,
+ expected_head_sha=int64_coercible_head_sha,
step_summary=summary,
)
@@ -312,8 +317,12 @@ def test_update_revalidates_and_uses_expected_head_sha(monkeypatch, tmp_path):
query_argument = update_call[update_call.index("-f") + 1]
assert "updatePullRequestBranch" in query_argument
assert "mergePullRequest" not in query_argument
- assert "pullRequestId=PR_example_55" in update_call
- assert f"expectedHeadOid={HEAD_A}" in update_call
+ pull_request_id_index = update_call.index("pullRequestId=PR_example_55")
+ expected_head_index = update_call.index(
+ f"expectedHeadOid={int64_coercible_head_sha}"
+ )
+ assert update_call[pull_request_id_index - 1] == "-f"
+ assert update_call[expected_head_index - 1] == "-f"
assert "Branch update accepted." in summary.read_text()
@@ -357,6 +366,45 @@ def test_fork_authorization_error_explains_classic_pat_requirement(
assert len(calls) == 2
+def test_fork_authorization_hint_uses_captured_gh_stderr(monkeypatch, tmp_path):
+ candidate = pull_request(
+ 55,
+ isCrossRepository=True,
+ maintainerCanModify=True,
+ )
+ monkeypatch.setattr(updater, "fetch_pull_request", lambda *_args: candidate)
+
+ def failed_gh_run(*_args, **_kwargs):
+ # The real ``subprocess.run(command, ...)`` call passes the full
+ # ``gh`` argv positionally as the first argument; assert on it so
+ # this test also confirms the mutation is sent via ``-f`` (not
+ # ``-F``), the actual fix under test.
+ assert _args[0][:4] == ["gh", "api", "graphql", "-f"]
+ return updater.subprocess.CompletedProcess(
+ args=["gh", "api", "graphql"],
+ returncode=1,
+ stdout="",
+ stderr=(
+ "GraphQL: user doesn't have permission to update head "
+ "repository\n"
+ ),
+ )
+
+ monkeypatch.setattr(updater.subprocess, "run", failed_gh_run)
+
+ with pytest.raises(
+ updater.UpdaterError,
+ match=r"classic PAT with public_repo and workflow scopes",
+ ):
+ updater.update_pull_request(
+ "example/project",
+ "main",
+ number=55,
+ expected_head_sha=HEAD_A,
+ step_summary=tmp_path / "summary",
+ )
+
+
@pytest.mark.parametrize(
"change",
[