From 6080cb3de832e929ba2f53a78d4a1874ed07f00e Mon Sep 17 00:00:00 2001 From: ivanmilevtues Date: Tue, 20 Oct 2026 02:44:10 +0200 Subject: [PATCH] fix: link review comments to whole-PR changes Amp-Thread-ID: https://ampcode.com/threads/T-01a155e4-6738-754b-b42e-e24bbb4b07f8 Co-authored-by: Amp --- action.yml | 2 +- scripts/action/build-review-comment.sh | 4 ++-- scripts/action/update-review-progress.sh | 2 +- tests/test_progress_comment.py | 1 + tests/test_review_comment.py | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 3de0b22..baf7584 100644 --- a/action.yml +++ b/action.yml @@ -378,7 +378,7 @@ runs: ⏳ CodeBoarding is analyzing this pull request's architecture changes. - Open it in [CodeBoarding](https://app.codeboarding.org/${{ github.repository }}/pull/${{ steps.guard.outputs.pr_number }}?utm_source=github&utm_medium=pr_comment&utm_campaign=gh_action) meanwhile: the files, comments and review are there already, and the diff appears when the run finishes. + Open it in [CodeBoarding](https://app.codeboarding.org/${{ github.repository }}/pull/${{ steps.guard.outputs.pr_number }}/changes?utm_source=github&utm_medium=pr_comment&utm_campaign=gh_action) meanwhile: the files, comments and review are there already, and the diff appears when the run finishes. run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) · attempt ${{ github.run_attempt }} diff --git a/scripts/action/build-review-comment.sh b/scripts/action/build-review-comment.sh index 96743a6..eabc31b 100755 --- a/scripts/action/build-review-comment.sh +++ b/scripts/action/build-review-comment.sh @@ -6,7 +6,7 @@ if [ "$N_CHANGED" = "1" ]; then COMPONENT_NOUN="component" fi RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" -# Stable PR route: the webview resolves the repo/PR's latest artifact itself, +# Whole-PR Changes route: the webview resolves the repo/PR's latest artifact itself, # so the link stays valid across runs instead of pinning one run id. # Standard utm_* rather than a bespoke ?src=: PostHog lifts utm_* into person and # session properties by itself, so this is attributable the day the action ships, @@ -14,7 +14,7 @@ RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} # came from here is a github.com referrer, which most clients strip and a link # pasted into chat never had. Constant across runs on purpose: a run id here # would scatter one pull request's clicks across a new value per re-run. -PLATFORM_URL="https://app.codeboarding.org/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" +PLATFORM_URL="https://app.codeboarding.org/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}/changes" WEBVIEW_URL="${PLATFORM_URL}?utm_source=github&utm_medium=pr_comment&utm_campaign=gh_action" BODY="${RUNNER_TEMP}/review-comment.md" # The status line is what the web platform reads the count from, so its shape is a contract. diff --git a/scripts/action/update-review-progress.sh b/scripts/action/update-review-progress.sh index ec5be1d..c212395 100755 --- a/scripts/action/update-review-progress.sh +++ b/scripts/action/update-review-progress.sh @@ -36,7 +36,7 @@ else second="2. ⏳ Analysing this PR's changes" fi -platform="https://app.codeboarding.org/$REPOSITORY/pull/$PR_NUMBER?utm_source=github&utm_medium=pr_comment&utm_campaign=gh_action" +platform="https://app.codeboarding.org/$REPOSITORY/pull/$PR_NUMBER/changes?utm_source=github&utm_medium=pr_comment&utm_campaign=gh_action" run_url="${GITHUB_SERVER_URL:-https://github.com}/$REPOSITORY/actions/runs/${GITHUB_RUN_ID:-}" body="$(printf '%s\n\n%s\n %s\n%s\n\n%s\n\n%s\n%s' \ '### CodeBoarding review · analyzing…' \ diff --git a/tests/test_progress_comment.py b/tests/test_progress_comment.py index 3ae0bfe..0bd4e94 100644 --- a/tests/test_progress_comment.py +++ b/tests/test_progress_comment.py @@ -54,6 +54,7 @@ def test_the_base_step_says_the_base_is_being_built_and_why(self) -> None: self.assertIn("1. ⏳ Building the diagram of `main` @a1b2c3d from scratch\n", patch) self.assertIn(" `main` has no saved diagram this review can start from, so it builds one first.", patch) self.assertIn("\n2. Analysing this PR's changes\n", patch) + self.assertIn("https://app.codeboarding.org/owner/repo/pull/9/changes?utm_source=github&utm_medium=pr_comment&utm_campaign=gh_action", patch) def test_the_head_step_marks_the_base_done(self) -> None: (patch,) = self._post("head") diff --git a/tests/test_review_comment.py b/tests/test_review_comment.py index 709f693..04b965f 100644 --- a/tests/test_review_comment.py +++ b/tests/test_review_comment.py @@ -44,7 +44,7 @@ def test_status_line_and_platform_link_as_the_web_platform_reads_them(self) -> N body = _build(Path(tmp)) self.assertTrue(body.startswith("### CodeBoarding review\n\n**Status:** 3 changed components\n")) self.assertIn( - "See the full change in [CodeBoarding](https://app.codeboarding.org/owner/repo/pull/605?utm_source=github", + "See the full change in [CodeBoarding](https://app.codeboarding.org/owner/repo/pull/605/changes?utm_source=github&utm_medium=pr_comment&utm_campaign=gh_action)", body, ) @@ -54,7 +54,7 @@ def test_the_machine_readable_line_ends_the_body(self) -> None: last = body.rstrip("\n").splitlines()[-1] self.assertEqual( last, - "", + "", ) # The status regex the web platform uses must still find the status line, not the marker. match = re.search(r"\*\*Status:\*\*\s*(\d+)\s+changed\s+components?", body)