Repository navigation
Fixes #34815: Summarize local Java test runs in the PR description and post the details as a comment - #35297
Conversation
The block make java_affected_run ARGS="--update-pr" writes into the PR description listed every class each step ran, why the plan chose them, the impacted tests it could not run, and the commands. Typical PRs carried 4-6k characters of it, 35-63% of the description; on #35011 it took 56,147 of 62,906. 31,830 of those were a bug: a step that --ci-run covers has no local reports, so every class in its lane was listed as "selected but produced no report". - The description gets a summary: the verdict, the step table, up to 10 failed, report-less or all-skipped names, and counts of the impacted tests not run locally and of impact-map gaps. - The details go to target/java-tests/local-pr-results-details.md. --update-pr posts them as one PR comment, marked <!-- local-java-test-results:details -->, links it from the summary, and edits it on a re-run. Only the current gh user's comment is edited. - A step a CI run covers no longer reports missing classes. - The README, the PR template, java-affected-tests and pr-checklist describe the split, and ADR:2026-10-12-local-java-test-details-go-in-a-pr-comment records it.
| if len(details) > GITHUB_BODY_LIMIT: | ||
| print( | ||
| f"\nThe details are {len(details):,} characters, over GitHub's limit of " | ||
| f"{GITHUB_BODY_LIMIT:,} for a comment. Attach {DETAILS_MARKDOWN} to the PR instead.", | ||
| file=sys.stderr, | ||
| ) | ||
| return "" |
There was a problem hiding this comment.
💡 Edge Case: Earlier details comment is left stale when a re-run posts no details
upsert_details_comment returns before it looks for the user's earlier marked comment when the details go over 65,536 characters. main() skips the call completely when a re-run has no details (a NOT NEEDED plan). In both cases the summary in the description is updated and has no link, but the earlier <!-- local-java-test-results:details --> comment stays on the PR. That comment still shows an older commit's verdict, for example "FAILED — details", and its class list. The warning also tells the author to "Attach … to the PR instead", but the PR description itself says attachments can't be uploaded through gh or the API. Fix: when there are no details to post, or they are too long, find the earlier comment and PATCH it with a short note that it is superseded (marker kept), or delete it. Also change the warning so it doesn't suggest an attachment.
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 closed / 1 findings🟡 Medium risk · The planner now posts or edits marked PR comments and updates descriptions, so faulty matching could overwrite a comment or misstate local test results. Moves the Java local test run details out of the PR description into a marker-tagged PR comment, leaving a short summary with a link in the description. Approved with a suggestion: when a re-run has no details or they exceed the comment limit, the earlier details comment is left stale showing an older commit's verdict, and the over-limit warning suggests attaching a file, which 💡 Edge Case: Earlier details comment is left stale when a re-run posts no details📄 .github/scripts/plan_local_java_tests.py:2464-2470 📄 .github/scripts/plan_local_java_tests.py:2786-2789
🤖 Prompt for agentsVerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledOptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #34815
The block that
make java_affected_run ARGS="--update-pr"writes into the PR description buried the description of the change. It listed every class each step ran, why the plan chose them, the impacted tests it couldn't run, and the commands. Measured on real PR bodies, typical PRs (#34979, #35034, #35042) carried 4–6k characters of it, 35–63% of the description. On #35011 it took 56,147 of the description's 62,906 characters, close to GitHub's 65,536 limit.31,830 of those #35011 characters were a bug. A step that
--ci-runcovers has no local reports, somissing_classeslisted every class in its lane as "Selected but produced no report".This PR keeps the description to a summary and moves everything else to one PR comment that the summary links to.
Planner (
.github/scripts/plan_local_java_tests.py)target/java-tests/local-pr-results-details.md.--update-prposts them as one PR comment marked<!-- local-java-test-results:details -->and links it from the block.ghuser's comment is edited, so a teammate's run posts its own.render_blockdrops its unusedplannerparameter.Replaying three real runs through
main's renderer and this one (the rebuild matches the published blocks to within 19 characters):Docs
.github/java-tests/README.md, the PR template, thejava-affected-testsandpr-checklistskills, and thejava_affected_runhelp in the Makefile now describe the split.pr-checklistnow asks for the class list in the details comment rather than in the description.docs/decisions/2026-10-12-local-java-test-details-go-in-a-pr-comment.md. Only the README cites it: Collate runs this planner byte for byte, and its citation checker would reject an OSS-only record.Collate counterpart: to follow. openmetadata-collate's planner is still byte-identical to
main's, so this file drops in. Its tests, README andpr-checklistneed the same edits.Type of change:
High-level design:
Approach. Two renderers share one run:
render_blockbuilds the summary for the description.render_detailsbuilds the rest.attention_lineswrites the failed, no-report and all-skipped lists for both, at a different cap each.main()writes both files, posts the details first so the summary can link them, then upserts the summary between the existinglocal-java-test-resultsmarkers.Comment upsert.
gh api usergives the login.gh api --paginate …/issues/<n>/commentswith a jq filter finds that user's comment carrying the marker. Then a PATCH or POST, with the body sent as JSON on stdin.Alternatives rejected:
<details>block in the description: it only hides text, and the description still counts against GitHub's limit..txtattachment: neitherghnor the API can upload attachments.Compatibility. The markers and file paths for the description are unchanged. Old PRs keep their old block until their next
--update-prreplaces it. Withoutgh, the author pastes the summary and posts the details withgh pr comment --body-file target/java-tests/local-pr-results-details.md. A later--update-prfinds that comment by its marker and edits it.Tests:
Use cases covered
--ci-runcovers some lanes: none of those lanes' classes is reported missing.--update-pr:Unit tests
.github/scripts/test_plan_local_java_tests.py: 52 pass, 2 fail. Both failures are already onmain:IdBatchesIT(added by Fixes #35041: Batch the 2.1.0 creation-audit and DQ dimension backfills by entity id #35043) has no area in the impact map, and--check-mapreports the same. New or extended tests:test_steps_a_ci_run_covers_are_not_run_locallynow also checks that no covered class is reported missing. It fails onmainwith the lane's classes.test_the_pr_description_gets_a_summary_and_a_comment_gets_the_detailstest_the_details_comment_is_posted_once_then_edited_in_placeuses a fake GitHub that keeps comments.test_update_pr_posts_the_details_and_links_them_from_the_summaryrunsmain()with onlyghfaked. With the link dropped from the summary on purpose, it fails.attention_lines: lost failures and all-skipped classes;--update-prpath, which I ran by hand (below).Backend integration tests
Local Java test run: NOT NEEDED — no Java unit or integration test is impacted.
953a144b0071(baseorigin/main)Ingestion integration tests
Playwright (UI) tests
Manual testing performed
--runon a NOT NEEDED plan wrote the summary and removed a stale details file.gh api --paginateon Fixes #35191: let Data Consumers create memories and asset readers find them in search #35011's real comments (read-only). It returns nothing for the marker, and the matching IDs for a substring that is present.--check-branchis clean.scripts/harness/check_decision_records.pyis clean.mainalready has.UI screen recording:
Not applicable — no UI change.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.docs/decisions/2026-10-12-local-java-test-details-go-in-a-pr-comment.md.🤖 Generated with Claude Code