Skip to content

ci: let the SDK release workflows rebuild tags older than v4.2.0-beta.5 - #5107

Merged
QuantumExplorer merged 2 commits into
v5.0-devfrom
claude/release-sdk-older-tag-fallback
Oct 6, 2026
Merged

QuantumExplorer merged 2 commits into
v5.0-devfrom
claude/release-sdk-older-tag-fallback

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

To re-release the Kotlin or Swift SDK for an older platform tag, the docs say to start the SDK release workflow from the dev branch and pass the older tag. That path was broken. The workflow checks out the old tag and then calls a helper step that lives in a file only newer tags have, so the run stopped before building anything. This PR writes that helper step directly into both workflows, so it no longer depends on the old tag's files. For Swift it also bridges one more difference in the old build script.

Example:

  • Before: dispatching release-swift-sdk.yml from v4.2-dev with tag=v4.1.2 failed at "Prepare release Cargo target cache": that step was uses: ./.github/actions/release-cargo-target-cache, and that action does not exist in v4.1.2's tree. release-kotlin-sdk.yml failed the same way.
  • After: the step is inline, so it runs for any tag. v4.1.2's build_ios.sh still looks for its libraries under ./target, and now finds them through a target link to the release cache.

Value: The documented recovery path for an older tag works again: every v4.1.x tag, and v4.2.0 dev and beta tags before beta.5 dispatched from v4.2-dev.

Risks: Low. The inline step runs the action's own script with the same inputs, so new tags behave exactly as before. The failing runs stopped in the build job, before the attach and Maven jobs, so they published nothing. The failure was safe, but it blocked recovery. The target link exists only in the Swift build job and is removed at its end, even when the job fails.

Issue being fixed or feature implemented

#4562 moved the release SDK builds to self-hosted runners and added the local composite action .github/actions/release-cargo-target-cache. Both SDK release jobs check out refs/tags/<tag> and then run that action. GitHub loads a ./ action from the workspace when the step runs, and the workspace holds the tag's tree. The action exists only from v4.2.0-beta.5 on.

The fallback for tags that predate the workflows is to dispatch from the dev branch (.claude/skills/release/SKILL.md and packages/kotlin-sdk/PUBLISHING.md). That checks out a tree without the action, so the fallback failed for every tag it exists to serve. Dispatching at the tag ref still worked for tags that already contain the action.

Swift had a second problem. The action exports CARGO_TARGET_DIR, but build_ios.sh before v4.2.0-beta.5 hardcodes TARGET_DIR="$ROOT_DIR/target" (v4.1.2 line 23, v4.2.0-beta.4 line 24). Cargo writes the libraries and the OUT_DIR-derived headers to the release cache, and the old script then fails at Missing header: .../target/aarch64-apple-ios/release-ios/include/.... So inlining the step alone would not have fixed Swift. Kotlin's build_android.sh reads its output through cargo ndk -o, which follows CARGO_TARGET_DIR, so Kotlin needs nothing more.

What was done?

  • release-kotlin-sdk.yml and release-swift-sdk.yml: replaced uses: ./.github/actions/release-cargo-target-cache with an inline run: step. The script is copied verbatim. The inputs become CACHE_NAME, MAX_GIB and MIN_FREE_GIB env vars with the values each workflow used before: its own cache name, 60 and 40. The shell is the action's quoted bash --noprofile --norc -e -o pipefail "{0}". Kotlin sets it on the step; the Swift job already has it as the default. A comment explains why the step is inline.
  • release-swift-sdk.yml: two new steps.
    • "Link workspace target/ to the release Cargo target cache" runs ln -sfn "$CARGO_TARGET_DIR" "$GITHUB_WORKSPACE/target". It refuses to run if a real target already exists. That cannot happen after the job empties the workspace, since target/ is untracked in every tag. With a real directory there, ln would put the link inside it. Newer build_ios.sh reads CARGO_TARGET_DIR and never touches the link.
    • "Remove the workspace target/ link" runs with if: always() at the end of the job. swift-sdk-build.yml and tests-rs-wallet.yml reuse this workspace after a clean: false checkout and build into target/. They must never write into, or prune, the release cache through a leftover link.
  • .github/actions/release-cargo-target-cache/action.yaml: kept, because .github/actions/npm-release-build still uses it (git grep release-cargo-target-cache). A header comment points to the two inline copies and asks to keep them in sync.

Other tree-dependent steps checked in both build jobs, for tags that have the SDKs:

  • Kotlin: build_android.sh is byte-identical from v4.1.0 to v4.2-dev. The flags, the :sdk module, the jniLibs and AAR paths and ndkVersion = "28.1.13356709" all match. cargo-ndk 4.1.2 needs Rust 1.86, and v4.1.x pins 1.92.
  • Swift: build_ios.sh accepts --target all --profile release from v4.0.0 on, and the release-ios Cargo profile exists from v4.0.0-rc.2. Cargo.lock hashing, protoc and rustup steps do not depend on the tag.
  • Unchanged limits: the Kotlin SDK does not exist before v4.1.0, and Swift tags before v4.0.0-rc.2 lack the release-ios profile, so neither can be rebuilt this way. A branch dispatch still skips the Maven deploy, and Maven for such tags still goes through the manual runbook in PUBLISHING.md.

The symlink is safe for the rest of the job and the runner:

  • The zip step and the artifact paths read packages/swift-sdk/, not target/. xcodebuild -create-xcframework copies the libraries into the framework.
  • The next release job's find ... -exec rm -rf {} + removes only the link, not the cache.
  • git clean -ffdx -e target/ -e 'target/**' in swift-sdk-build.yml removes a leftover link without following it. The target/ pattern matches directories only.

How Has This Been Tested?

No workflow runs were triggered.

  • actionlint (with shellcheck) on both workflows: clean.

  • python3 yaml.safe_load on both workflows and the action: parses. A script compared the inline steps with the action. The run: bodies are identical, and env keys, values and shell match the action's inputs and defaults.

  • git diff --check: clean.

  • Local dry run of the Swift job's cache, link, build and cleanup steps. The step scripts were extracted from the workflow YAML and run against each tag's real build_ios.sh. Stub cargo and xcodebuild wrote the libraries and headers under CARGO_TARGET_DIR and checked that every -library/-headers path exists:

    tag without link with link
    v4.0.0 fails (missing header) passes
    v4.1.2 fails (missing header) passes
    v4.2.0-beta.4 fails (missing header) passes
    v4.2.0-beta.5 passes passes

    In every run the cleanup step removed the link and the cache kept its contents.

  • Scratch-repo checks of the symlink behaviour: git clean removes the link but not its target, rm -rf on the link leaves the cache intact, and ln -sfn onto a real directory nests the link inside it. The guard exists because of that last case.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 32b57e8

  • Bots — coderabbitai not yet · thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed
  • Build running
  • Approvals
    • github (.github/actions/release-cargo-target-cache/action.yaml, .github/workflows/release-kotlin-sdk.yml, .github/workflows/release-swift-sdk.yml) — ktechmidas or shumkov

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • Chores
    • Updated Kotlin and Swift SDK release workflows to manage build caches more reliably, including handling cache size and available disk space.
    • Swift release builds now clean up their temporary workspace link while preserving the cached build data.

The documented fallback for re-releasing an older tag's Kotlin or Swift
SDK is to dispatch the workflow from the dev branch with the older tag.
The build job checks out the tag and then ran the local composite action
release-cargo-target-cache, which GitHub loads from the checked-out tree.
Tags before v4.2.0-beta.5 do not contain it, so the job stopped there.

Both workflows now carry the action's step inline, with the same cache
name, size cap and free-space floor. The action stays for the npm build,
with a note to keep the copies in sync.

The Swift job also links the workspace target/ to the release cache.
build_ios.sh before v4.2.0-beta.5 ignores CARGO_TARGET_DIR and reads its
libraries and headers from target/, while cargo builds into the cache.
The link is removed at the end of the job so PR jobs sharing the
workspace never build into the release cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added this to the v4.2.0 milestone Sep 28, 2026
@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Sep 28, 2026
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: dashpay/platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6f66d400-adcf-4ace-bab9-b2f3c0a41ad1
📥 Commits

Reviewing files that changed from the base of the PR and between 6bb0c65 and 32b57e8.

📒 Files selected for processing (2)
  • .github/actions/release-cargo-target-cache/action.yaml
  • .github/workflows/release-kotlin-sdk.yml
 ____________________________________
< My Motto: Semper Bug Exterminatus. >
 ------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: dashpay/platform/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 7c08fced-edc6-457d-8893-07a6ef54ec57

📥 Commits

Reviewing files that changed from the base of the PR and between f40ee0a and 6bb0c65.

📒 Files selected for processing (3)
  • .github/actions/release-cargo-target-cache/action.yaml
  • .github/workflows/release-kotlin-sdk.yml
  • .github/workflows/release-swift-sdk.yml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Kotlin and Swift release workflows now prepare Cargo target caches inline. The Swift workflow also links workspace target/ to its cache and removes the link during cleanup.

Changes

SDK release cache workflows

Layer / File(s) Summary
Inline Cargo cache setup
.github/actions/release-cargo-target-cache/action.yaml, .github/workflows/release-kotlin-sdk.yml, .github/workflows/release-swift-sdk.yml
The release workflows validate cache names, reset caches when size or free-space thresholds are reached, and export the cache path as CARGO_TARGET_DIR. Comments identify the inline copies that should remain synchronized.
Swift workspace target link
.github/workflows/release-swift-sdk.yml
The Swift workflow links workspace target/ to the release cache. It fails if target/ exists as a non-symlink and removes the symlink during cleanup.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: pastapastapasta

Merge Risk: ⚪ Minimal · up to 6bb0c

No actionable release-workflow issue remains in the reviewed change; it is ready for normal merge checks.

Architecture Summary

Architecture risk: 🔵 Low · up to 6bb0c

The changed surface does not map to a changed system, dependency edge, entrypoint, or external dependency.

Changed systems: None identified.

Architecture concerns
No architecture-level concerns identified.

Review details

Before / after behavior

  • observed — Modified behavior in .github/actions/release-cargo-target-cache/action.yaml: Added comments identifying the Kotlin and Swift workflow copies of this step and stating they should remain synchronized.
  • observed — Modified behavior in .github/workflows/release-kotlin-sdk.yml: The workflow now implements Cargo target-cache preparation inline instead of calling ./.github/actions/release-cargo-target-cache. It rejects empty cache names, names containing /, and names beginning with ., then uses $HOME/.cache/dash-platform/release-kotlin-sdk-target. It clears and recreates the cache when its size exceeds 60 GiB or available volume space is below 40 GiB, and exports the cache path as CARGO_TARGET_DIR.
  • observed — Modified behavior in .github/workflows/release-swift-sdk.yml: Replaces the reusable cache action with inline cache preparation: validates the cache name, resets it if usage exceeds 60 GiB or free volume space is below 40 GiB, then exports the cache path as CARGO_TARGET_DIR.
  • observed — Modified behavior in .github/workflows/release-swift-sdk.yml: Adds a workspace target/ symlink to the release cache, failing if a non-symlink target/ already exists after checkout. The previous cache action is removed; for older build scripts that read workspace target/ instead of CARGO_TARGET_DIR, this link points them to the release cache.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enabling the Kotlin and Swift SDK release workflows to rebuild tags older than v4.2.0-beta.5.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@thepastaclaw

thepastaclaw commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 6bb0c65) · triage: low

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

Verified the supplied review evidence against exact head 6bb0c65; no actionable in-scope findings remain. Both inline cache scripts preserve the shared action's implementation, effective inputs, and shell, and local checks confirmed Swift link creation, directory guarding, and cleanup preserve cached contents. YAML parsing, cache-script syntax checks, and git diff --check passed; SDK builds and GitHub workflow runs were not performed.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: architecture-layering); reviewer 3: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)

  • Triage: low by gpt-6-astra (effort low) — This is a small, contained CI fix that inlines existing cache setup and adds a guarded Swift target-directory symlink with cleanup, without changing SDK implementation or any critical surface.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort high); agent phase1-reviewer, muse-spark-1.3-contributor — architecture-layering (completed, effort high); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity below 15% reserve: weekly 13% left, 5h 100% left), glm-5.3-flash (zai below 15% reserve: 5h 87% left, weekly 13% left)
  • Fresh verifier: gpt-6-astra — final-verifier; agent astra-verifier
  • Phase 2 reviewers: gpt-6-astra — general (completed, effort medium); agent phase2-reviewer, gpt-6-astra — architecture-layering (completed, effort medium); agent phase2-reviewer

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Sep 28, 2026
llbartekll
llbartekll previously approved these changes Sep 29, 2026

@llbartekll llbartekll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: the cache script now lives in three places with a keep-in-sync note; a sparse checkout of ${{ github.workflow_sha }} into a subdirectory and a uses: from there would keep a single copy.

@QuantumExplorer
QuantumExplorer merged commit fcada6d into v5.0-dev Oct 6, 2026
10 of 12 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/release-sdk-older-tag-fallback branch October 6, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants