Repository navigation
Cap the doc-health nightly's regression-issue body (fixes the red finalize since 2026-09-05) - #1121
Conversation
… failed create from failing finalize doc-health-nightly's `finalize` job has reddened every scheduled run since ~2026-09-05 at "Open regression issue" (#1118): the step wrote one bullet per new critical/error finding straight into issue-body.md with no size cap, and once the regression list grew past GitHub's 65536-character createIssue limit, `gh issue create` failed (decisive log, run 35299844095: "GraphQL: Body is too long (maximum is 65536 characters) (createIssue)"), exiting 1 and reddening the job. The last issue it managed to open is opensoft/xFactory#236 (2026-09-04). Extracts the rendering into scripts/doc_health/regression_issue_body.py (`render(findings, run_date, cap_bytes=60000) -> (issue_body, full_list_md)`) because the fix needs the same rendering in two places in one job run: "Open regression issue" is conditional and sits near the end of a long `finalize` job, but "Upload report artifact" -- which now also carries new-findings.md, the full unabridged list, so nothing found is ever lost even when the issue body itself is capped -- runs much earlier, right after new-findings.json is produced. Both call sites pass cap_bytes=60000 explicitly (bytes, not characters -- bytes upper-bound characters for any UTF-8 string, so a 60000-byte cap is always safely under the 65536- character GitHub limit). `gh issue create` is now guarded with `|| echo "::warning::..."`, mirroring the sibling "Supersede stale regression issues" step's stated posture: "Every gh call is guarded so this step can never fail the nightly." Adds tests/doc-health/test_regression_issue_body_cap.py: structural checks on the workflow (step name/if/env unchanged, the cap constant and guard present, new-findings.md written before and collected by "Upload report artifact") plus unit tests on render() itself, including 5000 synthetic findings forcing truncation and small-cap edge cases that caught a real off-by-N bug in the byte-budget reservation during development. Lane: openxfactory-1 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Reviewer's GuideThe fix prevents oversized doc-health regression issue bodies from reddening nightly finalization by rendering them under a 60000-byte limit and making issue creation non-fatal, while uploading an unabridged findings list as an artifact. Rendering is shared in a dedicated module and covered by workflow-structure and edge-case tests. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟡 Changes recommended
One new test performs thousands of large-string substring scans in a loop, which is unnecessarily expensive and could slow or destabilize CI.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR fixes the doc-health reusable workflow’s nightly finalize job failing at the housekeeping step that opens a regression issue when the issue body exceeds GitHub’s 65,536-character limit. It introduces a capped issue-body renderer (byte-based), preserves the full unabridged findings list in uploaded artifacts, and guards gh issue create so issue-creation failures no longer fail the job.
Changes:
- Add
scripts/doc_health/regression_issue_body.pyto render a capped regression issue body while also producing the full findings markdown list for artifacts. - Update
.github/workflows/doc-health-reusable.ymlto (a) writenew-findings.mdearly enough to be included in the report artifact, (b) cap the issue body via the extracted renderer, and (c) makegh issue createnon-fatal. - Add
tests/doc-health/test_regression_issue_body_cap.pywith workflow-structure assertions and unit tests for byte-cap correctness and truncation behavior.
File summaries
| File | Description |
|---|---|
tests/doc-health/test_regression_issue_body_cap.py |
Adds structural tests for the workflow wiring plus unit tests for cap/truncation behavior of the renderer. |
scripts/doc_health/regression_issue_body.py |
New shared renderer that enforces a UTF-8 byte cap for the issue body while preserving a full findings list for artifacts. |
.github/workflows/doc-health-reusable.yml |
Wires the renderer into the nightly, uploads new-findings.md, caps issue bodies, and guards issue creation to keep finalize green. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…substring searches
tests/doc-health/test_regression_issue_body_cap.py::test_render_caps_a_large_list_and_names_the_full_count_and_omission
looped `for i in range(5000): assert f"fragment-{i:05d}.md" in full`,
doing 5000 individual substring searches over the large `full_list_md`
string (quadratic in the number of findings). Replace it with a single
regex pass: extract every `fragment-\d{5}.md` id from `full` with
re.findall, collect them into a set, and compare that set to the
expected `{f"fragment-{i:05d}.md" for i in range(5000)}` for exact
equality. This is linear in len(full) and, as a set comparison, also
catches any unexpected extra id that the naive per-id loop would have
missed.
python3 -m pytest tests/doc-health/test_regression_issue_body_cap.py -q
still passes all 11 tests; the flagged test's own runtime drops from
0.61s to 0.04s (full file: 2.25s -> 1.09s).
Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
It modifies a reusable GitHub Actions workflow that affects nightly operational behavior across repositories, so it warrants final human review despite strong test coverage.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
|
Brett Heap, 2026-09-21T20:32Z, in the lane session (verbatim): "land #1121 when green" — the landing word for this pull request (the nightly's regression-issue body cap, #1118). Recorded here so the Rule 6 LANDING line can cite it. Marking ready and landing when the gates read green. Lane: openxfactory-1 |
|
FREEZE — lane openxfactory-1, session 393ade52-a921-4dd9-9dc5-224ebc056651, 2026-09-21T20:32Z: head Lane: openxfactory-1 |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/doc-health-reusable.yml" line_range="2258-2259" />
<code_context>
+ # reuses the same renderer for its own capped issue-body.md.
+ python3 - "$RUN_DATE" <<'PY'
+ import json, sys
+ sys.path.insert(0, "openxFactory/scripts")
+ from doc_health.regression_issue_body import render
+ run_date = sys.argv[1]
+ findings = json.load(open("new-findings.json"))
</code_context>
<issue_to_address>
**issue (bug_risk):** The workflow imports `doc_health.regression_issue_body` from `openxFactory/scripts`, but this module is added to the reusable-workflow repository and the caller's `openxFactory` submodule is pinned independently. When the nightly consumes this workflow at `@main` before the caller advances that submodule pin, both inline Python blocks raise `ModuleNotFoundError`, so the suite/finalize job fails before the guarded issue creation can help.
**Triggers:** When a caller repository has not yet updated its pinned `openxFactory` submodule to a commit containing `regression_issue_body.py`.
**Suggested fix:** Either import the module from the workflow repository's checked-out path guaranteed to contain this commit, or update/enforce the caller submodule pin together with the workflow change and add a compatibility fallback.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the renderer or workflow wiring is wrong, a regression issue could be created with an incomplete or misleading body, and reverting would not remove that already-persisted issue; however, the full findings remain in the artifact and the issue is bounded and manually repairable.
Blocking findings: .github/workflows/doc-health-reusable.yml:2259
| sys.path.insert(0, "openxFactory/scripts") | ||
| from doc_health.regression_issue_body import render |
There was a problem hiding this comment.
issue (bug_risk): The workflow imports doc_health.regression_issue_body from openxFactory/scripts, but this module is added to the reusable-workflow repository and the caller's openxFactory submodule is pinned independently. When the nightly consumes this workflow at @main before the caller advances that submodule pin, both inline Python blocks raise ModuleNotFoundError, so the suite/finalize job fails before the guarded issue creation can help.
Triggers: When a caller repository has not yet updated its pinned openxFactory submodule to a commit containing regression_issue_body.py.
Suggested fix: Either import the module from the workflow repository's checked-out path guaranteed to contain this commit, or update/enforce the caller submodule pin together with the workflow change and add a compatibility fallback.
|
Lane: openxfactory-1 (openXfactory-1) LANDING — lane openxfactory-1, session 393ade52-a921-4dd9-9dc5-224ebc056651@Eagle, 2026-09-21T20:33:23Z, PR #1121 into opensoft/openxFactory main Guard at 2026-09-21T20:33:28Z on head |



Lane: openxfactory-1
Status: draft — do not land. Lands on Brett Heap's word.
The bug
opensoft/xFactory'sdoc-health-nightly(consuming.github/workflows/doc-health-reusable.yml@mainfrom this repo) hasconcluded
failureon every scheduled run since ~2026-09-05, always atfinalize/ "Open regression issue (one per run, contract regressionrule)". The step wrote one bullet per new critical/error finding straight
into
issue-body.mdwith no size cap, and once the regression list grewpast GitHub's 65536-character
createIssuelimit,gh issue createfailed. Decisive log line (run 35299844095, 2026-09-18 03:07:12Z):
The step then exits 1, reddening the whole
finalizejob at ahousekeeping step, hiding any real red elsewhere in the job. The last
issue it managed to open is
opensoft/xFactory#236(2026-09-04); noregression issue has opened since.
What changed
.github/workflows/doc-health-reusable.yml, two steps:"Run doc-health suite" — right after
new-findings.jsoniswritten, a new inline block writes the FULL, unabridged findings list
to
new-findings.md:This has to happen here, not inside "Open regression issue" itself:
that step is conditional (
if: new_count != '0') and sits near theend of a very long
finalizejob, well after "Upload reportartifact" already ran — too late for anything it writes to reach that
artifact. "Upload report artifact"'s
path:is broadened from asingle file to a list so it now collects
new-findings.mdtoo:So nothing found is ever lost, even when the issue body itself is
capped.
"Open regression issue (one per run, contract regression rule)"
(step name and
if:unchanged;env:still onlyGH_TOKEN) — thebody is now built by the same renderer, capped at 60000 UTF-8 bytes
(bytes, not characters: bytes upper-bound characters for any UTF-8
string, so 60000 bytes is always safely under the 65536-character
GitHub limit), and
gh issue createis guarded so a create failurecan never fail
finalizeagain:mirroring the sibling "Supersede stale regression issues" step's
stated posture ("Every gh call is guarded so this step can never fail
the nightly").
The cap/render logic is extracted into
scripts/doc_health/regression_issue_body.py(
render(findings, run_date, cap_bytes=60000) -> (issue_body, full_list_md)) rather than kept purely inline, precisely because bothcall sites above need it.
Tests
New
tests/doc-health/test_regression_issue_body_cap.py, 11 tests:test_open_regression_issue_step_name_and_condition_unchangedtest_open_regression_issue_step_calls_the_extracted_renderer_with_the_captest_gh_issue_create_is_guarded_so_a_failure_cannot_fail_finalizetest_run_doc_health_suite_writes_new_findings_md_before_the_upload_steptest_upload_report_artifact_step_collects_new_findings_md_tootest_render_returns_a_body_under_the_default_cap_for_a_small_listtest_render_caps_a_large_list_and_names_the_full_count_and_omission(5000 synthetic findings)test_render_body_bytes_never_exceed_a_small_cap_eithertest_render_raises_when_cap_bytes_cannot_even_hold_the_skeletontest_render_empty_findings_list_is_well_formedtest_module_default_cap_is_60000_matching_githubs_65536_character_limitWorth flagging: the first version of
render()'s byte-budget reservationundercounted the blank-line separators between sections and could exceed
its own cap at small
cap_bytesvalues —test_render_body_bytes_never_exceed_a_small_cap_either(50 findings, caps 1000–3000 bytes) caught it during development. Fixed by
measuring the fixed header/count/omitted-line overhead directly off the
same assembly function instead of hand-deriving it, so the reservation
cannot drift out of sync with what gets assembled.
Validation run
python3 -m pytest tests/doc-health -q→ 1908 passed, 7 pre-existingwarnings (unrelated
tarfiledeprecation notice), 0 failed. Run twice(before and after the rebase below) with the same result.
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/doc-health-reusable.yml'))"→ exits 0, no output (parses clean).
actionlint .github/workflows/doc-health-reusable.yml→ 9 findings,same 9 (identical file:code/message set, normalized for line-number
shift) as
origin/mainbefore this change — all pre-existing shellcheckstyle/info notes elsewhere in the file (SC2129/SC2086/SC2012/SC2015);
zero new findings.
python3 scripts/validate-code-surface.py .→ exit 0: "code_surface: 46active proposals, 46 declaring — 7
none, 31 a repository list, 8 namedby the register, 0 outside the grammar. … code_surface validation
passed (every active declaration's head is admitted)." This change
touches no
openspec/changes/proposal, so nocode_surface:declaration was demanded.
Merge-cleanliness proof
PR #1111 (
realize/citation-report-r2) merged intomainwhile thisbranch was in progress (
89d7975d9, 2026-09-18T20:03:40Z), inserting a"Citation remainder report" step immediately after "Upload report
artifact" — the same step this fix also touches. An initial scratch-worktree
git merge --no-commit --no-ff origin/mainagainst that landed stateproduced one conflict, purely mechanical: both sides touch the
path: ${{ steps.run.outputs.report_out }}line as their anchor (this fixrewrites it into a
path: |list; #1111 inserts its new step right afterit), with no overlap in intent. Resolved by rebasing this branch onto
current
origin/main— combining this fix's expandedpath:block with#1111's citation-remainder steps unchanged — then re-running the full
validation above against the rebased tree (all green, no new actionlint
findings). A second scratch-worktree
git merge --no-commit --no-ff origin/mainagainst the rebased branch returned "Already up to date"(exit 0): this branch now carries current
origin/mainas an ancestor, soit merges cleanly.
Not done
Nothing outstanding from the brief.
Lands on Brett Heap's word.
Refs #1118.
Lane: openxfactory-1
🤖 Generated with Claude Code
Summary by Sourcery
Keep doc-health nightly finalization green when regression findings exceed GitHub's issue-body limit while retaining the full findings list in artifacts.
Bug Fixes:
Enhancements:
Tests: