Skip to content

feat(stack): topic branch names and per-file notes in PR bodies - #36

Merged
ywy50 merged 1 commit into
mainfrom
stack-pr-polish
Sep 3, 2026
Merged

feat(stack): topic branch names and per-file notes in PR bodies#36
ywy50 merged 1 commit into
mainfrom
stack-pr-polish

Conversation

@ywy50

@ywy50 ywy50 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two improvements to what a stacked-PR run publishes.

Branch names. Stack layers were named gauntlet/stack/<tip12>/<NN>-<review>, which says nothing about the change. They now publish as review/<NN>-<review>-<topic> (e.g. review/03-sec-review-input-validation): NN is the 1-based schedule position, so merge order stays visible and sortable, and the topic is a slug cut from the layer's commit subject. Because the topic does not exist before the review commits, each layer starts under a deterministic provisional name (review/<NN>-<review>-wip-<base6>) and is renamed just before the push. Resume and recovery no longer recompute one exact name: they list local and remote branches under the deterministic review/<NN>-<review> prefix and verify each candidate by commit graph — a recovered layer must be a one-commit child of the previous layer's tip — so a same-named leftover from an older stack is rejected by ancestry, and when such a leftover occupies the topic name the new layer appends the stack's short base commit at the end. Recovery also finishes the rename for a run killed between commit and push, from the stranded commit's own subject. The preflight dry-run probe moved to the same review/ namespace, and review/ branches are excluded from merge-target listings the same way gauntlet/ already was.

PR bodies. The ## Changes section listed bare paths. The runner now parses the per-file PATH: <file>: <what was done> lines the review protocol already asks for and renders them beside the paths (- \path` — what was done). Notes are matched against the layer's own commit, so a note naming a file the commit never touched is dropped; each note is flattened, length-bounded, and backtick-neutralized like every other untrusted value in the body, and the whole body is now capped. A layer with no usable notes renders exactly what it rendered before. rules/suffix.md` now spells out the parseable line form.

Testing

  • make check and make test (full suite, race detector, shuffled) pass.
  • Stacked mode exercised end to end against the fake-remote/fake-gh harness, including new tests for: a stale same-named branch from an older stack rejected by ancestry and disambiguated on publish; recovery finishing the rename of a committed-but-unpushed provisional layer without rerunning the agent; per-file notes rendered in the body and notes for untouched paths dropped.
  • New unit tests for branch naming (check-ref-format validity under hostile subjects, topic budget), prefix listing/rename primitives, ParseFileNotes (dedupe, sanitization, bounds), and hostile-input body rendering (markdown injection, unbalanced backticks, long paths).

Stack layers now publish as review/<NN>-<review>-<topic>, with the topic
cut from the commit subject. Each layer starts under a deterministic
provisional name (review/<NN>-<review>-wip-<base>) and is renamed once
its commit exists; resumed runs find published layers by listing the
deterministic prefix and verifying candidates by commit graph, so a
same-named branch from an older stack is rejected by ancestry, and a
taken topic name gets the stack's short base commit appended. The
preflight probe moved to the same namespace, and review/ branches are
excluded from merge-target listings like gauntlet/.

PR bodies render the per-file PATH: lines a review prints beside the
paths its commit touched; notes are matched against the commit's own
file list, sanitized and bounded like every other untrusted value, and
the whole body is capped. The suffix protocol now spells out the
parseable PATH line form.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 5a625ed0-6b28-453b-94a7-d208a6349524


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ywy50
ywy50 merged commit c183d28 into main Sep 3, 2026
7 of 9 checks passed
@ywy50
ywy50 deleted the stack-pr-polish branch September 3, 2026 07:37
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