Skip to content

Fix the flaky race cancellation tests and run the Fastlane check under rbenv - #587

Merged
bradleymackey merged 1 commit into
mainfrom
devops/fix-flaky-race-test-and-ruby
Sep 25, 2026
Merged

bradleymackey merged 1 commit into
mainfrom
devops/fix-flaky-race-test-and-ruby

Conversation

@bradleymackey

Copy link
Copy Markdown
Member

Summary

This fixes two leftovers from #586: a flaky test that could fail validation, and the Fastlane check that validation was skipping.

  • Flaky test: the "Cancellation is always checked before returning" tests in Task+RaceTests.swift created a task and then cancelled it. The task could run Task.race to completion before cancel() was called. When it did, the race wasn't cancelled and correctly threw .noTasksScheduled instead of CancellationError. Both FirstValue and FirstResolved have this race. The tests now wait for the cancellation, using the existing TaskCancellationWaiter, before starting the race. Task.race itself is unchanged.
  • Fastlane check: Ruby 4.0.5 from .ruby-version is now installed on the validating Mac through rbenv. validate.sh now also puts rbenv's shims on PATH itself. Before this, shells that hadn't run rbenv init (non-interactive ones, like an agent's) found the system Ruby 2.6 and still skipped the check.

Testing

  • Before the fix: running FoundationExtensionsTests/TaskRaceTests on macOS with -test-iterations 500 -run-tests-until-failure, FirstResolved failed with .noTasksScheduled.
  • After the fix: 3,000 repetitions all passed.
  • bundle exec fastlane lanes succeeds on Ruby 4.0.5, and Gemfile.lock is unchanged.
  • make validate passed on c34aa3c in 3m36s. This time the Fastlane config step ran instead of being skipped.

🤖 Generated with Claude Code

…dating

The "Cancellation is always checked before returning" tests cancelled their
task after creating it, so the task could run the race to completion first and
get `.noTasksScheduled`. They now wait for the cancellation before racing.

validate.sh now puts rbenv's shims on PATH, so shells that haven't run
`rbenv init` use the Ruby from .ruby-version instead of skipping the Fastlane
check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bradleymackey
bradleymackey merged commit 8293b24 into main Sep 25, 2026
1 check passed
@bradleymackey
bradleymackey deleted the devops/fix-flaky-race-test-and-ruby branch September 25, 2026 13:43
bradleymackey added a commit that referenced this pull request Sep 25, 2026
## Summary

`scripts/validate.sh`, and gps-app's copy of it, are now one tested package, [badbundle/local-check](https://github.com/badbundle/local-check) (v0.1.0), which both repos depend on. `make validate` still posts the same **Validate (local)** check that `main` requires, from the same checks.

- **The checks** are in `local-check.config.ts` and are the same as before:
  1. `make lint`, keeping `Vault/.build` between runs so it's incremental;
  2. the Fastlane config check, with rbenv's shims first on `PATH` as #587 added. It's skipped, and named on the check, if the Ruby in `.ruby-version` isn't installed;
  3. a build and full run of `iOSAllTests` with Xcode 27.0, on a throwaway iPhone 18 Pro Max simulator addressed by UDID.

  The config is loaded from the commit being validated, so a commit carries its own checks.
- **Setup is `bun install`.** `package.json` pins `github:badbundle/local-check#v0.1.0`, and its `prepare` script writes `.githooks/pre-push` and points `core.hooksPath` at it. The hook is now a small shim that runs the installed local-check.
- **`make validate`** runs `bun install --frozen-lockfile` first, so the copy that runs always matches the pin, then `bun run validate`.
- **Results and logs** move from `.git/validate/` to `.git/local-check/`. The worktree and DerivedData move to `~/Library/Caches/local-check/`.
- **Docs:** `README.md`'s Validation section and both `AGENTS.md` files now describe the Bun setup and point to `local-check.config.ts`.
- **Removed:** `scripts/validate.sh`.

Moving to a newer local-check is a deliberate change: bump the tag in `package.json`, run `bun install`, and validate.

## Test plan

- [x] `make validate` on this PR's commit: Lint, Fastlane config, Build and Tests passed in 3m34s. The Fastlane check ran on Ruby 4.0.5, and the throwaway simulator was deleted afterwards.
- [x] The new pre-push hook posted **Validate (local): success** when the branch was pushed.
- [x] A fresh `bun install --frozen-lockfile` from `bun.lock` installs local-check 0.1.0, identical to the tag.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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