Skip to content

test(pkg): validate-lockdir on a self-referencing constraint - #15617

Merged
Alizter merged 1 commit into
ocaml:mainfrom
Alizter:push-svyovxtrqrwy
Jul 29, 2026
Merged

Alizter merged 1 commit into
ocaml:mainfrom
Alizter:push-svyovxtrqrwy

Conversation

@Alizter

@Alizter Alizter commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Description

Add a regression test showing that dune pkg validate-lockdir accepts an invalid lockdir when a local package dependency constraint refers to the package own version with :version.

The solver evaluates local dependency formulas with the package name and version bound as self variables. Validation currently evaluates the same formula without those bindings, so the guarded version constraint is silently dropped.

Related Issue and Motivation

This is the first change in the fix series and captures the current behavior before the validation fix.

Checklist

  • Tests added, if applicable.
  • Change log entry not applicable; this is a test-only change.
  • Documentation not applicable; this is a test-only change.

The solver evaluates local dependency formulas with the package's own
name and version bound as self variables, so a constraint like
(= :version) resolves against the depending package. Validation
evaluates the same formula without the self bindings: the version
constraint silently drops instead of binding, and a lockdir whose
locked dependency violates the constraint is accepted.

Signed-off-by: Ali Caglayan <[email protected]>
@Alizter
Alizter force-pushed the push-svyovxtrqrwy branch from b84ba04 to 1d1f1e8 Compare July 29, 2026 12:02
@Alizter

Alizter commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

Just tweaked the sed line because of macos

@Alizter
Alizter merged commit 4fd6103 into ocaml:main Jul 29, 2026
37 of 38 checks passed
@Alizter
Alizter deleted the push-svyovxtrqrwy branch July 29, 2026 12:33
@Alizter Alizter added this to the 3.25.0 milestone Jul 30, 2026
Alizter added a commit that referenced this pull request Jul 31, 2026
…15618)

## Description

Factor local-package dependency-formula evaluation into
`Lock_pkg.local_package_dependencies` and use it from both the solver
and `Package_universe`.

The shared path binds the local package name and version as self
variables, injects the running Dune version, and removes the Dune
pseudo-package from the concrete dependency list. This keeps validation
aligned with lock solving and fixes both self-referencing version
constraints and direct dependencies on Dune.

## Related Issue and Motivation

Depends on #15617, which adds the self-referencing constraint regression
test. This PR is stacked on that change and remains a draft while the
predecessor is under review.

## Checklist

- [x] Tests added in #15617.
- [ ] [Change log entry
added](../CONTRIBUTING.md#updating-the-changelog) for any user-facing
changes.
- [x] Documentation not applicable; this is an internal consistency fix.
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