Skip to content

A decorator that fails to resolve reports its error twice - #1285

Merged
theoephraim merged 1 commit into
dmno-dev:mainfrom
voiys:fix-duplicate-decorator-errors
Nov 13, 2026
Merged

theoephraim merged 1 commit into
dmno-dev:mainfrom
voiys:fix-duplicate-decorator-errors

Conversation

@voiys

@voiys voiys commented Nov 10, 2026

Copy link
Copy Markdown
Contributor
# @currentEnv=$APP_ENV
# @defaultRequired=false
# ---
# @type=enum(dev, prod)
APP_ENV=
# @required=forEnv(prod)
API_URL=

$ varlock load
main:
  API_URL
   - forEnv(): current environment is not set
   - forEnv(): current environment is not set
here:
  API_URL
   - forEnv(): current environment is not set

cause:

DecoratorInstance.resolve():
  if (isResolved) return value
  try { value = resolver.resolve() }
  catch (err) { errors.push(err); return }      // isResolved stays false

resolveDecorators()  -> dec.resolve()            // records the error
processRequired()    -> dec.resolve()            // runs again, records it again

fix: remember that the attempt failed and return early on the next call.

forEnv() is only the easiest way to trigger it. any decorator value that throws is affected.

test: decorator-error-once.test.ts, fails on main.

@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: Reviewed the decorator failure caching fix and its regression coverage.

  • Failure caching: Failed decorator value resolution retains its original error without rerunning on subsequent calls.
  • Regression coverage: Tests that an unset current environment produces one forEnv() error; includes a varlock patch release entry.

All 1,201 env-graph tests passed, including the new regression.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

DecoratorInstance.resolve() did not remember a failed attempt, so the next
call ran the resolver again and recorded the same error again.
resolveDecorators and processRequired both resolve @required, so an error
from its value showed up twice on the item.
@theoephraim
theoephraim force-pushed the fix-duplicate-decorator-errors branch from 00b950e to 7cb3f6a Compare November 13, 2026 00:47
@pkg-pr-new

pkg-pr-new Bot commented Nov 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

varlock

npm i https://pkg.pr.new/varlock@1285

@varlock/astro-integration

npm i https://pkg.pr.new/@varlock/astro-integration@1285

@varlock/cloudflare-integration

npm i https://pkg.pr.new/@varlock/cloudflare-integration@1285

@varlock/nextjs-integration

npm i https://pkg.pr.new/@varlock/nextjs-integration@1285

@varlock/nuxt-integration

npm i https://pkg.pr.new/@varlock/nuxt-integration@1285

@varlock/vite-integration

npm i https://pkg.pr.new/@varlock/vite-integration@1285

@varlock/1password-plugin

npm i https://pkg.pr.new/@varlock/1password-plugin@1285

@varlock/aws-secrets-plugin

npm i https://pkg.pr.new/@varlock/aws-secrets-plugin@1285

@varlock/azure-key-vault-plugin

npm i https://pkg.pr.new/@varlock/azure-key-vault-plugin@1285

@varlock/bitwarden-plugin

npm i https://pkg.pr.new/@varlock/bitwarden-plugin@1285

@varlock/keepass-plugin

npm i https://pkg.pr.new/@varlock/keepass-plugin@1285

@varlock/pass-plugin

npm i https://pkg.pr.new/@varlock/pass-plugin@1285

@varlock/proton-pass-plugin

npm i https://pkg.pr.new/@varlock/proton-pass-plugin@1285

commit: 7cb3f6a

@theoephraim
theoephraim merged commit d0581f8 into dmno-dev:main Nov 13, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants