Skip to content

feat(bundler): disable Bun env autoloading in compiled binaries#168

Merged
zrosenbauer merged 4 commits intomainfrom
feat/disable-bun-env-autoloading
Apr 15, 2026
Merged

feat(bundler): disable Bun env autoloading in compiled binaries#168
zrosenbauer merged 4 commits intomainfrom
feat/disable-bun-env-autoloading

Conversation

@zrosenbauer
Copy link
Copy Markdown
Member

Summary

  • Always disables bunfig.toml autoloading in compiled binaries (--no-compile-autoload-bunfig)
  • Disables .env autoloading by default (--no-compile-autoload-dotenv), opt-in via autoloadDotenv: true in compile config
  • Prevents Bun from leaking .env vars into process.env before kidd's auth dotenv strategy runs

Test plan

  • pnpm typecheck passes
  • pnpm lint passes (no new warnings)
  • pnpm format passes
  • pnpm test passes — 3 new compile tests, 2 new resolve-config tests, 1 new schema test

…ed binaries

Bun automatically loads .env and bunfig.toml when running compiled
binaries, which conflicts with kidd's explicit auth dotenv strategy.

- Always pass --no-compile-autoload-bunfig (not configurable)
- Pass --no-compile-autoload-dotenv by default, opt-in via
  autoloadDotenv: true in kidd.config.ts compile options

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
oss-kidd Ignored Ignored Preview Apr 15, 2026 9:19pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 4e72791

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

This PR includes changesets to release 4 packages
Name Type
@kidd-cli/config Minor
@kidd-cli/bundler Minor
@kidd-cli/cli Patch
@kidd-cli/core Patch

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

Splits the autoloadDotenv test into two: one for when the option is
not configured (defaults to false) and one for when it is explicitly
set to false.

Co-Authored-By: Claude <noreply@anthropic.com>
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 15, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing feat/disable-bun-env-autoloading (4e72791) with main (6f1cccd)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Remove standalone Zod acceptance test — the field is already covered
by the fully-populated config test case.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6f1ea95d-9141-4519-a400-7ff133deb9b8

📥 Commits

Reviewing files that changed from the base of the PR and between a2ee9d8 and 4e72791.

📒 Files selected for processing (1)
  • packages/config/src/types.ts

📝 Walkthrough

Walkthrough

Adds a new compile option autoloadDotenv (optional in public config, required in resolved types) and threads it through config resolution into the bundler compile flow. resolveConfig defaults it to false; ResolvedCompileOptions includes it; compile() now accepts and forwards it to compileTargetsSequentially()/compileSingleTarget(). A helper computes Bun CLI flags and conditionally emits --no-compile-autoload-dotenv when autoloadDotenv is false. Tests and schema were updated to cover the new option. A non-functional reformat of a watch() call was made.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: disabling Bun environment variable autoloading in compiled binaries, which is the primary objective of this PR.
Description check ✅ Passed The description clearly relates to the changeset, detailing the implementation approach (always disabling bunfig.toml, conditionally disabling .env autoloading) and the reasoning (preventing env leakage before kidd's auth strategy runs).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/disable-bun-env-autoloading

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/config/src/types.ts`:
- Line 70: Mark the public interface property autoloadDotenv as readonly to
conform to the repository TypeScript standard; update the declaration of the
autoloadDotenv property in the public interface (the autoloadDotenv property in
packages/config/src/types.ts) to be readonly so the type becomes readonly
autoloadDotenv?: boolean, ensuring all public properties are immutable per the
coding-style guidance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 325cfdf7-967f-470d-bf97-b20bc5ac6e6a

📥 Commits

Reviewing files that changed from the base of the PR and between 6f1cccd and 946d29b.

⛔ Files ignored due to path filters (1)
  • .changeset/disable-bun-env-autoloading.md is excluded by !.changeset/**
📒 Files selected for processing (9)
  • packages/bundler/src/bundler.ts
  • packages/bundler/src/compile/compile.test.ts
  • packages/bundler/src/compile/compile.ts
  • packages/bundler/src/types.ts
  • packages/bundler/src/utils/resolve-config.test.ts
  • packages/bundler/src/utils/resolve-config.ts
  • packages/config/src/types.ts
  • packages/config/src/utils/schema.test.ts
  • packages/config/src/utils/schema.ts

Comment thread packages/config/src/types.ts Outdated
Co-Authored-By: Claude <noreply@anthropic.com>
@zrosenbauer zrosenbauer merged commit 55071fa into main Apr 15, 2026
12 checks passed
@zrosenbauer zrosenbauer deleted the feat/disable-bun-env-autoloading branch April 15, 2026 21:26
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