Skip to content

Fix Cloudflare build handoff, OAuth and interrupted deploy recovery - #345

Closed
TheAlexLichter wants to merge 2 commits into
mainfrom
fix/cloudflare-migration-recovery
Closed

TheAlexLichter wants to merge 2 commits into
mainfrom
fix/cloudflare-migration-recovery

Conversation

@TheAlexLichter

@TheAlexLichter TheAlexLichter commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

ATTENTION: HEAVILY AI GENERATED, STILL WIP

Cloudflare migrations can fail when Vite emits a nested Worker entry or server-side font files. Browser authentication also uses different credential stores across commands, preventing domain cleanup, and a deploy interrupted after activation can leave a receipt that blocks the next upload.

This change accepts contained nested entries and binary fonts, gives actionable errors for unsupported artifacts, uses Cloudflare's public auth SDK with one encrypted profile throughout the compatibility transport, and performs final-domain deletion/restoration through that authenticated transport. Retries recognize the verified last candidate as the live parent and start a new receipt chain. Existing target, receipt, uploader, traffic and secret-inheritance checks remain in place; DNS ownership conflicts are not overridden.

Regression coverage exercises real cf prebuilt dry runs, encrypted OAuth and named profiles, account-pinned domain/cron cleanup, failed-domain restoration, and interrupted activation recovery. The public docs describe final-domain browser authentication and restoration outcomes. Based on 0.21.5, including upstream's active-secret pinning changes.

Validation: formatting, lint, builds, artifact checks, platform lint, and typechecking pass. The full SDK/platform run passes 11,050 tests with two timestamp assertions failing; clean upstream 0.21.5 reproduces exactly those two failures. All four npm full packed consumers pass. The pnpm matrix fails on the default age policy for newly published dependencies; with a process-local age override, all four fail later when init loads a config from a package path removed by its own install. The latter also reproduces on clean upstream 0.21.5. These baseline issues remain visible; this PR has not been published as a package. Final-head verification includes the HTTP error-reporting follow-up and its two passing transport tests. This adds 18 passing regressions compared with clean upstream. The partial CodeRabbit review and disposition are posted in the PR; excluded lockfile coverage and the later commit mean Gate B is incomplete.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​cloudflare/​workers-auth@​0.9.4831008297100

View full report

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
bddbd9c 2026-09-30T10:46:04.843Z View logs ↗

@TheAlexLichter

Copy link
Copy Markdown
Member Author

Partial local CodeRabbit IDE review of exact head 31eb6357fea8ecc6e5f03e28d71aa1e35111e091, base 1b477edf73dc1a1e55e437d3c29cb78f1f79c25c.

Verdict: invalid as Gate B evidence. The budget helper accepted the committed scope and exact SHA, but the review covered only 15 of 16 changed files; pnpm-lock.yaml was omitted. No passed gate is claimed. The HTTP-error follow-up at bddbd9c6c1c62abc5c6e89517198cba92764b87b is outside this reviewed head.

Actionable findings and disposition:

  • Major: normalize Windows relative paths before the containment check. Not applicable: this code imports relative from pathslash, whose Windows implementation already normalizes separators to /. It does not use raw Node path.relative. Escape/absolute/drive regressions remain covered.
  • Minor: report HTTP status when custom-domain cleanup returns non-JSON. Fixed in bddbd9c6c1c62abc5c6e89517198cba92764b87b; production transport tests cover HTTP 503 and malformed HTTP 200, and ensure credential values are absent from diagnostics.
  • Minor: make encrypted-preference persistence best-effort on valid-session reads. Retained explicit failure to preserve the repository's session-switching invariant: adopted OAuth sessions persist the keyring preference so later compatible CLI logins update the same encrypted store. A failed preference write is not silently accepted or downgraded to plaintext.

Other returned comments were LGTM. The CLI review pool was unavailable; all CodeRabbit activity used the global budget helper. Review remains incomplete.

@TheAlexLichter
TheAlexLichter deleted the fix/cloudflare-migration-recovery branch September 30, 2026 11:17
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