feat(sites): custom deploy id - #195
Conversation
|
@codex review |
🦋 Changeset detectedLatest commit: c6acd4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryThe PR adds caller-supplied, case-sensitive site deployment IDs and replacement handling, including validation, documentation, and deployment-management updates.
Confidence Score: 3/5The PR does not yet appear safe to merge because concurrent replacement or promotion can still expose mixed, missing, or partially rewritten deployment content. Custom-ID replacement has no exclusive claim over its storage prefix, allowing concurrent replacements to interleave, and its live/rollback guard is not refreshed before deleting files, allowing a concurrently promoted deployment to be rewritten. Files Needing Attention: packages/cli/src/commands/sites/deploy.ts, packages/cli/src/commands/sites/api.ts, packages/cli/src/commands/sites/deployments/publish.ts
|
| Filename | Overview |
|---|---|
| packages/cli/src/commands/sites/deploy.ts | Adds custom-ID conflict and replacement handling, but replacement remains vulnerable to concurrent deployment and promotion races. |
| packages/cli/src/commands/sites/deployments/publish.ts | Revalidates the target against fresh state, but validation and promotion are not atomic with concurrent replacement. |
| packages/cli/src/commands/sites/api.ts | Adds idempotent prefix deletion; optimistic state reconciliation still does not provide exclusive prefix ownership. |
| packages/cli/src/commands/sites/constants.ts | Expands deploy-ID validation and introduces exact, case-aware deployment lookup. |
| packages/cli/src/commands/sites/deploy-id.ts | Adds custom deployment identity while preserving content-hash and Git metadata. |
Sequence Diagram
sequenceDiagram
participant A as Replacement A
participant B as Replacement B / Publish
participant S as Site state
participant P as Deploy prefix
A->>S: Read initial state
B->>S: Read same state
A->>S: Remove deploy record
B->>S: Claim or promote deploy
A->>P: Delete prefix
A->>P: Upload replacement files
B->>P: Upload files or route production
Note over P: Prefix can contain partial or mixed content
Reviews (7): Last reviewed commit: "refactor(sites): confirm and clear-first..." | Re-trigger Greptile
d595994 to
067d845
Compare
| if (deployId === current || deployId === previous) { | ||
| return { | ||
| deployId, | ||
| skipUpload, | ||
| conflict: { | ||
| record: existing, | ||
| reason: deployId === current ? "live" : "rollback", | ||
| }, | ||
| }; | ||
| } | ||
| if (customId && !force) { | ||
| return { |
There was a problem hiding this comment.
Promotion bypasses replacement guard
If another process promotes the target deploy ID after this stale-snapshot guard runs but before the replacement upload completes, this command rewrites the now-live or rollback prefix without revalidating the reconciled pointers, causing the router to serve overwritten, missing, or mixed files.
Knowledge Base Used: CLI automation workflows
It was mentioned in Discord the following:
This PR adds the ability to pass a
deploy-id, and also relaxes the case sensitivity