Skip to content

A cycle next to any other schema error ends the load with no explanation - #1286

Merged
theoephraim merged 1 commit into
dmno-dev:mainfrom
voiys:fix-cycle-with-schema-error
Nov 13, 2026
Merged

theoephraim merged 1 commit into
dmno-dev:mainfrom
voiys:fix-cycle-with-schema-error

Conversation

@voiys

@voiys voiys commented Nov 10, 2026

Copy link
Copy Markdown
Contributor
B=$B
C=$Z

$ varlock load
main:
  💥 [varlock] varlock stopped before the command finished 💥

here:
  B   - Item cannot have dependency on itself
  C   - ref(): invalid dependency: Z

each line alone gives its proper error on main. together they give neither.

cause:

finishLoad():
  process every item
  if (any item has an error) return      // C=$Z has one
  mark items that are on a cycle         // never reached, so B is unmarked

resolveEnvValues():
  B waits for B                          // forever

fix: mark cycles before that early return.

context: found by a fuzzer that compares varlock against a small reference implementation of the schema language, part of the same exploration as #469.

test: cycle-with-schema-error.test.ts. on main it never finishes.

@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 cycle detection ordering, error propagation, and the regression test; all 129 focused tests passed.

  • Cycle diagnostics: Marks dependency cycles before returning for other schema errors, preventing resolution from waiting indefinitely.
  • Regression coverage and release note: Tests a self-reference alongside a missing reference and records the fix for a patch release.

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

finishLoad returned before the cycle check when any item had a schema
error. An item on a cycle was then left unmarked, waited on itself when
values were resolved, and the CLI gave up with "varlock stopped before
the command finished" instead of showing either error.
@theoephraim
theoephraim force-pushed the fix-cycle-with-schema-error branch from 183e529 to 0dee8a8 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@1286

@varlock/astro-integration

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

@varlock/cloudflare-integration

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

@varlock/nextjs-integration

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

@varlock/nuxt-integration

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

@varlock/vite-integration

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

@varlock/1password-plugin

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

@varlock/aws-secrets-plugin

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

@varlock/azure-key-vault-plugin

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

@varlock/bitwarden-plugin

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

@varlock/keepass-plugin

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

@varlock/pass-plugin

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

@varlock/proton-pass-plugin

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

commit: 0dee8a8

@theoephraim
theoephraim merged commit 9459800 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