Skip to content

feat(update): redesign the PR description around the update table - #364

Merged
sweepies merged 4 commits into
mainfrom
feat/pr-body-redesign
Nov 23, 2026
Merged

sweepies merged 4 commits into
mainfrom
feat/pr-body-redesign

Conversation

@sweepies

@sweepies sweepies commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

What changed

The Count's PR description now follows the chosen "Minimalist Ledger" layout: a table you can read at a glance, with everything long collapsed.

  • Update table first, with the links. The package name links to its source repository and the version range (`a`&nbsp;→&nbsp;`b`) links to the compare view. The update type and security are <kbd> badges. Rows that move one package from the same version to the same target are merged into one, with the files separated by <br>. The links come from the release-notes fetch: intent() still hashes the unlinked rows, and Draft::push links a row once its fetch comes back, but only if the budget has room for the extra bytes (Body::reserve). Rows whose source is private, unresolved or beyond RELEASES_PER_BODY stay unlinked.
  • Security headline. A > [!IMPORTANT] line reads Fixes N known vulnerabilities (severity badges) in pkg. The advisory table follows the update table inside a collapsed <details> ("Security advisories (N fixed)"). It is sorted critical → high → moderate → low → unrated and has a "Fixed in" column. Image SBOM comparisons work the same way: the headline, warnings and notes are visible, and the table of fixed advisories is collapsed below the update table. The "drawing blood" line is gone.
  • Release notes. Notes::render takes a Naming. Each package's notes are one collapsed block: "Release notes · from → to" when the body has one notes range, the package name when it has several. There is no ### package heading or Source/Compare line any more. Truncation and "may be incomplete" notices sit inside the </details>. Empty notes, a missing source, an unsupported host and fetch failures are each one <sub> line. The short-single-release exception is gone, so notes are always collapsed.
  • Batch PR. The removal checklist moves into a collapsed <details> after the release notes ("Remove an update from this batch (N items)"), followed by the patchula-batch: items marker. Its size is reserved in the budget the way the controls are.
  • Footer. A Devin-style footer with the vector bat logo, pinned to the release via concat!(…, env!("CARGO_PKG_VERSION"), …), sits before the checkboxes. It is part of tail(), so it can never be cut. Markup copied from the reference files.
  • Checkbox wording. The boxes now read Re-check this PR {timing} and Add to the batch PR *(closes this PR and moves the update there)*. Both are still found by their trailing markers.
  • Rebasing banner. The banner is now a four-line > [!NOTE] alert between the markers, in the spec's exact wording for both a re-check and a lockfile rebuild. The base branch is still truncated and passed through text::code. without_banner now removes every run of quoted lines bounded by both marker lines, so one-line banners from older releases still come off. Stray-marker, CRLF and missing-line-break handling are unchanged.
  • Reuse. The render salt moves from notes-render-v6 to v7, so every open PR is rewritten once and reused after that.
  • Docs: guide/pull-requests.md (the banner and "The PR"), guide/release-notes.md, guide/security.md and guide/batch.md.

Before / after

Before After
Table plain text, no links package → source, range → compare, <kbd> badges, merged rows
Security IMPORTANT + "drawing blood" + visible advisory table above the update table one-line IMPORTANT headline; advisory table collapsed below the update table
Notes ### pkg + Source/Compare line + fold (short single release expanded) one fold per package; notices inside; empty = one <sub> line
Batch removal list visible at the top collapsed after the notes
Footer none avatar + "Count Patchula opened this PR" + sponsor line
Banner one blockquote line four-line NOTE alert

Budget

  • The footer adds 506 bytes to the tail. TAIL_RESERVE goes from 1,500 to 2,500, so the intent and notes leave the footer, the content and ownership markers, the re-check box and a server advert their room.
  • finish now also reserves the start line, the tail, the batch section, a 2-byte block break and room to close up to four <details> blocks a cut might leave open (48 bytes). As a result, a cut can't pull the footer into a collapsed block or turn the --- rule into a heading. reserved() counts the same bytes, so an oversized batch or permit marker is refused up front instead of being cut.
  • The "Out of room for more release notes" line (~110 bytes) is reserved when the draft starts, so it always fits.
  • PERMIT_RESERVE is unchanged (1,000). The permit fit now also subtracts the batch section.
  • The body stays within BODY_LIMIT (32,000).

Deviations from the spec

  • Severity badges are deduplicated with counts (<kbd>high</kbd>&nbsp;×2, <kbd>low</kbd>) rather than one badge per advisory, so a fix for many advisories doesn't produce a long headline. The reference case renders exactly as specified.
  • Rows merge in every PR, not only the batch. It's the same table code, and a grouped PR with one package in two files reads better merged.
  • An advisory table covering several packages gets a Package column. The spec's four-column table can't say which package an advisory belongs to in that case. Single-package tables are exactly as in the reference.
  • Naming follows notes ranges, not packages. Notes are labelled "Release notes" only when the body has one notes range. A plan with several ranges of the same package names the package in each block, so the blocks can be told apart.
  • The "(inferred tags)" label on compare links is dropped. The compare link moved into the table, which has no room for that label.
  • New parity row. The changelog state row moves to version 15 with its new source hash, because crates/notes/src/ changed and parity requires it.

Removed tests

The scope for this PR says not to pin PR-body wording or layout in tests. These tests were deleted, trimmed or renamed for that reason:

Deleted:

  • crates/update/src/pr/body/tests.rs: the_maintenance_body_has_no_empty_update_table
  • crates/update/src/pr/body/tests.rs: image_tests::a_fixing_rebuild_lists_its_advisories_with_old_and_new_versions
  • crates/update/src/pr/body/tests.rs: tooling_tests::each_tooling_warning_is_a_caution_in_the_design_wording (the whole tooling_tests module)
  • crates/update/src/pr/banner.rs: wording_follows_the_trigger_and_the_image_is_pinned_to_this_release (its branch-sanitising assertion survives as a_branch_name_cannot_break_out_of_the_banner)
  • crates/notes/tests/notes.rs: release_notes_sit_in_one_fold_that_says_what_is_inside
  • crates/notes/tests/notes.rs: one_short_release_stays_expanded (the behaviour itself is gone)
  • crates/notes/tests/notes.rs: notes_from_a_charts_sources_say_where_they_came_from

Trimmed to their behavioural assertions (wording assertions dropped, renamed where the old name described wording):

  • crates/update/src/pr/body/tests.rs: the_moved_ref_list_is_rendered_only_when_refs_moved → moved_refs_join_the_content_hash; a_removed_actions_lock_is_named_in_the_maintenance_body → a_removed_actions_lock_joins_the_content_hash; a_failed_notes_fetch_is_named_and_never_reused → a_failed_notes_fetch_is_never_reused; a_resolved_source_with_unreadable_notes_keeps_its_link; security_tests::fixed_advisories_lead_the_body_once_each → fixed_advisories_are_listed_once_each; security_tests::advisory_text_and_package_names_never_mention_anyone; image_tests::an_oversized_image_section_keeps_its_limits; image_tests::only_advisories_with_a_record_get_a_row_and_the_rest_are_counted_ids; image_tests::a_rebuild_that_only_brings_advisories_in_still_says_so + image_tests::a_rebuild_with_no_verified_record_claims_no_fix → a_rebuild_without_a_verified_record_claims_no_fix; image_tests::a_generator_name_cannot_close_its_code_span; image_tests::each_image_gets_its_own_line_and_silenced_warnings_are_left_off → silenced_warnings_are_left_off
  • crates/notes/tests/notes.rs: rendering_collapses_older_versions_truncates_with_links_and_neutralises_notifications, generated_note_heading_source_and_comparison_are_never_mention_neutralised → generated_note_headings_are_never_mention_neutralised, wrangler_notes_fold_with_demoted_headings_and_no_broken_links, an_oci_chart_lists_its_own_changes_for_each_version_in_the_range, a_charts_own_changes_render_without_a_source
  • crates/update/tests/write.rs: wording assertions dropped from a_retryable_notes_failure_is_fetched_again_on_the_next_run (now asserts that the settled body replaces the unsettled one), pr_create_repeat_update_labels_notes_and_checked_retry, generated_tables_policy_text_and_markers_do_not_gain_joiners, pin_title_respects_prefix_and_pin_rows_never_request_release_notes, a_lockfile_rebuild_shows_the_banner_until_it_ends_either_way and a_ticked_recheck_shows_the_banner_and_a_plain_rebuild_never_does
  • crates/engine/tests/write.rs: banner wording assertion dropped from a_ticked_pr_retries_the_branch_it_names

Tests that tick boxes or inject a stale banner were updated to the new checkbox and banner text. Request transcripts were regenerated with mise run transcripts:snapshot; only body hashes changed.

Checks run (on the VM)

  • cargo test --no-fail-fast -p patchula-notes -p patchula-update -p patchula-engine -p patchula-server -p patchula-cli: pass
  • cargo clippy -p patchula-notes -p patchula-update -p patchula-engine -p patchula-server -p patchula-cli --all-targets -- -D warnings: pass
  • cargo test --no-fail-fast --workspace --lib parity: pass
  • cargo fmt --check: clean
  • I rendered the patch and security-with-rebasing cases in a throwaway test (not committed) and compared them by eye with option-a-patch.md and option-a-security-rebasing.md; markers included, they match apart from hashes and version.

Follow-ups

  • The "(inferred tags)" compare caveat could come back as a link title or a footnote if it turns out to matter.
  • The advisory and image tables drop rows whole when they're over their caps. They could say how many rows were dropped instead of using a generic notice.

View guided diff Turn on auto-fix

After review

An adversarial review found nine defects; all are fixed in ce5647c.

  1. Closing collapsed blocks. Draft::finish no longer counts <details> substrings, which went wrong on tags in code, <details open> and upper case. Closing open blocks is now done by patchula_notes's fence- and code-span-aware closer (via fit), and only when a cut happens.
  2. No raw cuts. finish builds the tail first and computes the visible budget exactly from fixed(tail, batch). The PERMIT_RESERVE estimate and the four-close reserve are gone. The new patchula_notes::fit_within cuts where a block ends and closes fences and <details> within the limit, so the result never exceeds the budget. It runs on every path, including the no-permit and large-batch ones. A cut can no longer swallow the batch section, the footer or the checkboxes, on GitHub or for markers::checkboxes.
  3. Advisory text and links. Advisory summaries and ids have </> escaped, and ids also have [/] escaped. link_target rejects control characters and encodes \ and `. An advisory without a safe link renders as plain text instead of [x](). brings_in and the listed-id links also go through link_target.
  4. Image row order. Image advisory rows sort worst-first by severity, keeping OSV's id order within a severity. The dead fixed_ids set is removed.
  5. Notes stay in their budget. Notes::render bounds its output after HTML escaping. Package names are escaped and cut on whole characters or entities (escape_html_within), escaped URL lengths are checked, and an over-long line falls back to a short one or nothing. unreadable_notes and failed_notes are bounded the same way. Table links are never reserved if that would leave a package's notes below MIN_RENDER. A section that wouldn't fit whole is left out rather than cut mid-tag.
  6. Notice when nothing was shown. The standalone notice now names the package. If notes were cut it says "Release notes for pkg left out…"; otherwise it says "The Count could not show the release notes for pkg…", with no claim of partial notes.
  7. False "Out of room". Draft::next checks notes_key and already-fetched keys before the room checks, so duplicates or ineligible changes no longer end the notes with "Out of room".
  8. Controls and the refusal message. Bodies::tail keeps the controls only when fixed(with_controls, 0) <= BODY_LIMIT. The oversize refusal now names what filled the body: release-age evidence, the batch's items, or a large group's markers.
  9. Docs order. guide/pull-requests.md lists bodyNotes before the release notes, matching the code.

Tests. No new tests, per your instruction. I restored the trimmed behavioural assertions: an introduced advisory (USN-9-1) and an unverified fixed one (DSA-7) still appear in the image section.

Cache version. fit_within lives in crates/notes/src/lib.rs rather than markdown.rs. Putting it in markdown.rs would have forced version bumps of the parsed-changelog and notes-forge-changelog derives. The changelog row stays at version 15 with its new hash.

Transcripts. Regenerated; only an_overfull_tail_drops_the_controls_but_keeps_ownership changed, because the tail now keeps or drops the controls by fixed(...).

Checks. Tests for notes, update, engine, server and cli; clippy with -D warnings; workspace parity; cargo fmt --check. All pass.

Second re-check (2e53ac1)

A re-check confirmed findings 1–10 fixed and found three more; all are fixed:

  1. <details> depth. close_open_blocks now reads <details> depth left to right on each line outside fences and code spans, using an unsigned counter. An opening tag is <details followed by a space, > or /; it goes one deeper. A closing tag goes one shallower, and a closing tag with nothing open is ignored. So a stray </details> in upstream notes can no longer cancel a later open block and leave it unclosed over the footer.
  2. bodyNotes are no longer raw-cut.
    • fit_within now closes whatever its text leaves open even when all of the text fits, shrinking the cut if the closing lines push it over the limit.
    • Each bodyNotes entry is fitted with fit_within instead of being cut raw. Once one entry doesn't fit, the remaining entries are left out.
    • A single oversized one-line note that can't be cut at a block boundary is now dropped instead of cut mid-line.
  3. Image SBOM and registry fields.
    • The package, platforms, OS and SBOM-read detail in the image section now go through prose_cell.
    • prose_cell and id_cell truncate the raw text first, then make it inert, escape \ before |, [ and ], and escape </>. A cut can no longer leave a lone backslash or half an escape.
    • An advisory id without a safe link is inert too.

Cache versions. Editing markdown.rs forced version bumps, and putting the new version numbers in changelog.rs, forge.rs and adapters.rs then changed every derive that watches those files. Each of these moves up one relative to origin/main:

  • notes-adapter-listing 13→14
  • parsed-postgres-sgml and parsed-go-history 13→14
  • notes-changelog-directory and parsed-changelog 2→3
  • notes-gitlab-releases, notes-gitea-releases, notes-forge-tags, notes-forge-files and notes-forge-changelog 4→5
  • changelog stays at 15 with a new hash

Transcripts. Regenerated; only release_notes_are_bounded_deduplicated_cached_and_policy_controlled changed, because its oversized bodyNotes are now fitted, not raw-cut.

Checks. Tests for notes, update, engine, server and cli; clippy with -D warnings; workspace parity; cargo fmt --check. All pass. No new tests.

Third re-check (d906695)

A second re-check confirmed the earlier fixes and version bumps, and found three more defects (two from 2e53ac1); all are fixed:

  1. bodyNotes.
    • Empty or whitespace-only entries are skipped.
    • A note that doesn't fit no longer stops the loop, so shorter notes after it are still tried.
    • Whether a note was cut now comes from fit_within's new whole flag instead of a length comparison.
    • Whenever a non-empty note was cut or left out, one reserved line says so: "Some body notes were omitted to keep the PR body within its size budget."
  2. Release notes. Notes::render_within fits each release with fit_within into room - heading - 1, leaving room for the blank line after it. The fold can't outgrow its limit, so releases that already fit are never thrown away by the final cut().
  3. fit_within cost. fit_within now returns (String, bool). When the closing lines push a try over the limit, the next try starts just below the cut that failed (markdown::fit_at reports the cut offset), instead of stepping back by the overshoot. The number of tries is now bounded by the number of blocks, not bytes.

Cache versions. Only hashes were refreshed (parsed-changelog, notes-forge-changelog, changelog). Each version is still exactly one above origin/main.

Transcripts. Only release_notes_are_bounded_deduplicated_cached_and_policy_controlled changed: its oversized note now produces the omission line.

Checks. Tests for notes, update, engine, server and cli; clippy with -D warnings; workspace parity; cargo fmt --check. All pass. No new tests.

The table comes first and carries the links: the package links to its
source repository and the version range to the compare view, with <kbd>
badges for the update type and security. Rows for one package moving
from the same version to the same target merge, listing each file.

- Security fixes and image rebuilds open with a one-line IMPORTANT
  headline; their advisory tables, sorted by severity with a "Fixed in"
  column, collapse below the update table.
- Release notes collapse into one block per package, without the
  per-package heading or Source/Compare line; truncation notices sit
  inside the block, and a package without notes gets one small line.
- The batch PR's removal list collapses below the release notes, its
  items marker reserved in the budget.
- A footer says the Count opened the PR, with the vector bat logo
  pinned to the release, before the checkboxes.
- The rebasing banner becomes a four-line NOTE alert; removal takes
  every quoted line between the marker lines.
- The render salt moves to notes-render-v7, so open PRs rewrite once.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula ce5647c Commit Preview URL

Branch Preview URL
Nov 23 2026, 02:26 AM

- finish builds the tail first and fits the visible text into exactly
  the room left with patchula_notes::fit_within, which cuts where a
  block ends and closes open fences and <details> (fence- and
  code-span-aware) within the limit, so nothing swallows the batch
  section, footer or checkboxes. The substring <details> counting and
  the PERMIT_RESERVE estimate are gone.
- Advisory summaries and ids lose their tags, ids their brackets;
  link_target rejects control characters and encodes backslashes and
  backticks; an advisory without a safe link renders as plain text, and
  introduced advisories and listed ids go through link_target too.
- Image advisory rows sort by severity like the security table.
- Notes::render, unreadable_notes and failed_notes stay within their
  limit after HTML escaping; table links never take a package's notes
  below MIN_RENDER, and a section that would not fit whole is left out
  rather than cut mid-tag.
- With nothing shown, the standalone notice names the package and
  claims no partial notes.
- Duplicate or ineligible changes no longer trigger "Out of room".
- tail keeps the controls only when fixed(...) fits, and the oversize
  refusal names what filled the body.
- Docs list bodyNotes before the release notes, as rendered.
- close_open_blocks reads <details> depth left to right per line, as an
  unsigned counter: an opening tag (<details then a space, > or /) goes
  deeper, a closing tag shallower, and a stray close never cancels a
  later open.
- fit_within closes what its text leaves open even when all of it
  fits, shrinking the cut if the closing lines push it over the limit.
- Each bodyNotes entry is fitted with fit_within instead of being cut
  raw; once one no longer fits, the rest stay out.
- Image SBOM and registry fields (package, platforms, OS, detail) go
  through prose_cell. prose_cell and id_cell cut first, then make the
  text inert, escape backslashes before pipes and brackets, and drop
  tags.
- The derived and state version rows that watch crates/notes/src move
  up one.
…ntly

- fit_within returns whether it kept the text whole, and after a failed
  try moves the room to just before the cut that failed (markdown::fit_at
  reports it), so its tries are bounded by blocks, not bytes.
- Notes::render_within fits each release with fit_within and keeps room
  for its trailing blank line, so the fold never outgrows its limit and
  releases that already fit are never lost to cut().
- bodyNotes skip empty entries, keep trying shorter notes after one does
  not fit, use fit_within's flag instead of comparing lengths, and add one
  reserved line whenever a note was cut or left out.
@sweepies
sweepies merged commit 3e69a73 into main Nov 23, 2026
12 checks passed
@sweepies
sweepies deleted the feat/pr-body-redesign branch November 23, 2026 03:12
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant