From 8793bbff84063dfe733c621cb2338daf44978376 Mon Sep 17 00:00:00 2001 From: chaofengw Date: Wed, 2 Dec 2026 06:20:56 +0000 Subject: [PATCH 1/3] ci(community): allow 60 minutes for Stable C++ builds Stable's Community CPU C++ build took 30 minutes for #2825 and 34.5 minutes for #2832, against a 45-minute limit, and grows with every family. Give it the 60 minutes and 120-minute job limit that ci/developer already uses (#2831), so a slow runner does not fail every pull request. Signed-off-by: chaofengw --- .github/workflows/community-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/community-ci.yml b/.github/workflows/community-ci.yml index 503e34f721..f09661def4 100644 --- a/.github/workflows/community-ci.yml +++ b/.github/workflows/community-ci.yml @@ -589,9 +589,9 @@ jobs: name: Community CPU / Unit / C++ and Python needs: authorize runs-on: ubuntu-24.04 - timeout-minutes: 65 + timeout-minutes: 120 env: - CPP_BUILD_TIMEOUT: 45m + CPP_BUILD_TIMEOUT: 60m permissions: contents: read steps: From b185b0c49b1ccd1dd0d86e2509d86bdde554494d Mon Sep 17 00:00:00 2001 From: chaofengw Date: Wed, 2 Dec 2026 06:20:56 +0000 Subject: [PATCH 2/3] fix(e2e_report): show lone surrogates instead of failing to write the report Evidence text decoded from JSON can hold a lone surrogate. The report escaped it into the HTML unchanged, so writing the page as UTF-8 raised UnicodeEncodeError and no report was produced. Escape such characters as visible backslash sequences, as ci/developer's report already does; valid non-ASCII text is unchanged. Signed-off-by: chaofengw --- tools/e2e_report.py | 4 +++- tools/tests/test_e2e_evidence.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/tools/e2e_report.py b/tools/e2e_report.py index 5e1bb9820b..1b0ec030af 100644 --- a/tools/e2e_report.py +++ b/tools/e2e_report.py @@ -143,7 +143,9 @@ def classification_index(logits: Any) -> tuple[int, int | float] | None: def _escape(value: Any) -> str: - return html.escape(str(value), quote=True) + # Keep malformed Unicode in recorded text from breaking the HTML document. + text = str(value).encode("utf-8", errors="backslashreplace").decode("utf-8") + return html.escape(text, quote=True) def _json(value: Any) -> str: diff --git a/tools/tests/test_e2e_evidence.py b/tools/tests/test_e2e_evidence.py index 57cf23ed79..4a3f2cca3b 100644 --- a/tools/tests/test_e2e_evidence.py +++ b/tools/tests/test_e2e_evidence.py @@ -124,6 +124,31 @@ def test_html_escapes_observations_and_never_executes_active_artifacts(tmp_path: assert "fetch(" not in report +def test_report_writes_lone_surrogates_as_visible_escapes(tmp_path: Path) -> None: + from tools.e2e_report import main as render_main + + case = tmp_path / "artifacts" / "example-case" + case.mkdir(parents=True) + text = "caf\u00e9 \u4e2d\u6587 \U0001f600 lone surrogate: \ud800" + evidence = { + "schema_version": 1, + "family": "example", + "case": "example-case", + "status": "passed", + "native": {"text": text}, + } + # json.dumps escapes the surrogate; json.loads in the report restores it. + (case / "evidence.json").write_text(json.dumps(evidence), encoding="utf-8") + output = tmp_path / "report.html" + + assert render_main([str(tmp_path / "artifacts"), "-o", str(output)]) == 0 + + report = output.read_text(encoding="utf-8") + assert "caf\u00e9 \u4e2d\u6587 \U0001f600" in report + assert "lone surrogate: \\ud800" in report + assert "\ud800" not in report + + def test_json_bound_preserves_failed_check_before_passed_details( tmp_path: Path, monkeypatch ) -> None: From 7d1f68a35b3cfa35113dceee9c33c8e7900c3a52 Mon Sep 17 00:00:00 2001 From: chaofengw Date: Wed, 2 Dec 2026 06:33:11 +0000 Subject: [PATCH 3/3] ci(community): keep waiting when a run lookup fails The Stable and Dev publishers poll the Community CI run under set -e, so one transient API error ends the job. On #2832 an HTTP 502 seven minutes in published "Community CI could not complete" although the run itself passed later. Warn and poll again on a failed lookup, within the same five-hour limit, as ci/developer already does. Signed-off-by: chaofengw --- .github/workflows/community-ci.yml | 6 ++- tools/tests/test_community_ci.py | 66 ++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/.github/workflows/community-ci.yml b/.github/workflows/community-ci.yml index f09661def4..c9b7e720e5 100644 --- a/.github/workflows/community-ci.yml +++ b/.github/workflows/community-ci.yml @@ -347,7 +347,11 @@ jobs: fi deadline=$((SECONDS + 18000)) while [ "$SECONDS" -lt "$deadline" ]; do - run="$(gh api "/repos/$GITHUB_REPOSITORY/actions/runs/$PIPELINE_RUN_ID")" + if ! run="$(gh api "/repos/$GITHUB_REPOSITORY/actions/runs/$PIPELINE_RUN_ID")"; then + echo "::warning::Community CI observation is unavailable; the existing run is still authoritative." + sleep 30 + continue + fi if [ "$(jq -r '.status' <<< "$run")" = completed ]; then # GitHub may return a placeholder title while a newly dispatched # run is initializing. Verify identity before publishing its result. diff --git a/tools/tests/test_community_ci.py b/tools/tests/test_community_ci.py index 2d155a7a18..94884966e5 100644 --- a/tools/tests/test_community_ci.py +++ b/tools/tests/test_community_ci.py @@ -1367,6 +1367,72 @@ def test_only_complete_pipeline_publishes_stable_and_dev_results( assert int((tmp_path / "counter").read_text()) == (2 if queued_first else 1) +def test_publisher_keeps_waiting_through_a_failed_run_lookup(tmp_path): + """A transient API error while observing the run must not publish a failure.""" + fake = tmp_path / "gh" + fake.write_text( + "#!/usr/bin/env python3\nimport json,os,sys\nfrom pathlib import Path\n" + "if any(a.startswith('/repos/') and '/actions/runs/' in a for a in sys.argv):\n" + " counter=Path(os.environ['COUNTER'])\n" + " count=int(counter.read_text())+1 if counter.exists() else 1\n" + " counter.write_text(str(count))\n" + " if count==1:\n" + " print('gh: Server Error (HTTP 502)', file=sys.stderr); sys.exit(1)\n" + " print(os.environ['RUN'])\n" + "else: Path(os.environ['CALLS']).write_text('\\n'.join(sys.argv[1:]))\n" + ) + fake.chmod(0o755) + sleep = tmp_path / "sleep" + sleep.write_text("#!/bin/sh\nexit 0\n") + sleep.chmod(0o755) + head, merge = "a" * 40, "b" * 40 + result = subprocess.run( + [ + "bash", + "-c", + _workflow_step_script( + "community-ci.yml", "dispatch", "Publish the complete workflow conclusion" + ), + ], + env={ + **os.environ, + "PATH": f"{tmp_path}:{os.environ['PATH']}", + "PIPELINE_RUN_ID": "42", + "CI_BRANCH": "main", + "LANE": "stable", + "PR_NUMBER": "17", + "HEAD_SHA": head, + "STATUS_CONTEXT": "Stable Community CI", + "SOURCE_SNAPSHOT": json.dumps({"merge_sha": merge}), + "GITHUB_SERVER_URL": "https://github.com", + "GITHUB_REPOSITORY": "example/source", + "GITHUB_OUTPUT": str(tmp_path / "output"), + "CALLS": str(tmp_path / "calls"), + "COUNTER": str(tmp_path / "counter"), + "RUN": json.dumps( + { + "path": ".github/workflows/community-ci.yml", + "event": "workflow_dispatch", + "head_branch": "main", + "display_title": f"Stable Community CI · PR #17 · head {head} · merge {merge}", + "status": "completed", + "conclusion": "success", + } + ), + }, + capture_output=True, + text=True, + ) + + assert result.returncode == 0, result.stderr + assert "observation is unavailable" in result.stdout + assert int((tmp_path / "counter").read_text()) == 2 + calls = (tmp_path / "calls").read_text().splitlines() + assert "state=success" in calls + assert "context=Stable Community CI" in calls + assert (tmp_path / "output").read_text() == "reported=true\n" + + @pytest.mark.parametrize("ready_after", [1, 2, 7]) def test_pr_trigger_waits_for_github_merge_generation_with_a_bounded_retry(tmp_path, ready_after): head, base, merge, tree = (value * 40 for value in "abcd")