From c0d5f8bd9a24e7d63787778d51b89a7819d1d973 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Fri, 11 Sep 2026 04:54:05 -0600 Subject: [PATCH 1/6] check-links: one suggestion per fix, synced with findings; report one fact per line - Review comments: one suggested change per finding with a fix, no review body. Each starts with a marker so the workflow can delete suggestions for findings that are fixed and skip ones already posted. - Summary comment and review comments list line, link, problem, and fix on their own lines. - Absolute links to this site get their own section instead of Outbound. - Case-mismatch findings now carry a fix. - Wording: 'links on this site', 'these other pages', drop docs.sourcegraph.com; reproduce command matches package.json. Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp --- .github/workflows/check-links.yml | 20 +++-- dev/check-links.mjs | 137 ++++++++++++++---------------- 2 files changed, 81 insertions(+), 76 deletions(-) diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml index e0dab4ba3..98063e9d6 100644 --- a/.github/workflows/check-links.yml +++ b/.github/workflows/check-links.yml @@ -97,19 +97,29 @@ jobs: fi - name: Suggest fixes as review comments - # One suggested change per added line with a fix. Suggestions already on - # the PR (same file, line, and text) are not posted again. - if: steps.check.outputs.broken == 'true' && github.event.pull_request.head.repo.full_name == github.repository + # One suggested change per finding with a fix. Suggestions already on the + # PR (same file, line, and link) are not posted again; suggestions for + # findings that are gone are deleted. GitHub sets line to null on comments + # it could not carry to the new revision, so those are deleted too. + if: github.event.pull_request.head.repo.full_name == github.repository env: GH_TOKEN: ${{ github.token }} PR_NUMBER: ${{ github.event.pull_request.number }} run: | + key='(.path + ":" + (.line | tostring) + ":" + (.body | split("\n")[0]))' gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/comments" --paginate \ - --jq '.[] | {path, line, body}' | jq -s . > "$RUNNER_TEMP/posted.json" + --jq ".[] | select(.body | startswith(\"`, + `Link: \`${url}\``, + `Problem: ${error}`, + `Fix: \`${fix}\``, + '````suggestion', + source.split(url).join(fix), + '````' + ]; + return { path: file, line, side: 'RIGHT', body: body.join('\n') }; }); - return { - event: 'COMMENT', - body: 'Suggested fixes for the links this PR adds; details in the check-links comment.', - comments - }; + return { event: 'COMMENT', body: '', comments }; } const FORMATTERS = { From f76ac94e3a8459a4112a743f94161ae07ec45bb6 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Fri, 11 Sep 2026 05:07:03 -0600 Subject: [PATCH 2/6] cspell: allow tostring, a jq builtin used in the workflows Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp --- cspell-allow-list.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cspell-allow-list.txt b/cspell-allow-list.txt index 9b26c3c7c..3411345cc 100644 --- a/cspell-allow-list.txt +++ b/cspell-allow-list.txt @@ -545,6 +545,7 @@ toolcall topk topsecretorg topsecretproject +tostring # jq builtin transactionally transformchanges transformchangesgroup From b4454652db4fbfe8a0805483de4005ebb735e141 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Fri, 11 Sep 2026 05:27:35 -0600 Subject: [PATCH 3/6] check-links: don't repeat the link and fix inside the case-mismatch problem Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp --- dev/check-links.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/check-links.mjs b/dev/check-links.mjs index 5eab267b9..8ad57213f 100644 --- a/dev/check-links.mjs +++ b/dev/check-links.mjs @@ -414,7 +414,7 @@ function validateLink(link, currentFile, maps) { resolvedPath.replace(/\/$/, '').toLowerCase() ); if (realPath) { - return { error: `Case mismatch: "${resolvedPath}" should be "${realPath}"`, fix: anchor ? `${realPath}#${anchor}` : realPath }; + return { error: 'Path case mismatch: works on macOS, 404s on the Linux build', fix: anchor ? `${realPath}#${anchor}` : realPath }; } // Check if it's a file with extension (like .png, .pdf) From 972a853b687da7fb32f4f347524a0b9473609ff3 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Fri, 11 Sep 2026 05:32:30 -0600 Subject: [PATCH 4/6] check-links: inbound section wording Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp --- dev/check-links.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/check-links.mjs b/dev/check-links.mjs index 8ad57213f..3bb48936e 100644 --- a/dev/check-links.mjs +++ b/dev/check-links.mjs @@ -606,7 +606,7 @@ function formatMarkdown(findings) { section('Absolute links', ABSOLUTE_LINKS_ADVICE, absolute); section( 'Inbound', - 'A change your PR made broke inbound links from elsewhere. Please fix the inbound links on these other pages.', + 'A change your PR made broke inbound links from these other files. Please fix the inbound links in these other files.', inbound ); } else { From 0d2d29e2a5918f4954748fe284b5f4664c84ff34 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Fri, 11 Sep 2026 09:05:38 -0600 Subject: [PATCH 5/6] check-links: move review-comment sync to dev/sync-review-comments.sh; update comments whose text changed Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp --- .github/workflows/check-links.yml | 27 +++------------------ dev/sync-review-comments.sh | 40 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 24 deletions(-) create mode 100755 dev/sync-review-comments.sh diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml index 98063e9d6..c5e4d7503 100644 --- a/.github/workflows/check-links.yml +++ b/.github/workflows/check-links.yml @@ -97,34 +97,13 @@ jobs: fi - name: Suggest fixes as review comments - # One suggested change per finding with a fix. Suggestions already on the - # PR (same file, line, and link) are not posted again; suggestions for - # findings that are gone are deleted. GitHub sets line to null on comments - # it could not carry to the new revision, so those are deleted too. + # One suggested change per finding with a fix, kept in sync with the + # findings; see dev/sync-review-comments.sh if: github.event.pull_request.head.repo.full_name == github.repository env: GH_TOKEN: ${{ github.token }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: | - key='(.path + ":" + (.line | tostring) + ":" + (.body | split("\n")[0]))' - gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/comments" --paginate \ - --jq ".[] | select(.body | startswith(\"". +# +# Usage: dev/sync-review-comments.sh '