Skip to content

fix: prune only matching release asset versions#471

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

fix: prune only matching release asset versions#471
ThunderTr77 wants to merge 1 commit 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 75aabe35-477a-4071-96ef-4d0b21ea9de6

📥 Commits

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

📒 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
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (rust)
  • GitHub Check: Desktop E2E Smoke (Windows)
  • GitHub Check: Frontend Tests
  • GitHub Check: Rust Checks
🔇 Additional comments (2)
apps/desktop/scripts/ci/plan-r2-release-asset-prune.mjs (1)

12-12: LGTM!

Also applies to: 56-58, 110-117

apps/desktop/tests/ci/plan-r2-release-asset-prune.test.ts (1)

73-73: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved release asset cleanup process by enforcing stricter version matching during asset selection, ensuring only assets matching both the channel and version are marked for removal.
    • Updated test fixtures to validate correct asset handling.

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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 and usage tips.

@coderabbitai coderabbitai Bot added the area:ci CI, automation, or repository workflow changes label Jun 15, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant