Skip to content

fix: document and test dotenv secrets-file expansion - #93

Merged
petebacondarwin merged 12 commits into
mainfrom
codex/expand-secrets-file-dotenv
Oct 26, 2026
Merged

petebacondarwin merged 12 commits into
mainfrom
codex/expand-secrets-file-dotenv

Conversation

@ericclemmons

@ericclemmons ericclemmons commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Explain dotenv --secrets-file expansion in the help and generated metadata for cf deploy and cf workers versions create: process environment precedence, literal-dollar escaping, and the requirement to trust files that can read and upload process values. JSON secrets retain their literal values.

Add integration coverage for both commands, including empty process overrides, references to earlier file values, Windows case matching, uploading only declared keys, and preserving the process environment. The runtime expansion is provided by released @cloudflare/[email protected] and @cloudflare/[email protected], already consumed by cf 1.0.0-beta.23.

Validation with the released dependencies:

  • pnpm install --frozen-lockfile
  • pnpm check
  • pnpm --filter cf test — 2,007 passed
  • pnpm --filter @cloudflare/wrangler-tests test — 658 passed

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026 •

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

commit: dd250eb

Comment thread patches/@[email protected] Resolved
@ask-bonk

ask-bonk Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

🤖 I've done a thorough review of your PR.

Expands dotenv references in --secrets-file via deploy-helpers.

  • Posted 1 inline suggestion comment.

github run

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 276.3 ms 3.5 ms 271.3 ms 282.8 ms
base 273.2 ms 2.4 ms 268.9 ms 277.1 ms

Δ (PR vs base): ↑ +3.1 ms (+1.1%)

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 Sep 29, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@ericclemmons
ericclemmons force-pushed the codex/expand-secrets-file-dotenv branch from cb0d06f to 3f78ae3 Compare October 13, 2026 15:06
@ask-bonk

ask-bonk Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@ask-bonk

ask-bonk Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@petebacondarwin
petebacondarwin requested review from a team and edmundhung and removed request for a team October 23, 2026 13:00
@ask-bonk

ask-bonk Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@petebacondarwin petebacondarwin changed the title fix: Expand dotenv values in secrets files fix: document and test dotenv secrets-file expansion Oct 26, 2026
@ask-bonk

ask-bonk Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

🤖 I've done a thorough review of your PR.

Documents and tests dotenv expansion for secrets files.

  • Posted 1 inline suggestion comment.

github run

@petebacondarwin

Copy link
Copy Markdown
Collaborator

clanker review

Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
@petebacondarwin
petebacondarwin marked this pull request as ready for review October 26, 2026 21:33
@ask-bonk

ask-bonk Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Review: 2 findings.
🤖 I've done a thorough review of your PR.

Documents and tests dotenv expansion for --secrets-file.

  • Posted 2 inline suggestions to synchronize command metadata with runtime help.

github run

@clanky-the-clanker

clanky-the-clanker Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

💬 Approved with comments — The help text, regenerated metadata, changeset and integration tests are consistent. The one WARNING is a convention issue: the two meta.ts sidecars now import a runtime value, which the repository says sidecars must not do. It has no runtime impact, because the regenerated JSON already contains the new text.

Findings: 1 warning

The decision is advisory: this comment 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 #93.

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 `meta.ts` sidecars now import a runtime value (`secretsFileDescription`). This breaks the rule in `hand-written-meta.ts:6` that every sidecar must import nothing but types. There is no runtime impact. Either inline the string with a test that keeps the copies in sync, or change the documented rule.
- **File:** packages/cli/src/commands/deploy/meta.ts:1

📋 Code Quality: ⚠️ 1 warning

The two meta.ts sidecars now import a runtime value, which breaks the repository's rule that sidecars import only types. Everything else is consistent.

Recommendation: 📝 Minor Comments

  • [WARNING] The meta.ts sidecars now import a runtime value (secretsFileDescription). This breaks the rule in hand-written-meta.ts:6 that every sidecar must import nothing but types. There is no runtime impact. Either inline the string with a test that keeps the copies in sync, or change the documented rule. (packages/cli/src/commands/deploy/meta.ts:1)
View full review

Sidecars now import a runtime value (packages/cli/src/commands/deploy/meta.ts:1, packages/cli/src/commands/workers/versions/create/meta.ts:1)

Both sidecars now import { secretsFileDescription } from ".../secrets-file-description.js". That file is new in this pull request. packages/cli/src/commands/hand-written-meta.ts:6 says: "Like the registry, it and every sidecar must import nothing but types." The repository's working rules also say to keep the hand-written registry and its sidecars plain data.

The generator plugin bundles the sidecars, and the regenerated _meta/*.json files contain the new description, so the build and the CLI work today. What breaks is a documented contract, not behaviour.

You can fix it in either of two ways:

  • Put the string literal back in each meta.ts. To stop the copies drifting apart, add a test that checks the sidecar description matches the yargs option description in deploy/shared.ts.
  • Change the rule and the comment in hand-written-meta.ts so sidecars may import plain-data constants.

The new help text matches the behaviour described in the pull request. It covers process-environment precedence, including empty values, the \$ escape, uploading only declared keys, and the warning to trust the secrets file. The integration tests in secrets-file.test.ts cover both commands.


✅ All other checks passed

🚀 Release: ✅ LGTM

Risk: Low. The changeset is present and follows the repository's conventions.


🔒 Security: ✅ LGTM

This pull request changes only description text and adds tests. The new help text warns users to use only trusted dotenv secrets files, because those files can read and upload process environment values.


📖 AGENTS.md: ✅ LGTM

No issues found.


⚡ Performance: ✅ LGTM

The changes are help text and tests, so they have no performance impact.


📝 Documentation: ✅ LGTM

The help text and the generated metadata are consistent across cf deploy and cf workers versions create.


Reviewed commit: dd250eb0

Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
@ask-bonk

ask-bonk Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

Posted 1 inline finding on stale generated metadata.

github run

@ask-bonk

ask-bonk Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

Posted 2 inline suggestions for the metadata sidecar import invariant.

github run

@petebacondarwin
petebacondarwin added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 2e6c118 Oct 26, 2026
15 checks passed
@petebacondarwin
petebacondarwin deleted the codex/expand-secrets-file-dotenv branch October 26, 2026 22:10
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