Skip to content

fix: Remove reserved safe?: false from ArkEnvConfig - #1924

Merged
yamcodes merged 4 commits into
v1from
cursor/remove-safe-false-1c33
Sep 21, 2026
Merged

yamcodes merged 4 commits into
v1from
cursor/remove-safe-false-1c33

Conversation

@yamcodes

@yamcodes yamcodes commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1912

Removes the phantom safe?: false field from public ArkEnvConfig / StandardEnvConfig (and ParseStandardConfig). Safe mode stays available only via @arkenv/core/safe and @arkenv/standard/safe.

Changes

  • Delete safe?: false from core, standard, and internal parse config types
  • Simplify dependent Omit<…, "safe"> aliases on /safe entries and Vite/Bun/Rsbuild plugin configs
  • Drop reserved-safe docs from the options reference; relocate the framework-plugin callout to error-reporting
  • Add type-regression tests that reject { safe: false } / { safe: true } on both config types
  • Major changeset for @arkenv/core and @arkenv/standard with migration notes

Validation

  • nub run typecheck --filter=./packages/* — pass
  • @arkenv/core + @arkenv/standard unit tests — pass
  • vitest --typecheck.only for the new type regressions — pass
  • nub run check — pass
Open in Web Open in Cursor 

Drop the phantom safe option from public config types so /safe
subpaths are the only safe-mode entry points. Fixes #1912.

Co-authored-by: Yam Borodetsky <[email protected]>
@changeset-bot

changeset-bot Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f087fda

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

This PR includes changesets to release 2 packages
Name Type
@arkenv/core Major
@arkenv/standard Major

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

@yamcodes yamcodes added @arkenv/standard Issues or Pull Requests involving @arkenv/standard arkenv Changes to the `arkenv` npm package. docs Adds or changes documentation, or acts as documentation in and of itself enhancement New feature or improvement labels Sep 21, 2026 — with Cursor
@github-actions github-actions Bot added @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv www Improvements or additions to arkenv.js.org @arkenv/bun-plugin Issues or Pull Requests involving the Bun plugin for ArkEnv @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv and removed arkenv Changes to the `arkenv` npm package. labels Sep 21, 2026
@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

@arkenv/agent-plugin

npm i https://pkg.pr.new/@arkenv/agent-plugin@1924

arkenv

npm i https://pkg.pr.new/arkenv@1924

@arkenv/build

npm i https://pkg.pr.new/@arkenv/build@1924

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1924

@arkenv/core

npm i https://pkg.pr.new/@arkenv/core@1924

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1924

@arkenv/nextjs

npm i https://pkg.pr.new/@arkenv/nextjs@1924

@arkenv/nuxt

npm i https://pkg.pr.new/@arkenv/nuxt@1924

@arkenv/rsbuild-plugin

npm i https://pkg.pr.new/@arkenv/rsbuild-plugin@1924

@arkenv/standard

npm i https://pkg.pr.new/@arkenv/standard@1924

@arkenv/tanstack-addon

npm i https://pkg.pr.new/@arkenv/tanstack-addon@1924

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1924

commit: f087fda

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one doc redundancy worth a look.

Reviewed changes

  • Public config types: ArkEnvConfig (core) and ParseStandardConfig (@repo/utils) lose the reserved safe?: false; StandardEnvConfig becomes a direct alias of ParseStandardConfig (was Omit<…, "safe"> & { safe?: false }).
  • Internal aliases: SafeArkenvConfig / SafeStandardEnvConfig collapse to the plain config, and the Vite/Bun/Rsbuild factory configs drop their Omit<ArkEnvConfig, "safe">; Nuxt's resolve-core-arkenv drops safe?: false.
  • Docs: safe is removed from the options reference and the intro field lists, plugin reference tables lose the "except safe" clause, and the framework-plugin callout moves from options.mdx into error-reporting.mdx.
  • Tests: @ts-expect-error type-regression tests reject { safe: false } and { safe: true } on both config types.
  • Changeset: major for @arkenv/core and @arkenv/standard with migration notes.

Verification I ran while reviewing: no runtime code reads config.safe; both config types lack an index signature, so the @ts-expect-error tests genuinely fail if safe returns (and tsc covers *.test-d.ts via include: ["src"]); @repo/utils is in alwaysBundle, so the direct StandardEnvConfig alias does not leak a private import into the published .d.ts; and the plugin packages expose no /safe subpath, so the moved callout's claim holds.

ℹ️ Nitpicks

  • The changeset migration block re-imports arkenv under the same name from @arkenv/core/safe within the same snippet and deletes a // (was never supported…) comment line; two clearly labelled before/after snippets would read cleaner.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Use expectTypeOf.not.toHaveProperty for safe regressions, restore
/safe pointer on StandardEnvConfig JSDoc, and tighten the changeset.

Co-authored-by: Yam Borodetsky <[email protected]>
@cursor

cursor Bot commented Sep 21, 2026

Copy link
Copy Markdown

Folded the useful bits from duplicate #1923 into this PR:

  • expectTypeOf().not.toHaveProperty("safe") type regressions
  • /safe pointer restored on StandardEnvConfig JSDoc
  • Clearer changeset prose + positive /safe example
  • Dropped the obsolete “migrating off { safe: true }” wording in recordIfCapturing JSDoc

Kept this PR’s extras that #1923 lacked (error-reporting callout relocation; changeset at .changeset/ root rather than pre/). #1923 is closed.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — the new regression guard is sound; one small consistency nitpick inline.

Reviewed changes

  • Rewrote the changeset copy: distinct-name arkenv / arkenvSafe example, a separate before/after diff block, and a tightened BREAKING CHANGE note (replaces the same-name re-import the prior review flagged).
  • Swapped the @ts-expect-error type-regression tests for expectTypeOf<…>().not.toHaveProperty("safe") in @arkenv/core and @arkenv/standard.
  • Updated JSDoc in packages/core/src/arkenv.ts and packages/standard/src/index.ts to drop stale { safe: true } migration wording.

I checked that the new guard can actually fail: .not.toHaveProperty resolves to MismatchArgs<Extends<"safe", keyof T>, false>, which demands a second argument (TS2554) as soon as safe is a key. Confirmed against a scratch type { safe?: false } (errored) vs { PORT?: string } (clean). Both *.test-d.ts files sit under src, so tsc --noEmit covers them, and turbo.json typecheck dependsOn ^build so ParseStandardConfig resolves in CI.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Consolidate the duplicate safe-mode callout/paragraph (include Rsbuild)
and move the core type guard into its own Issue #1912 describe block.

Co-authored-by: Yam Borodetsky <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Consolidated the error-reporting.mdx framework-plugin note into a single <Callout>, adding Rsbuild to the list and dropping the paragraph that restated it — resolves the prior redundancy thread.
  • Moved the core ArkEnvConfig safe guard into its own describe("Type Regression (Issue #1912)") block, matching the @arkenv/standard counterpart — resolves the prior consistency nitpick.

Both prior pullfrog threads are addressed and resolved. I re-verified that @arkenv/rsbuild-plugin exposes only . and ./standard (no /safe subpath), so the expanded callout's plugin list and claim hold. No source or type behavior changed in this delta.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@yamcodes
yamcodes merged commit d807f77 into v1 Sep 21, 2026
19 checks passed
@yamcodes
yamcodes deleted the cursor/remove-safe-false-1c33 branch September 21, 2026 09:45
@arkenv-bot arkenv-bot Bot mentioned this pull request Sep 21, 2026
renovate Bot added a commit that referenced this pull request Oct 9, 2026
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@arkenv/core](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1`
→
`1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fcore/1.0.0-rc.1/1.0.0-rc.4)
|
![age](https://developer.mend.io/api/mc/badges/age/npm/@arkenv%2fcore/1.0.0-rc.4?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@arkenv%2fcore/1.0.0-rc.1/1.0.0-rc.4?slim=true)
|
| [@arkenv/nextjs](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1`
→
`1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fnextjs/1.0.0-rc.1/1.0.0-rc.4)
|
![age](https://developer.mend.io/api/mc/badges/age/npm/@arkenv%2fnextjs/1.0.0-rc.4?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@arkenv%2fnextjs/1.0.0-rc.1/1.0.0-rc.4?slim=true)
|
| [@arkenv/standard](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1`
→
`1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fstandard/1.0.0-rc.1/1.0.0-rc.4)
|
![age](https://developer.mend.io/api/mc/badges/age/npm/@arkenv%2fstandard/1.0.0-rc.4?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@arkenv%2fstandard/1.0.0-rc.1/1.0.0-rc.4?slim=true)
|
| [@arkenv/vite-plugin](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1`
→
`1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fvite-plugin/1.0.0-rc.1/1.0.0-rc.4)
|
![age](https://developer.mend.io/api/mc/badges/age/npm/@arkenv%2fvite-plugin/1.0.0-rc.4?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@arkenv%2fvite-plugin/1.0.0-rc.1/1.0.0-rc.4?slim=true)
|

---

### Release Notes

<details>
<summary>yamcodes/arkenv (@&#8203;arkenv/core)</summary>

###
[`v1.0.0-rc.4`](https://redirect.github.com/yamcodes/arkenv/releases/tag/%40arkenv/core%401.0.0-rc.4)

[Compare
Source](https://redirect.github.com/yamcodes/arkenv/compare/@arkenv/[email protected]...@arkenv/[email protected])

No changes in this release.

###
[`v1.0.0-rc.3`](https://redirect.github.com/yamcodes/arkenv/releases/tag/%40arkenv/core%401.0.0-rc.3)

[Compare
Source](https://redirect.github.com/yamcodes/arkenv/compare/@arkenv/[email protected]...@arkenv/[email protected])

##### Patch Changes

- #### Restore keyword suggestions inside inline schemas
*[`#1975`](https://redirect.github.com/yamcodes/arkenv/pull/1975)
[`089ef43`](https://redirect.github.com/yamcodes/arkenv/commit/089ef436d3e007fa636e3948734d3911b1065758)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

A partial keyword in an inline schema string suggests ArkType keywords
again. `arkenv({ PORT: "n" })` offers `never`, `null`, and `number`. The
same suggestions are back on `arkenv` from `@arkenv/core/safe`.

  ```ts
  import arkenv from "@arkenv/core";

  export const env = arkenv({
    PORT: "number.port = 3000",
  });
  ```

###
[`v1.0.0-rc.2`](https://redirect.github.com/yamcodes/arkenv/releases/tag/%40arkenv/core%401.0.0-rc.2)

[Compare
Source](https://redirect.github.com/yamcodes/arkenv/compare/@arkenv/[email protected]...@arkenv/[email protected])

##### Major Changes

- #### Remove reserved `safe` from main-factory config
*[`#1924`](https://redirect.github.com/yamcodes/arkenv/pull/1924)
[`ed09bb0`](https://redirect.github.com/yamcodes/arkenv/commit/ed09bb05c27b5409a49430c0f2897b28fe26484d)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

  `ArkEnvConfig` and `StandardEnvConfig` no longer declare the reserved
  `safe?: false` field. Safe-mode parsing stays on the `/safe` subpaths.

  ```ts
  import arkenv from "@arkenv/core";
  import arkenvSafe from "@arkenv/core/safe";

  export const env = arkenv({
    PORT: "number.port = 3000",
  });

  const result = arkenvSafe(
    { PORT: "number.port" },
    { env: { PORT: "invalid" } },
  );
  ```

  `@arkenv/standard` mirrors the same shape via `@arkenv/standard/safe`.

**BREAKING CHANGE**: Passing `safe: false` on the main `arkenv()` config
is no longer accepted. Delete the property; use `/safe` for
result-object
  parsing.

  ```diff
  - export const env = arkenv(schema, { safe: false });
  + export const env = arkenv(schema);
  ```

##### Patch Changes

- #### Avoid Node-only `process` APIs in color detection
*[`#1939`](https://redirect.github.com/yamcodes/arkenv/pull/1939)
[`7684644`](https://redirect.github.com/yamcodes/arkenv/commit/76846449b8a634e24b59a6126958b2826cf975ef)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

ANSI color helpers no longer read `process.versions` or `process.stdout`
as static member expressions, so Next.js edge instrumentation no longer
flags `@arkenv/core` when `env` is imported from edge files.
- #### Point StackBlitz README link at the v1 example
*[`#1905`](https://redirect.github.com/yamcodes/arkenv/pull/1905)
[`f71bee1`](https://redirect.github.com/yamcodes/arkenv/commit/f71bee184ed2f2abfbc69a514a551310d14b3ca5)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

The core package README StackBlitz badge now opens
`tree/v1/examples/stackblitz`, matching the v1 `@arkenv/core` playground
instead of the stale `main` path.
- #### Sync the package README with the repo README
*[`#1949`](https://redirect.github.com/yamcodes/arkenv/pull/1949)
[`2fd0f33`](https://redirect.github.com/yamcodes/arkenv/commit/2fd0f335835f3c0918da7b547b6a43fed3dfa3d7)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

The published `@arkenv/core` README now matches the root project README
(v1 imports, validator examples, RC callout). The outdated demo GIF that
  showed a v0-shaped `import` is gone.

</details>

---

### Configuration

📅 **Schedule**: (in timezone Asia/Almaty)

- Branch creation
  - "on friday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/yamcodes/arkenv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEzNC4xIiwidGFyZ2V0QnJhbmNoIjoidjEiLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/bun-plugin Issues or Pull Requests involving the Bun plugin for ArkEnv @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv @arkenv/standard Issues or Pull Requests involving @arkenv/standard @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv docs Adds or changes documentation, or acts as documentation in and of itself enhancement New feature or improvement www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove reserved safe?: false from ArkEnvConfig

2 participants