Skip to content

Support assets-only deployments without delegation - #520

Merged
jamesopstad merged 6 commits into
mainfrom
james/deploy-assets-directory
Nov 5, 2026
Merged

jamesopstad merged 6 commits into
mainfrom
james/deploy-assets-directory

Conversation

@jamesopstad

Copy link
Copy Markdown
Contributor

Deploy any prebuilt static asset directory directly with cf deploy [directory] and the equivalent Preview deployment and version creation commands.

The directory form creates assets-only Build Output, reuses optional assets-only Worker configuration, and skips project build delegation. Projects containing a configured Worker entrypoint or Container continue to omit the directory and use the delegated build path.

@jamesopstad
jamesopstad added this pull request to stack #521 November 5, 2026 13:06
@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@520

commit: bca4927

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 189.7 ms 4.8 ms 178.3 ms 196.4 ms
base 198.8 ms 13.2 ms 187.2 ms 237.1 ms

Δ (PR vs base): ↓ -9.1 ms (-4.6%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

🤖 I've done a thorough review of your PR.
Adds assets-only directory uploads across deploy workflows.

  1. Posted 1 inline documentation finding.

github run

@jamesopstad
jamesopstad force-pushed the james/deploy-assets-directory branch from 51d2398 to ed94034 Compare November 5, 2026 13:11
@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@jamesopstad
jamesopstad marked this pull request as ready for review November 5, 2026 13:15
@jamesopstad
jamesopstad requested a review from a team as a code owner November 5, 2026 13:15

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of bcff1c9f.

This review, of ed940342

💬 Approved with comments — Solid, well-tested change. There is one WARNING: the project root is accepted as the static assets directory, which could publish source and dotenv files. There is also one SUGGESTION: progress output ignores --quiet.

Findings: 1 warning · 1 suggestion (2 are inline comments on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.

🔧 Fix with your agent

Paste the following into your coding agent to investigate and fix these issues.

Fix the following code review issues found in pull request #520.

Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
  for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

## WARNING (1)

### [Code Quality] The project root is explicitly accepted as the static assets directory, so source files, config and dotenv files could be published as public assets
- **File:** packages/cli/src/commands/deploy/static-assets.ts:82

## SUGGESTION (1)

### [Code Quality] Static-assets progress output ignores `--quiet`, unlike the delegated build path
- **File:** packages/cli/src/commands/deploy/static-assets.ts:96

📋 Code Quality: ⚠️ 1 warning · 1 suggestion

The project root is accepted as the assets directory; progress lines ignore --quiet.

Recommendation: 📝 Minor Comments

  • [WARNING] The project root is explicitly accepted as the static assets directory, so source files, config and dotenv files could be published as public assets (packages/cli/src/commands/deploy/static-assets.ts:82)
  • [SUGGESTION] Static-assets progress output ignores --quiet, unlike the delegated build path (packages/cli/src/commands/deploy/static-assets.ts:96)
View full review
  • WARNING: packages/cli/src/commands/deploy/static-assets.ts:81-88: the sourceDirectory !== root exemption lets cf deploy . (or cf deploy "") use the project root as the assets directory. The root holds cloudflare.config.ts, package.json, .env*, .git and node_modules. Unless writeAssets filters these out, they become publicly served assets, and copying the root into .cloudflare/output/... (which sits inside the root) may also recurse. No test covers this case.
  • SUGGESTION: packages/cli/src/commands/deploy/static-assets.ts:95-107: the log.section, log.message and log.success progress lines are always written, even with --quiet. The delegated build runs silently when --quiet is set.

✅ All other checks passed

🚀 Release: ✅ LGTM

The changeset is present. Risk: low.


🔒 Security: ✅ LGTM

No security issues beyond the root-directory concern noted in the code quality section.


📖 AGENTS.md: ✅ LGTM

No issues found.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

No issues found.


Reviewed commit: ed940342

@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 8146fa7d.

This review, of bcff1c9f

💬 Approved with comments — Solid, well-tested change. The --quiet note is fixed. One WARNING remains: cf deploy . accepts the project root as the static assets directory, which could publish source, config and dotenv files.

Findings: 1 warning

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.

🔧 Fix with your agent

Paste the following into your coding agent to investigate and fix these issues.

Fix the following code review issues found in pull request #520.

Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
  for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

## WARNING (1)

### [Code Quality] The project root is still accepted as the static assets directory, so `cf deploy .` may publish source, config and dotenv files as public assets
- **File:** packages/cli/src/commands/deploy/static-assets.ts:83

📋 Code Quality: ⚠️ 1 warning

The --quiet note is fixed. Accepting the project root as the assets directory is still open.

Recommendation: 📝 Minor Comments

  • [WARNING] The project root is still accepted as the static assets directory, so cf deploy . may publish source, config and dotenv files as public assets (packages/cli/src/commands/deploy/static-assets.ts:83)
View full review

WARNING: packages/cli/src/commands/deploy/static-assets.ts:82-89

  • The sourceDirectory !== root exemption means cf deploy . (or cf deploy "") passes both checks.
  • writeAssets({ root, sourceDirectory: root }) then copies the whole project, including cloudflare.config.ts, package.json, .env*, .git and node_modules, and the .cloudflare/output directory it is writing into.
  • Unless writeAssets filters these out, they are served publicly on a production deploy.
  • No test covers the root case.

The --quiet handling is fixed (static-assets.ts:96-112) and covered by a new test.


✅ All other checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present.


🔒 Security: ✅ LGTM

The isWithin checks and realpath resolution correctly stop symlink escapes into .cloudflare/output. The exposure risk of accepting the project root as the assets directory is covered in the code quality section.


📖 AGENTS.md: ✅ LGTM

No issues found.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

No issues found.


Reviewed commit: bcff1c9f

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There was a discussion about whether this should also be a named (not positional) parameter. But I think that it makes sense for this since it would be the primary target of the command.
We won't support a positional worker javascript file - that will require a configuration file.

@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 77dc4b6f.

This review, of 8146fa7d

💬 Approved with comments — Well-tested change with no blocking or warning-level issues. One INFO note: no test covers deploying the project root.

Findings: 1 info (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 info

One INFO note: no test covers the project-root (cf deploy .) branch.

Recommendation: 💬 Optional Nits

  • [INFO] No test covers the sourceDirectory === root exemption (cf deploy .) (packages/cli/src/commands/deploy/static-assets.ts:86)
View full review

The earlier WARNING about accepting the project root as the assets directory is no longer raised. Deploying the root needs an explicit cf deploy ., which matches the existing assets.directory: "." behaviour and its .assetsignore exclusions.

INFO: no test covers the sourceDirectory === root branch (static-assets.ts:85-92). That leaves the claim that writeAssets skips .cloudflare when it copies the root untested in this pull request.


✅ All other checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present.


🔒 Security: ✅ LGTM

Path handling resolves the directory with realpath and rejects locations inside .cloudflare/output, so a symlink cannot point the source into the output directory. The change adds no process spawning and builds no shell commands.


📖 AGENTS.md: ✅ LGTM

No issues found.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

No issues found.


Reviewed commit: 8146fa7d

@petebacondarwin
petebacondarwin force-pushed the james/deploy-assets-directory branch from 8146fa7 to 77dc4b6 Compare November 5, 2026 18:03

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 31cb54a2.

This review, of 77dc4b6f

💬 Approved with comments — Well-tested change with no blocking or warning-level issues. One INFO note: no test covers deploying the project root.

Findings: 1 info

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 info

One INFO note: no test covers the project-root (cf deploy .) branch.

Recommendation: 💬 Optional Nits

  • [INFO] No test covers the sourceDirectory === root exemption (cf deploy .) (packages/cli/src/commands/deploy/static-assets.ts:86)
View full review

The earlier WARNING about accepting the project root as the assets directory is no longer raised. Deploying the root needs an explicit cf deploy ., which matches the existing assets.directory: "." behaviour and its .assetsignore exclusions.

INFO: no test covers the sourceDirectory === root branch (static-assets.ts:85-92). That leaves the claim that writeAssets skips .cloudflare when it copies the root untested in this pull request.


✅ All other checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present.


🔒 Security: ✅ LGTM

Path handling resolves the directory with realpath and rejects locations inside .cloudflare/output, so a symlink cannot point the source into the output directory. The change adds no process spawning and builds no shell commands.


📖 AGENTS.md: ✅ LGTM

No issues found.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

No issues found.


Reviewed commit: 77dc4b6f — same changes as 8146fa7d, so this is that commit's review (no new review was run; line numbers are as of 8146fa7d)

@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@petebacondarwin
petebacondarwin enabled stacked auto-merge November 5, 2026 18:11
@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 10e89083.

This review, of 31cb54a2

💬 Approved with comments — No blocking or warning-level issues. One INFO note remains: no test covers the project-root (cf deploy .) exemption.

Findings: 1 info

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 info

One INFO note: the project-root exemption has no test.

Recommendation: 💬 Optional Nits

  • [INFO] No test covers the sourceDirectory === root exemption (cf deploy .) (packages/cli/src/commands/deploy/static-assets.ts:86)
View full review

The code has not changed since the last review. The positional directory added to deploy, previews deploy and workers versions create, the formatConfigIssues extraction, and the metadata and generated JSON updates are consistent and have tests.

INFO: no test covers the sourceDirectory === root exemption (static-assets.ts:85-92), so this pull request never exercises the claim that writeAssets skips .cloudflare when it copies the project root.


✅ All other checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present.


🔒 Security: ✅ LGTM

Path handling resolves the directory and refuses locations inside .cloudflare/output. The change adds no process spawning and builds no shell commands.


📖 AGENTS.md: ✅ LGTM

No issues found.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

The clarification in docs/architecture.md about the assets-only source config exception matches the code.


Reviewed commit: 31cb54a2

@jamesopstad
jamesopstad disabled stacked auto-merge November 5, 2026 19:02
@jamesopstad
jamesopstad force-pushed the james/deploy-assets-directory branch from 31cb54a to 10e8908 Compare November 5, 2026 19:06

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of db02872e.

This review, of 10e89083

✅ Approved — No findings. The earlier INFO note about the cf deploy . project-root path is resolved: a new test checks that .cloudflare is excluded from the uploaded assets.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present.


🔒 Security: ✅ LGTM

Path handling resolves the directory and refuses locations inside .cloudflare/output. The change adds no process spawning and builds no shell commands.


📖 AGENTS.md: ✅ LGTM

No issues found.


📋 Code Quality: ✅ LGTM

🔄 Since last review: 1 finding resolved, 0 preserved, 0 new

The earlier note about the sourceDirectory === root exemption (static-assets.ts) is resolved. The new test in assets.test.ts runs cf deploy . with .cloudflare state and stale Build Output in place. It checks that the build delegate is not called and that no /.cloudflare/ entries end up in the uploaded manifest or in the written assets.

On the discussion thread about deploying the project root: the author's explanation matches the code. The directory form keeps the semantics of assets.directory: ".", with .assetsignore controlling exclusions, and .cloudflare is excluded explicitly.

The new handling of a positional directory in deploy, previews deploy and workers versions create looks correct and has tests.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

The documentation updates match the code.


Reviewed commit: 10e89083

@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

Adds assets-only directory uploads for deploy, Preview deploy, and version creation.

Posted 1 inline suggestion for missing Container-rejection coverage.

github run

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of bca49278.

This review, of db02872e

✅ Approved — No findings. Since the last approved review, only tests were added, and they cover the new assets-only directory deployment path.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present.


🔒 Security: ✅ LGTM

The only change since the last review is a test file. It raises no security concerns.


📖 AGENTS.md: ✅ LGTM

No issues found.


📋 Code Quality: ✅ LGTM

Only assets.test.ts changed since the last review. The new tests set up their state correctly and check the behaviour they name. The earlier note about the cf deploy . project-root exemption stays resolved: the test confirms .cloudflare is excluded from the manifest and from the written assets.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

The documentation still matches the code.


Reviewed commit: db02872e

Base automatically changed from james/preview-name-flag to main November 5, 2026 19:16
@jamesopstad
jamesopstad force-pushed the james/deploy-assets-directory branch from db02872 to bca4927 Compare November 5, 2026 19:16
@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@jamesopstad Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved — No findings. Since the last approved review, only tests were added, and they cover the new assets-only directory deployment path.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present.


🔒 Security: ✅ LGTM

The only change since the last review is a test file. It raises no security concerns.


📖 AGENTS.md: ✅ LGTM

No issues found.


📋 Code Quality: ✅ LGTM

Only assets.test.ts changed since the last review. The new tests set up their state correctly and check the behaviour they name. The earlier note about the cf deploy . project-root exemption stays resolved: the test confirms .cloudflare is excluded from the manifest and from the written assets.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

The documentation still matches the code.


Reviewed commit: bca49278 — same changes as db02872e, so this is that commit's review (no new review was run; line numbers are as of db02872e)

@ask-bonk

ask-bonk Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@jamesopstad
jamesopstad added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit d354737 Nov 5, 2026
12 checks passed
@jamesopstad
jamesopstad deleted the james/deploy-assets-directory branch November 5, 2026 19:31
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.

2 participants