Skip to content

feat(sites): custom deploy id - #195

Open
jamie-at-bunny wants to merge 8 commits into
mainfrom
feat/sites-custom-deploy-id
Open

feat(sites): custom deploy id#195
jamie-at-bunny wants to merge 8 commits into
mainfrom
feat/sites-custom-deploy-id

Conversation

@jamie-at-bunny

@jamie-at-bunny jamie-at-bunny commented Aug 28, 2026

Copy link
Copy Markdown
Member

It was mentioned in Discord the following:

regarding the sites support in the CLI: One thing that we might want to have is being able to supply a custom deploy ID. It looks like we might not only want to use this with static websites, but also other stuff we host in Bunny storage zones, e.g. device catalogs for our customer facing software. And the catalog releases use a timestamp + something else to be identified. Would be super helpful, if we could use the same ID with the deployments. Then we don't have to look and try which deployment is which.

This PR adds the ability to pass a deploy-id, and also relaxes the case sensitivity

@bunnynet-devops

Copy link
Copy Markdown

@codex review

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c6acd4b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@bunny.net/cli Minor
@bunny.net/cli-linux-x64 Minor
@bunny.net/cli-linux-arm64 Minor
@bunny.net/cli-darwin-x64 Minor
@bunny.net/cli-darwin-arm64 Minor
@bunny.net/cli-windows-x64 Minor

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

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds caller-supplied, case-sensitive site deployment IDs and replacement handling, including validation, documentation, and deployment-management updates.

  • Supports --deploy-id while retaining content hashes and Git provenance.
  • Detects content, case-variant, live, and rollback conflicts.
  • Clears replaced deployment prefixes before uploading and revalidates deployment publication against fresh state.

Confidence Score: 3/5

The 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

Important Files Changed

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
Loading

Reviews (7): Last reviewed commit: "refactor(sites): confirm and clear-first..." | Re-trigger Greptile

Comment thread packages/cli/src/commands/sites/deploy.ts
Comment thread packages/cli/src/commands/sites/deploy.ts
Comment thread packages/cli/src/commands/sites/deploy.ts Outdated
Comment thread packages/cli/src/commands/sites/api.ts Outdated
Comment thread packages/cli/src/commands/sites/deploy.ts Outdated
@jamie-at-bunny
jamie-at-bunny force-pushed the feat/sites-custom-deploy-id branch from d595994 to 067d845 Compare August 30, 2026 11:02
Comment on lines +134 to +145
if (deployId === current || deployId === previous) {
return {
deployId,
skipUpload,
conflict: {
record: existing,
reason: deployId === current ? "live" : "rollback",
},
};
}
if (customId && !force) {
return {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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

Fix in Claude Code

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.

3 participants