Skip to content

ci: read the Platform branch from its default branch - #1186

Merged
llbartekll merged 1 commit into
developfrom
ci/schema-release-platform-default-branch
Oct 6, 2026
Merged

llbartekll merged 1 commit into
developfrom
ci/schema-release-platform-default-branch

Conversation

@llbartekll

@llbartekll llbartekll commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Freeze published App Store schema has failed on every scheduled run since 2026-09-30 17:29 UTC (e.g. https://github.com/dashpay/dashwallet-ios/actions/runs/37040985404):

Schema registry is unavailable at dashpay/platform:v4.2-dev/packages/swift-sdk/schema-releases.json.

The token and the registry are fine. schema_release.rb pins PLATFORM_BRANCH = "v4.2-dev", and Platform renamed that branch to v5.0-dev. The branches API follows the rename, but the contents API with ?ref=v4.2-dev returns 404 ("No commit found for the ref"), which the script reports as a missing registry. #1174 fixed the same rename in the TestFlight workflow by writing in the new name, so the next rename would break both again.

What was done?

  • schema_release.rb: removed PLATFORM_BRANCH. GitHub#platform_branch reads default_branch from GET repos/dashpay/platform once per run (lazily, so next-build / record-build / bind-build make no extra request), rejects a missing or unsafe name, and turns an HTTP error into a clear token-access message. The registry read, the freeze dispatch ref and both gate messages use it. The registry location is printed to the step summary.
  • release-dashpay-testflight.yml: platform_ref is now optional and blank by default. actions/checkout with a blank ref for another repository checks out its default branch. run-name and the release summary show "default branch" when it is blank. Any branch, tag or SHA can still be entered.
  • SCHEMA_RELEASES.md: setup step 2 refers to Platform's default branch instead of v4.2-dev.

There is deliberately no override variable. The Platform worker never accepts a Platform ref from its caller, so an iOS-side override would read the registry from one branch while the worker writes to another. If the default branch ever points somewhere wrong, gate still blocks the upload because the selected Platform commit will not contain the freeze.

Companion Platform change: dashpay/platform#5293 (worker checkout and BASE_BRANCH in freeze_appstore_release.py). The two are independent. This PR alone makes the scheduled run green again: the 3.0.0 freeze is already merged on v5.0-dev, so sync only records it as merged. The Platform PR must land before the next App Store release that needs a new freeze.

How Has This Been Tested?

  • ruby -I.github/scripts -e 'Dir[".github/scripts/*_test.rb"].sort.each { |f| require File.expand_path(f) }': 101 runs, 0 failures (Ruby 4.0 locally; CI uses 3.3).
  • python3 -m unittest discover -s .github/scripts -p 'test_*.py': 9 tests pass.
  • Test fakes use trunk-dev instead of the live branch name, so a reintroduced hardcode would fail. New tests cover reading the branch once and dispatching with it, and rejecting a missing, empty or unsafe name or a 403.
  • Live read-only check with a personal token: platform_branch returns v5.0-dev and the registry reads (49,398 bytes), which is the read that fails in the scheduled runs today.
  • After merge: a sync dispatch with dry_run: true should print Schema registry: dashpay/platform:v5.0-dev/… and report the 3.0.0 freeze as merged.

Breaking Changes

None. A TestFlight dispatch with a blank platform_ref now uses Platform's default branch, which is what the old pre-filled value pointed at.

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 made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Releases can now use the Platform repository’s current default branch when no branch is specified. Specified branches continue to be used as supplied.
    • Release checks and workflow summaries now reflect the selected branch.
  • Documentation

    • Setup instructions now describe using Platform’s default branch and note that changing its name does not require a tooling update.

Freeze published App Store schema has failed on every scheduled run since
2026-09-30: schema_release.rb pinned PLATFORM_BRANCH = "v4.2-dev", Platform
renamed that branch to v5.0-dev, and the contents API returns 404 for the old
ref, which surfaced as "Schema registry is unavailable".

The script now reads dashpay/platform's default_branch once per run and uses it
for the registry read, the freeze dispatch and the gate messages. The TestFlight
workflow's platform_ref defaults to blank, which checks out the same default
branch, so the next rename needs no edit in either place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 03b44deb-06d6-41b3-8484-3d1637c58f71
📥 Commits

Reviewing files that changed from the base of the PR and between adbf9b8 and 21b8d3f.

📒 Files selected for processing (4)
  • .github/scripts/schema_release.rb
  • .github/scripts/schema_release_test.rb
  • .github/workflows/release-dashpay-testflight.yml
  • SCHEMA_RELEASES.md

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

Schema release tooling now resolves Platform’s default branch for registry reads and workflow dispatches. The TestFlight workflow accepts a blank Platform ref to select the default branch. Setup instructions now refer to the default branch.

Changes

Platform default branch

Layer / File(s) Summary
Resolve and validate the default branch
.github/scripts/schema_release.rb, .github/scripts/schema_release_test.rb
The GitHub client fetches and caches Platform’s default branch, validates its name, and uses it as the workflow dispatch ref. Tests cover caching, dispatch, invalid values, and lookup errors.
Use the resolved branch in release checks
.github/scripts/schema_release.rb, .github/scripts/schema_release_test.rb
The pipeline reads the registry from the resolved branch. Freeze-related gate errors identify that branch, and tests expect the updated branch name.
Select the default branch in the TestFlight workflow
.github/workflows/release-dashpay-testflight.yml, SCHEMA_RELEASES.md
A blank workflow input selects Platform’s default branch. Workflow labels and setup instructions reflect this behavior.

Priority: ⬆️ High

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Pipeline as SchemaRelease::Pipeline
  participant GitHub as SchemaRelease::GitHub
  participant API as GitHub REST API
  Pipeline->>GitHub: Request Platform default branch
  GitHub->>API: GET /repos/dashpay/platform
  API-->>GitHub: Return default_branch
  GitHub-->>Pipeline: Return cached, validated branch
  GitHub->>API: Dispatch workflow with branch ref
Loading

Merge Risk: ⚪ Minimal · up to 21b8d

No concrete issue remains that would prevent merging the default-branch selection change after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 21b8d

The change retains branch validation and release-schema checks, with no demonstrated security-control bypass. Remaining uncertainty concerns whether the separate Platform freeze worker preserves branch identity and retry behavior when the default branch changes.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Default-branch selection affects Platform workflow execution and Platform code built on a credential-bearing TestFlight runner. The visible exposure is the existing two-repository release path, including signing and App Store upload authority; broader token access and repository protection differences cannot be established from the supplied evidence.

Trust Boundaries and Controls

  • observed — The new script selector reads metadata from the fixed Platform repository through authenticated HTTPS, validates the branch name against an allowlist, and URL-encodes the registry ref. It does not introduce a caller-supplied Platform-ref override. The existing release gate still runs before building and immediately before upload for channels other than internal-only.

Resilience and Maintainability Implications

  • observed — The existing producer protects immutable release evidence with atomic non-force updates, but repeated observations can redispatch before a freeze is registered. Ambiguous writes require remote reconciliation rather than automatic retry. These behaviors predate this PR; documentation describes worker-side branch and PR reuse, but that implementation was unavailable for verification.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 2 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reading the Platform branch from its default branch.
Full details: Docstring Coverage

Explanation

Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Final review complete — no blockers (commit 21b8d3f) · triage: low

@llbartekll llbartekll changed the title fix(release): read the Platform branch from its default branch ci: read the Platform branch from its default branch Oct 5, 2026

@thepastaclaw thepastaclaw 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.

Final validation — Phase 1 + Phase 2

The exact-head diff consistently uses a lazy, cached Platform default-branch lookup for registry reads and freeze dispatches, and preserves explicit TestFlight ref overrides. One nonblocking limitation remains: the new validation rejects valid branch names containing slashes, weakening the documented rename-independence guarantee. Verification was static only; the supplied exact-head CI snapshot reports a successful test job and latest PR-title check.

💬 1 nitpick(s)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: low by gpt-6.1-sol (effort low) — This is a small, contained CI tooling change that replaces a hardcoded branch with a validated default-branch lookup and updates workflow defaults, tests, and documentation.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 97% left, weekly 99% left; passed over gemini-3.8-flash-high (antigravity below 15% reserve: weekly 15% left, 5h 100% left)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `.github/scripts/schema_release.rb`:
- [NITPICK] .github/scripts/schema_release.rb:140-142: Branch-name validation rejects slashes, so a slashed default-branch name would still require a tooling edit
  The new regex rejects valid Git branch names such as `release/v6`. If Platform adopts such a default branch, registry reads and freeze dispatches will stop with `Unexpected default branch`, despite the documented guarantee that renaming the default branch requires no code change. Both consumers transport the name safely: `GitHub#file` URI-encodes the query value, and `dispatch` JSON-encodes the workflow ref. Permit valid slash-separated branch names while retaining rejection of missing or malformed values, and add a regression case for a slashed default branch. This does not affect the current `v5.0-dev` branch and is nonblocking.

Comment on lines +140 to +142
name = request("get", "repos/#{PLATFORM_REPO}")["default_branch"]
unless name.is_a?(String) && name.match?(/\A[A-Za-z0-9][A-Za-z0-9._-]*\z/)
raise Error, "Unexpected default branch for #{PLATFORM_REPO}: #{name.inspect}"

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.

💬 Nitpick: Branch-name validation rejects slashes, so a slashed default-branch name would still require a tooling edit

The new regex rejects valid Git branch names such as release/v6. If Platform adopts such a default branch, registry reads and freeze dispatches will stop with Unexpected default branch, despite the documented guarantee that renaming the default branch requires no code change. Both consumers transport the name safely: GitHub#file URI-encodes the query value, and dispatch JSON-encodes the workflow ref. Permit valid slash-separated branch names while retaining rejection of missing or malformed values, and add a regression case for a slashed default branch. This does not affect the current v5.0-dev branch and is nonblocking.

source: glm-5.3-flash (phase1-reviewer: general)

@romchornyi romchornyi 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.

No blockers. Reviewed at 21b8d3f: the lazy, memoised platform_branch is correct, next-build / record-build / bind-build make no extra request, and no PLATFORM_BRANCH reference is left. This makes the scheduled sync read the registry again.

The points below are recommendations and do not block the merge.

1. A default-branch flip is not the same as a rename. dashpay/platform already has v5.1-dev and v6.0-dev next to the default v5.0-dev, so the next transition is likely to be a default flip to an existing branch. The v6.0-dev registry is 48,898 bytes against 49,398 on v5.0-dev / v5.1-dev, so it is behind on at least one freeze. If the default moves there before a forward-merge, gate reads merged from it and blocks internal/external builds even when platform_ref points at a commit that has the freeze, and the scheduled sync re-dispatches the freeze against the new default every 12 h. The same flip silently changes what a blank platform_ref builds (release-dashpay-testflight.yml:18); the internal-only channel has no gate to stop it. Worth a line in SCHEMA_RELEASES.md saying that registries must be forward-merged before Platform's default is switched.

2. Record the resolved branch. With a blank platform_ref the run name and summary say only "default branch" (release-dashpay-testflight.yml:863). Printing git -C platform rev-parse --abbrev-ref HEAD in the provenance step would keep the line auditable after the default moves.

3. Branch-name check is stricter than the companion PR. schema_release.rb:141 rejects names with a slash (release/6.0), while dashpay/platform#5293 accepts anything git check-ref-format accepts. file URL-encodes the ref and dispatch sends it as JSON, so the restriction is not needed for safety. Already noted by thepastaclaw.

4. Error message on 5xx/429. The rescue HTTPError at schema_release.rb:146 reports every status as a token-access problem. merged_registry already separates 401/403/404 from "unavailable or rate-limited"; the same split here would stop a 503 from sending someone to rotate a healthy token.

5. Test coverage of the registry read. The pipeline fake's file(*_args) ignores the ref, so trunk-dev is asserted only in the gate message and against dispatch. A hardcoded ref reintroduced in merged_registry would still pass. Having the fake record its arguments and asserting the ref once would close that.

6. CLAUDE.md:75 still tells contributors to pin Platform v4.2-dev for release builds.

Merge order. Until dashpay/platform#5293 lands, the sync here goes green while a new freeze dispatch would reach a worker that still checks out v4.2-dev; the PR description already calls this out.

🤖 Reviewed with Claude Code

@llbartekll
llbartekll merged commit 3df12fc into develop Oct 6, 2026
3 of 5 checks passed
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.

3 participants