Skip to content

fix(cache): keep PR comment cache runtime-only#44296

Open
ag-linden wants to merge 2 commits into
renovatebot:mainfrom
ag-linden:fix/ensure-pr-comment
Open

fix(cache): keep PR comment cache runtime-only#44296
ag-linden wants to merge 2 commits into
renovatebot:mainfrom
ag-linden:fix/ensure-pr-comment

Conversation

@ag-linden

Copy link
Copy Markdown

Changes

Repository cache comment hashes are now treated as runtime-only state.

  • Drop persisted prComments entries when repository cache data is loaded
  • Exclude runtime prComments entries when repository cache data is saved
  • Preserve the existing within-run duplicate suppression in ensureComment()
  • Add regression coverage for loading old persisted comment hashes and for not serializing runtime comment hashes

Context

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

ensureComment() uses repoCache.prComments to avoid repeating the same platform comment write for the same PR/topic/content hash.
That is fine as a runtime optimization, but repository cache can also be persisted across runs.
When a hash from a previous run is restored, Renovate can treat the cached hash as proof that the remote platform comment still exists and still has the expected body.

Platform comments are mutable remote state, so they can be edited or deleted outside Renovate.
If that happens while the persisted hash still matches the desired content, Renovate skips platform.ensureComment() and returns success without re-checking the remote comment.

This keeps the cache useful inside one run, while avoiding carrying comment assurance state across runs.

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non-trivial portions of code, tests, or documentation). OpenAI GPT-5/Codex was used to inspect the cache/comment code path and draft the code and test changes. I reviewed the final diff and ran the validation below.
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository: N/A

Validation run locally with Node 24.18.0 and pnpm 11.8.0:

  • pnpm vitest lib/util/cache/repository/impl/local.spec.ts --coverage=false
  • pnpm vitest lib/modules/platform/comment.spec.ts --coverage=false
  • pnpm check lib/util/cache/repository/impl/base.ts lib/util/cache/repository/impl/local.spec.ts
  • pnpm type-check
  • pnpm test-schema

I also tried the full pnpm test gate.
It stopped before patch-related tests at local ls-lint; standalone ls-lint exits without diagnostics, the direct darwin-arm64 binary exits 137, and local metadata checks for that binary report Operation not permitted.

@github-actions github-actions Bot requested a review from viceice June 29, 2026 20:31
@cla-assistant

cla-assistant Bot commented Jun 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Jun 29, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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