Skip to content

feat(lockfile): warn and keep packages when an optional field is unknown - #399

Merged
vibgrate-team merged 3 commits into
mainfrom
cursor/lockfile-unknown-optional-69c7
Oct 8, 2026
Merged

vibgrate-team merged 3 commits into
mainfrom
cursor/lockfile-unknown-optional-69c7

Conversation

@vibgrate-team

@vibgrate-team vibgrate-team commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lockfile readers already kept the fields they understand and failed closed on truncated or invalid documents. An unknown optional key stayed in the dependency set with no warning.

vg now keeps that dependency set and prints one stable warning per file per unknown field name, for example:

pnpm-lock.yaml: unknown optional lockfile field "futureOptional"; continuing with the fields this version understands.

When the field name can't be shown safely, the line says (name omitted) instead. Field values, environment variables, and authorization headers are never printed. Formats with no optional field names (a Gradle lock line, a Gemfile spec, a go.sum line) still fail on an invalid line.

A shared helper in src/core-open/utils/lockfile-unknown.ts covers npm, pnpm, yarn, poetry, uv, pdm, Pipfile, Cargo, Composer, NuGet, Swift package pins, and pub, and is wired into src/engine/lockfile.ts and the dependency-graph scanner. New tests in src/engine/lockfile-unknown.test.ts lock in that rows are kept and the warning is emitted once.

Related issues

Closes #270

Checklist

  • pnpm test passes
  • pnpm lint is clean
  • pnpm typecheck is clean
  • Docs updated where behavior changed
  • Determinism preserved
  • No proprietary or internal references
  • Commits use Conventional Commits and are signed off

How to verify

pnpm test
pnpm lint
pnpm typecheck

cursoragent and others added 3 commits October 7, 2026 12:12
An unknown optional key on a lockfile that already resolves packages now
prints one stable warning per file per key and leaves the dependency set
in place. Truncated or invalid lockfiles still fail closed.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Crowers <crowers@users.noreply.github.com>
…wn-optional-69c7

Co-authored-by: Crowers <crowers@users.noreply.github.com>
Unknown optional lockfile fields keep the dependency set. vg prints one
warning per path and field: unknown optional lockfile field "<name>";
continuing with the fields this version understands. A field name that
is not a plain identifier is reported as (name omitted).

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Crowers <crowers@users.noreply.github.com>
@vibgrate-team
vibgrate-team marked this pull request as ready for review October 8, 2026 21:32
@vibgrate-team
vibgrate-team merged commit 3107300 into main Oct 8, 2026
1 check passed
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.

Enhancement: warn and continue when optional lockfile fields are unknown

2 participants