Skip to content

github: make the review link in the PR-body stack footer configurable - #1410

Open
netproteus wants to merge 2 commits into
facebook:mainfrom
netproteus:footer-config
Open

github: make the review link in the PR-body stack footer configurable#1410
netproteus wants to merge 2 commits into
facebook:mainfrom
netproteus:footer-config

Conversation

@netproteus

Copy link
Copy Markdown

Closes #1409.

sl pr submit hard-codes https://reviewstack.dev/... as the "Best reviewed with" link in the stack footer. Teams on GitHub Enterprise (#512), running a self-hosted ReviewStack fork (#304), or using another stack-aware review tool get a wrong or dead link in every PR. The ReviewStack source itself anticipates alternate hosts (saplingStack.ts: the URL "can change over time (particularly if someone wants to run their own fork of ReviewStack)").

This PR adds two configs:

[github]
pull-request-review-url-template=https://review.example.com/{owner}/{repo}/pull/{number}
pull-request-review-tool-name=MyReview

producing:

Stack created with Sapling. Best reviewed with MyReview.

Design notes

  • Unset ⇒ byte-for-byte today's output. The three existing test-ext-github-pr-submit-*.t tests pass unchanged, which doubles as the regression proof.
  • The URL template uses str.format placeholders ({owner}, {repo}, {number}, {hostname}) rather than the full Sapling templater: it keeps create_pull_request_title_and_body() a pure, doctest-able function and matches how the URL is already written. Happy to switch to the templater (as github.pr.branch-name-template does) if you'd prefer.
  • The sentence shape is deliberately not configurable. parse_stack_information() only tolerates the intro line because it starts with the literal Stack created with [Sapling]; free-form text would also risk corrupting ReviewStack's bullet parsing (* -prefixed lines, bare ---, __->__). Keeping the fixed sentence means even old sl binaries parse customized bodies correctly.
  • An invalid URL template aborts at submit time with a message naming the config.
  • github.pull-request-include-reviewstack=false still suppresses the whole line; the new configs are no-ops in that case.

Second commit (severable)

parse_stack_information() previously aborted at the first non-bullet line after the footer marker unless it happened to start with "Stack created with [Sapling]" — so hand-editing the footer prose on github.com silently breaks sl pr pull ancestor linking today. Once the modern [//]: # (BEGIN SAPLING FOOTER) marker has been seen, intro lines before the first bullet are now skipped (matching ReviewStack's documented grammar, which treats them as free-text introduction); legacy marker-less bodies keep the conservative behavior. Happy to drop this commit if you'd rather take the config change alone.

Test plan

  • New doctests in pull_request_body.py (custom URL, custom name, both, invalid-template abort, round-trip parse of a customized footer, intro-line tolerance, legacy conservatism) — module doctests all pass.
  • New eden/scm/tests/test-ext-github-pr-submit-footer.t + tests/github/mock_create_prs_footer.py: the mock server computes the expected footer from the same configs the test sets, so it only matches if the templates were applied. mock_utils.expect_update_pr_request() gains optional review_url/review_tool params (default: existing behavior).
  • Existing test-ext-github-pr-submit-{single,overlap,open}.t pass unchanged.
  • All four .t tests run green against an OSS make oss-equivalent build (build.py --oss sl) in a manylinux_2_34 container.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UaQdFpGUAEQSBSqHwtQCZ1

The footer that `sl pr submit` writes for stacked PRs hard-codes
https://reviewstack.dev as the "Best reviewed with" link. Teams running
their own ReviewStack instance, another stack-aware review tool, or
GitHub Enterprise (where reviewstack.dev cannot access the repo) end up
with a wrong or dead link in every PR they create.

Add two configs:

    [github]
    pull-request-review-url-template=https://review.example.com/{owner}/{repo}/pull/{number}
    pull-request-review-tool-name=MyReview

The URL template supports {owner}, {repo}, {number} and {hostname}
placeholders. When both configs are unset the output is byte-for-byte
identical to today's. The fixed "Stack created with [Sapling]..."
sentence prefix is deliberately kept so parse_stack_information()
(used by `sl pr pull`), ReviewStack's client-side parser, and legacy
pre-marker bodies all keep parsing unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Change-Id: I96ab2d9dd8bba9921ca897521bc4fd5d24acbce3
parse_stack_information() previously gave up at the first non-bullet
line after the footer marker unless that line happened to start with
"Stack created with [Sapling]". Editing the footer prose on github.com
(or customizing it) therefore silently broke `sl pr pull` ancestor
linking, even though ReviewStack's client-side parser explicitly
treats such lines as a free-text introduction.

Once the modern "[//]: # (BEGIN SAPLING FOOTER)" marker has been seen,
skip non-bullet lines before the first stack entry instead of aborting;
the first non-bullet line after the entries still terminates the list.
Legacy marker-less bodies keep the previous conservative behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Change-Id: I5001d29f86e81b842f6bb5c9f7e4fe74dda24627
@meta-cla meta-cla Bot added the CLA Signed label Aug 9, 2026
@meta-codesync

meta-codesync Bot commented Aug 9, 2026

Copy link
Copy Markdown

This pull request has been imported. If you are a Meta employee, you can view this in D115372413. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sl pr submit footer hard-codes reviewstack.dev — make the review link configurable

1 participant