Skip to content

Fixes #34815: Summarize local Java test runs in the PR description and post the details as a comment - #35297

Merged
mohityadav766 merged 1 commit into
mainfrom
ci/java-local-results-summary
Oct 13, 2026
Merged

mohityadav766 merged 1 commit into
mainfrom
ci/java-local-results-summary

Conversation

@mohityadav766

Copy link
Copy Markdown
Member

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-run covers has no local reports, so missing_classes listed 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)

  • The description's block keeps the verdict, commit, finish time and step table. It also names up to 10 each of failed tests, selected classes that left no report, and classes whose every test was skipped, then says "and N more in the details". Impacted tests not run locally and impact-map gaps become one count line each.
  • The details cover every class each step ran, "Why these tests", the not-run list, the gaps and the commands.
    • They are written to target/java-tests/local-pr-results-details.md.
    • --update-pr posts them as one PR comment marked <!-- local-java-test-results:details --> and links it from the block.
    • A re-run edits that comment. Only the current gh user's comment is edited, so a teammate's run posts its own.
    • Details over GitHub's 65,536-character comment limit aren't posted, and the block goes without the link. The details cap each name list at 100.
  • Bug fix: a step a CI run stands in for no longer reports missing classes.
  • render_block drops its unused planner parameter.

Replaying three real runs through main's renderer and this one (the rebuild matches the published blocks to within 19 characters):

PR Block today Block in the description now Details comment
#35011 56,147 chars, 118 lines 1,834 chars, 23 lines 22,844 chars
#35034 (failed run) 5,896 chars, 59 lines 1,081 chars, 19 lines 5,325 chars
#35042 4,992 chars, 44 lines 820 chars, 14 lines 4,526 chars

Docs

  • .github/java-tests/README.md, the PR template, the java-affected-tests and pr-checklist skills, and the java_affected_run help in the Makefile now describe the split.
  • pr-checklist now asks for the class list in the details comment rather than in the description.
  • The decision record is 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 and pr-checklist need the same edits.

Type of change:

  • Improvement

High-level design:

  • Approach. Two renderers share one run:

    • render_block builds the summary for the description.
    • render_details builds the rest.
    • attention_lines writes 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 existing local-java-test-results markers.

  • Comment upsert. gh api user gives the login. gh api --paginate …/issues/<n>/comments with 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:

    • Collapsing the details in a <details> block in the description: it only hides text, and the description still counts against GitHub's limit.
    • A .txt attachment: neither gh nor the API can upload attachments.
    • A gist: it lives outside the repository, and for Collate it would put a private repository's test names behind a link anyone can open.
  • Compatibility. The markers and file paths for the description are unchanged. Old PRs keep their old block until their next --update-pr replaces it. Without gh, the author pastes the summary and posts the details with gh pr comment --body-file target/java-tests/local-pr-results-details.md. A later --update-pr finds that comment by its marker and edits it.

Tests:

Use cases covered

  • A run where --ci-run covers some lanes: none of those lanes' classes is reported missing.
  • A failed run: the description names the first 10 failures and points at the comment for the rest.
  • --update-pr:
    • The first run posts the details comment and links it from the description.
    • A re-run edits the same comment.
    • A teammate's details comment is left alone.
  • Details over the comment limit: no comment, and the description goes without the link.
  • A NOT NEEDED plan: the summary only, and a stale details file from an earlier run is removed.

Unit tests

  • .github/scripts/test_plan_local_java_tests.py: 52 pass, 2 fail. Both failures are already on main: 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-map reports the same. New or extended tests:
    • test_steps_a_ci_run_covers_are_not_run_locally now also checks that no covered class is reported missing. It fails on main with the lane's classes.
    • test_the_pr_description_gets_a_summary_and_a_comment_gets_the_details
    • test_the_details_comment_is_posted_once_then_edited_in_place uses a fake GitHub that keeps comments.
    • test_update_pr_posts_the_details_and_links_them_from_the_summary runs main() with only gh faked. With the link dropped from the summary on purpose, it fails.
  • Coverage: 73 of the 78 changed planner statements run (93.6%, pytest-cov). The 5 that don't:
    • two branches moved unchanged into attention_lines: lost failures and all-skipped classes;
    • the map-gap count line;
    • two lines of the NOT NEEDED and no---update-pr path, which I ran by hand (below).

Backend integration tests

  • Not applicable (no backend change). The planner plans no Java tests for this branch:

Local Java test run: NOT NEEDED — no Java unit or integration test is impacted.

  • Commit: 953a144b0071 (base origin/main)

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

UI screen recording:

Not applicable — no UI change.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable, no schema change.
  • For a UI feature or feature task: not applicable, no UI change.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Decision check: adds docs/decisions/2026-10-12-local-java-test-details-go-in-a-pr-comment.md.
  • I have added tests around the new logic.

🤖 Generated with Claude Code

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.
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 13, 2026
Comment on lines +2464 to +2470
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 ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 👍 / 👎

@gitar-bot

gitar-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
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 gh and the API cannot do.

💡 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

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.

🤖 Prompt for agents
Code Review: 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 `gh` and the API cannot do.

1. 💡 Edge Case: Earlier details comment is left stale when a re-run posts no details
   Files: .github/scripts/plan_local_java_tests.py:2464-2470, .github/scripts/plan_local_java_tests.py:2786-2789

   `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.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@mohityadav766 mohityadav766 self-assigned this Oct 13, 2026
@mohityadav766
mohityadav766 added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 4984566 Oct 13, 2026
72 checks passed
@mohityadav766
mohityadav766 deleted the ci/java-local-results-summary branch October 13, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run Java integration tests only in the merge queue, with an impact-mapped local run before review

2 participants