Skip to content

fix: prune only matching release asset versions - #471

Open
ThunderTr77 wants to merge 2 commits into
TouchAI-org:mainfrom
ThunderTr77:fix/nonfrontend-release-feed-bug-3
Open

fix: prune only matching release asset versions#471
ThunderTr77 wants to merge 2 commits into
TouchAI-org:mainfrom
ThunderTr77:fix/nonfrontend-release-feed-bug-3

Conversation

@ThunderTr77

Copy link
Copy Markdown
Contributor

Summary

Fixes the R2 release asset prune planner so it only deletes download assets whose file version exactly matches the stale GitHub release tag. This prevents a newer same-channel asset from being pruned if it is attached to an older release by mistake.

Related issue or RFC

Related to https://github.com/TouchAI-org/TouchAI release asset retention workflow.

AI assistance disclosure

  • Tool(s) used: AI assistant
  • Scope of assistance: identified the release-script edge case, implemented the guard, and added a regression test.
  • Human review or rewrite performed: reviewed the diff and local test output before opening the PR.
  • Architecture or boundary impact: none; this stays within the CI release asset pruning script.

Testing evidence

Targeted local checks passed:

vitest run tests/ci/plan-r2-release-asset-prune.test.ts --pool=vmThreads --fileParallelism=false
pnpm --filter @touchai/desktop test:typecheck
pnpm exec prettier --check apps/desktop/scripts/ci/plan-r2-release-asset-prune.mjs apps/desktop/tests/ci/plan-r2-release-asset-prune.test.ts
pnpm exec eslint apps/desktop/scripts/ci/plan-r2-release-asset-prune.mjs apps/desktop/tests/ci/plan-r2-release-asset-prune.test.ts
git diff --check

I did not run the full pnpm test:pr suite locally because the change is limited to the release pruning script and its targeted regression test; CI should provide the full-suite proof.

TDD: regression case added with the fix to cover the unsafe prune scenario.

Risk notes

  • AgentService, runtime, MCP, or schema impact: none.
  • database baseline or migration impact: none.
  • release or packaging impact: safer R2 cleanup; the planner now skips stale-release assets when the file version does not match the release tag.

Screenshots or recordings

Not applicable; no UI changes.

Checklist

  • The PR title follows Conventional Commits and is valid for squash merge.
  • This PR is either ready for review or explicitly marked as a Draft PR.
  • I did not use [WIP] or similar title prefixes.
  • If AI materially assisted this PR, I disclosed the tools and scope and I personally reviewed every affected change.
  • I can explain the why, what, and how of this change without relying on an AI tool.
  • If this touches AgentService, runtime, MCP, or schema boundaries, there is an accepted RFC.
  • If this changes architecture or adds a new cross-boundary abstraction, there is an accepted RFC.
  • I ran pnpm test:pr for this code PR, or this is a docs-only change.
  • If I changed Rust behavior or tests, I reviewed pnpm test:coverage:rust or relied on CI coverage evidence.
  • If I changed desktop startup/window/search/popup/settings/E2E paths, I ran pnpm test:e2e locally or documented why CI is the first valid proof.
  • I added tests or explained why tests are not appropriate.
  • I updated docs when behavior changed.

@ThunderTr77
ThunderTr77 requested a review from hiqiancheng as a code owner June 15, 2026 14:47
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ThunderTr77, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c0be5af2-eed6-44c7-a604-79eaea480458

📥 Commits

Reviewing files that changed from the base of the PR and between daf7392 and 1fa3ed8.

📒 Files selected for processing (2)
  • apps/desktop/scripts/ci/plan-r2-release-asset-prune.mjs
  • apps/desktop/tests/ci/plan-r2-release-asset-prune.test.ts
📝 Walkthrough

Walkthrough

The R2 release asset prune planner gains a stricter asset-selection predicate: it now imports versionFromAssetName, derives a version string from each GitHub release tag via a new releaseVersionFromTag helper, and requires that a candidate download asset's embedded version matches that release-derived version. The test fixture adds one extra asset filename to cover the updated logic.

Changes

R2 Prune Planner — Version-Match Filter

Layer / File(s) Summary
Version-aware asset filtering
apps/desktop/scripts/ci/plan-r2-release-asset-prune.mjs, apps/desktop/tests/ci/plan-r2-release-asset-prune.test.ts
versionFromAssetName is added to imports; releaseVersionFromTag strips the leading v from a tag to produce a version string; the stale-release asset filter now requires both channel match and version equality; the test fixture gains one extra asset filename (TouchAI-beta-0.2.0-beta.20-windows-full.nupkg) to exercise the updated predicate.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • TouchAI-org/TouchAI#274: Introduces the planR2ReleaseAssetPrune planner whose asset-selection logic is directly tightened by this PR.
  • TouchAI-org/TouchAI#458: Adds version-specific filtering using versionFromAssetName for download asset selection, the same approach applied here to the prune planner.

Suggested labels

area:ci

🐇 A tag walks in with a v up front,
But the planner just strips it — no need to punt.
Version and channel must now both align,
Or that stale old asset gets left behind.
Hop hop, tighter rules make the prune pipeline shine! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: prune only matching release asset versions' follows Conventional Commits format, is concise, and accurately describes the main fix in the changeset.
Description check ✅ Passed The description covers Summary, Related issue, AI assistance disclosure, Testing evidence, Risk notes, and Checklist sections with appropriate detail, though full pnpm test:pr was not run locally.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the area:ci CI, automation, or repository workflow changes label Jun 15, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 15, 2026
@hiqiancheng

Copy link
Copy Markdown
Collaborator

建议增加 tag/channel 边界测试。

Please add tag/channel edge-case tests.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 21 days. Please update it or leave a note if it is still in progress.

@github-actions github-actions Bot added the Stale label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, automation, or repository workflow changes Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants