fix(cloud): serialize auth refresh writes

Merged
KH
6mo ago
+391-39

Summary

  • write cloud auth through a pid-scoped sibling temp file, chmod 0600, then atomic rename
  • serialize file-backed read-refresh-write with a stale-aware cross-process lock and re-read/re-check stored auth under the lock
  • route file-backed CloudApiClient refreshes, including 401-forced refreshes, through the locked refresh path

Tests

  • npx vitest run packages/cloud/src
  • npm run build:config && npm --prefix packages/cloud run build