(v1) Unify error normalization and formatting#1157
Conversation
|
Run failed. View the logs →
|
🦋 Changeset detectedLatest commit: c0a5415 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Run failed. View the logs →
|
arkenv
@arkenv/bun-plugin
@arkenv/cli
@arkenv/fumadocs-ui
@arkenv/nextjs
@arkenv/vite-plugin
commit: |
📦 Bundle Size Report
✅ All size limits passed! |
There was a problem hiding this comment.
Reviewed changes — First review of this PR. Introduces EnvIssue type normalization across both ArkType and Standard Schema engines, safeCreateEnv non-throwing API, and sensitive-value redaction in error messages.
- Introduce
EnvIssuetype withcode,expected,received,metafields replacing the flatValidationIssuetype incore.ts; deprecate old type as alias. - Add
safeCreateEnvto botharkenvandarkenv/standardreturning aSafeCreateEnvResult<T>discriminated union instead of throwing. - Implement secret redaction via
SENSITIVE_KEYWORDSregex patterns,shouldRedact(),safeStringify(), anddebugSecretsconfig/ARKENV_DEBUG_SECRETSenv var. - Normalize Standard Schema errors in
parse-standard.tsto resolve received values (JSON-parse + traversal), map engine-level codes toEnvIssueCode, and append styled(was …)values. - Map ArkType error codes to
EnvIssueCodeinarkErrorsToIssueswith properexpected/receivedextraction and redaction support. - Update
ArkEnvErrorto storeissuespublicly and acceptdebugSecretsoptions. - Add
formatIssues/formatErrorutilities with deprecatedformatInternalErrorsalias. - Add changeset marking a minor version bump with breaking-change notice for error message format.
- Add/update tests in
errors.test.tsandstandard-mode.test.tsfor redaction,safeCreateEnv, and error normalization.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Reviewed changes — incremental delta since the prior Pullfrog review. The 94f275f commit addresses both review threads: tightened sensitive-keyword regex patterns, added a public exclusion in shouldRedact, and removed the unused _options/options parameters across formatting functions and the ArkEnvError constructor.
- Tightened
SENSITIVE_KEYWORDSregex patterns — broad patterns like/key/i,/pass/i,/auth/iare now anchored to(_|^)...(_|$)boundaries to avoid false positives on non-sensitive variable names (COMPASS, AUTHOR, etc.). - Added
publicexclusion inshouldRedact— paths containingpublic(e.g.PUBLIC_KEY) are no longer redacted, even when they match a sensitive keyword pattern. - Removed unused
_optionsparameter fromformatIssues,formatError, and the deprecatedformatInternalErrors— the parameter was never wired through since redaction happens at issue-creation time. - Removed unused
optionsparameter from theArkEnvErrorconstructor, along with a duplicateformatIssuescall in the constructor body. - Cleaned up
parse-standard.tserror construction — theconfigpassthrough toArkEnvError(which was ignored) has been removed.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…timizing standard error mapping
There was a problem hiding this comment.
Reviewed changes — incremental delta since the prior Pullfrog review. The 083837c commit extracts redaction utilities into a shared module and optimizes the Standard Schema error mapping to resolve size-limit failures.
- Extracted
safeStringify/shouldRedact/SENSITIVE_PATTERNtosrc/utils/redact.ts— moved out ofcore.tsandarktype/index.tsinto a shared utility module; consolidated 11 separate regex patterns into a single combined pattern. - Optimized
parse-standard.tserror mapping — extractedgetProphelper for path traversal, deduplicated type-checks viamsgvariable, consolidated meta extraction with??nullish coalescing, and streamlined message-suffix construction. - Bumped size-limit thresholds in
package.jsonto2.3 kB(arkenv) and2.1 kB(arkenv/standard).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Fixes #709
Refactor the error system to use a normalized EnvIssue format, support sensitive credential masking/redaction with programmatic overrides, add a non-throwing safeCreateEnv API for RSC/Next.js integrations, and provide a stable base for CLI/IDE integrations.