Skip to content

Make relay install lock use idiomatic Effect policies#2983

Draft
cursor[bot] wants to merge 9 commits into
mainfrom
cursor/idiomatic-effect-patterns-3514
Draft

Make relay install lock use idiomatic Effect policies#2983
cursor[bot] wants to merge 9 commits into
mainfrom
cursor/idiomatic-effect-patterns-3514

Conversation

@cursor

@cursor cursor Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Refactored relay client executable/release resolution to use Option instead of null-ish sentinels.
  • Reworked relay install lock handling to use Duration, DateTime, and Schedule for stale-lock and retry policy logic.
  • Updated relay client tests to use @effect/vitest assert style and Layer.mock for the child process spawner.
  • Added deterministic stale-lock coverage using TestClock.

Why

This keeps the relay install path closer to idiomatic Effect patterns and makes time-based lock behavior testable without relying on wall-clock time or ad-hoc millisecond arithmetic.

UI Changes

Not applicable; no UI changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (N/A)
  • I included a video for animation/interaction changes (N/A)

Verification

  • PATH="/home/ubuntu/.nvm/versions/node/v24.16.0/bin:$PATH" pnpm --dir packages/shared test src/relayClient.test.ts
  • PATH="/home/ubuntu/.nvm/versions/node/v24.16.0/bin:$PATH" pnpm exec vp check
  • PATH="/home/ubuntu/.nvm/versions/node/v24.16.0/bin:$PATH" pnpm exec vp run typecheck
Open in Web View Automation 

Note

Add stale lock detection and Effect-idiomatic retry scheduling to relay install lock

  • Replaces ad-hoc lock retry logic in acquireInstallLock with a typed Schedule that retries on RelayClientInstallLockBusy errors and gives up with install_locked after exhausting attempts.
  • Adds isInstallLockStale and attemptAcquireInstallLock helpers that stat the lock file, compute its age using DateTime.distance, and remove it if older than INSTALL_LOCK_STALE_AGE (5 minutes) before retrying acquisition.
  • Converts INSTALL_LOCK_RETRY_DELAY and INSTALL_LOCK_STALE_AGE from raw numbers to Duration values, and internal option handling in resolveReleaseAsset and resolvePathExecutable from nullable returns to Option.
  • Adds a new test 'removes stale install locks before installing' that backdates a lock file to epoch, advances TestClock by 6 minutes, and asserts the lock is cleared and install succeeds.

Macroscope summarized a8c8572.

cursoragent and others added 9 commits June 6, 2026 16:09
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint 50af7188c45504c4cf76a4d9ba23a0d6e9b94177 2c1319138333022ef53422fedb7381e34b960fe8
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
App version: 0.1.0
Git commit: af6e2b59dda6f1ecb297a8c342efe7592ee0548e
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
App version: 0.1.0
Git commit: af6e2b59dda6f1ecb297a8c342efe7592ee0548e
Update Details Update Permalink
DetailsBranch: pr-2983
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
Git commit: af6e2b59dda6f1ecb297a8c342efe7592ee0548e
Update Permalink
DetailsBranch: pr-2983
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
Git commit: af6e2b59dda6f1ecb297a8c342efe7592ee0548e
Update QR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant