Skip to content

fix: guard PR comment updates against stale concurrent writes#854

Merged
kitsuyui merged 1 commit into
mainfrom
fix/pr-comment-stale-write
Jul 17, 2026
Merged

fix: guard PR comment updates against stale concurrent writes#854
kitsuyui merged 1 commit into
mainfrom
fix/pr-comment-stale-write

Conversation

@kitsuyui

Copy link
Copy Markdown
Owner

Summary

  • re-read the managed PR comment before update and delete operations
  • skip stale mutations when a newer run already changed the managed comment body
  • add focused race regression tests and rebuild dist/**

Why

Older overlapping action runs could delete or overwrite the current managed PR comment after a newer run had already produced the correct final state.
This keeps the existing duplicate-create cleanup while avoiding stale write races on the user-visible comment path.

Verification

  • bun run lint

  • bun run test

  • bun run build

Notes

  • dist/** was rebuilt to keep the published action artifact in sync.
  • Build completes with the existing ajv/fast-uri warning from upstream type exports.

Re-read the managed PR comment before update/delete so older runs do not overwrite newer comment state.
Add focused race regression tests and rebuild dist.
@github-actions

Copy link
Copy Markdown

🎉 Happy commit!

@github-actions

Copy link
Copy Markdown

gh-counter

PR gate

Removed Added +/-
TODO/FIXME 0 0 0

Repo dashboard

main (c70b583) #854 (64e8d56) +/-
TODO/FIXME 0 0 0

Reported by gh-counter

@github-actions

Copy link
Copy Markdown

Code Metrics Report

main (c70b583) #854 (64e8d56) +/-
Coverage 97.6% 97.1% -0.5%
Code to Test Ratio 1:1.6 1:1.5 -0.1
Test Execution Time 1s 2s +1s
Details
  |                     | main (c70b583) | #854 (64e8d56) |  +/-  |
  |---------------------|----------------|----------------|-------|
- | Coverage            |          97.6% |          97.1% | -0.5% |
  |   Files             |              7 |              7 |     0 |
  |   Lines             |            170 |            177 |    +7 |
+ |   Covered           |            166 |            172 |    +6 |
- | Code to Test Ratio  |          1:1.6 |          1:1.5 |  -0.1 |
  |   Code              |            714 |            780 |   +66 |
+ |   Test              |           1180 |           1241 |   +61 |
- | Test Execution Time |             1s |             2s |   +1s |

Code coverage of files in pull request scope (100.0% → 98.3%)

Files Coverage +/- Status
src/github.ts 98.3% -1.7% modified

Reported by octocov

@github-actions

Copy link
Copy Markdown

gh-build-size

Target main #854 +/-
Total action artifacts 23,300,626 B 23,303,031 B +2,405 B
Runtime bundle 1,153,666 B 1,153,987 B +321 B
Source maps 17,130,935 B 17,133,019 B +2,084 B

Reported by gh-build-size

@kitsuyui
kitsuyui merged commit 731d7b7 into main Jul 17, 2026
5 checks passed
@kitsuyui
kitsuyui deleted the fix/pr-comment-stale-write branch July 17, 2026 11:13
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