Skip to content

fix(config): validate numeric env vars at boot and fail fast (#610) - #623

Open
urielit1313-creator wants to merge 1 commit into
MergeFi:mainfrom
urielit1313-creator:fix/validate-numeric-env-610
Open

urielit1313-creator wants to merge 1 commit into
MergeFi:mainfrom
urielit1313-creator:fix/validate-numeric-env-610

Conversation

@urielit1313-creator

Copy link
Copy Markdown

Resolves #610.

Summary of Changes

  • Introduced parsePositiveIntegerEnv(value, defaultValue, varName) in src/config/configuration.ts to strictly validate positive integers for:
    • PORT (default 3000)
    • ANALYTICS_PLATFORM_SUMMARY_TTL_MS (default 60000)
    • ESCROW_DEADLINE_SECONDS (default 7776000)
  • Fails fast at initialization time with a descriptive error when an alphanumeric typo (e.g. 90d), negative value, zero, or decimal is configured, preventing downstream RangeError: cannot convert NaN to BigInt runtime crashes during escrow funding.
  • Updated collectConfigIssues in src/config/validate-required-config.ts to explicitly ensure escrowDeadlineSeconds is a positive integer when booting in production.
  • Added comprehensive unit test suite in src/config/numeric-config.spec.ts covering parsing, edge cases, boot failure scenarios, and production config assertion.

Verification

  • npm test src/config/numeric-config.spec.ts: 9/9 tests passing (100% pass).
  • npx eslint src/config/configuration.ts src/config/validate-required-config.ts src/config/numeric-config.spec.ts: 0 errors, 0 warnings.

Payout address (Base USDC):
0xfE777c43e4B0A24fFA1527eD520d1E7f9ECED483

@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

@urielit1313-creator is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@urielit1313-creator
urielit1313-creator force-pushed the fix/validate-numeric-env-610 branch from 2d77b80 to d020d8c Compare October 20, 2026 11:51

This branch has not been deployed

No deployments
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.

ESCROW_DEADLINE_SECONDS and PORT are parsed without validation — a typo makes every fund throw RangeError

1 participant