Repository navigation
fix: select the nearest enclosing config, not the first filename's - #4
Merged
Merged
Conversation
parentConfigDir kept the first non-null findUp across filenames, so a farther ancestor won whenever its config filename was searched first. From parent/child/nested, with parent/deno.json and parent/child/deno.jsonc, the result was ../.. instead of .. Search every filename and keep the deepest hit. All hits lie on the cwd's own ancestor chain, so the deepest one is the nearest project — no path comparison needed. This also fixes the case where the cwd holds a config under a later filename: that hit is now the deepest, equals the cwd, and is dropped, so the result no longer contains both "." and a farther ancestor. Fixes #2 Signed-off-by: Tom Chauveau <[email protected]>
Member
Author
|
CI isn't enabled yet on polyfill, I tested locally and it worked |
grouville
added a commit
to grouville/pytest
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, allowing a farther pytest.ini to shadow a nearer pyproject.toml. Pin the merged dagger/polyfill#4 revision so Pytest discovery consistently uses the nearest enclosing project. Keep the distance logic in the shared discovery implementation instead of duplicating it in this adapter. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/ruff
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, allowing a farther pyproject.toml to shadow a nearer ruff.toml. Pin the merged dagger/polyfill#4 revision so Ruff discovery consistently uses the nearest enclosing project. Keep the distance logic in the shared discovery implementation instead of duplicating it in this adapter. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/python-sdk
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, so mixed dagger.json and dagger-module.toml layouts could resolve to the farther module based on filename order. Pin the merged dagger/polyfill#4 revision for shared module discovery. The explicit mod lookup continues to perform its own nearest-config validation; the shared modules path now has the same behavior without another workaround. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/pytest
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, allowing a farther pytest.ini to shadow a nearer pyproject.toml. Pin the merged dagger/polyfill#4 revision so Pytest discovery consistently uses the nearest enclosing project. Keep the distance logic in the shared discovery implementation instead of duplicating it in this adapter. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/ruff
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, allowing a farther pyproject.toml to shadow a nearer ruff.toml. Pin the merged dagger/polyfill#4 revision so Ruff discovery consistently uses the nearest enclosing project. Keep the distance logic in the shared discovery implementation instead of duplicating it in this adapter. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/python-sdk
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, so mixed dagger.json and dagger-module.toml layouts could resolve to the farther module based on filename order. Pin the merged dagger/polyfill#4 revision for shared module discovery. The explicit mod lookup continues to perform its own nearest-config validation; the shared modules path now has the same behavior without another workaround. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/python-sdk
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, so mixed dagger.json and dagger-module.toml layouts could resolve to the farther module based on filename order. Pin the merged dagger/polyfill#4 revision for shared module discovery. The explicit mod lookup continues to perform its own nearest-config validation; the shared modules path now has the same behavior without another workaround. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to dagger/pytest
that referenced
this pull request
Jul 21, 2026
* feat: make Pytest discovery cwd-aware * chore: pick up nearest-config polyfill fix Polyfill previously selected the first config filename found while walking up, allowing a farther pytest.ini to shadow a nearer pyproject.toml. Pin the merged dagger/polyfill#4 revision so Pytest discovery consistently uses the nearest enclosing project. Keep the distance logic in the shared discovery implementation instead of duplicating it in this adapter. Signed-off-by: Guillaume de Rouville <[email protected]> --------- Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/python-sdk
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, so mixed dagger.json and dagger-module.toml layouts could resolve to the farther module based on filename order. Pin the merged dagger/polyfill#4 revision for shared module discovery. The explicit mod lookup continues to perform its own nearest-config validation; the shared modules path now has the same behavior without another workaround. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
added a commit
to grouville/python-sdk
that referenced
this pull request
Jul 21, 2026
Polyfill previously selected the first config filename found while walking up, so mixed dagger.json and dagger-module.toml layouts could resolve to a farther module based on filename order. Pin the dagger/polyfill#4 fix and cover a managed Python module whose nearby dagger.json is nested below an ancestor dagger-module.toml. Discovery from two levels inside the module must select the nearby module and return "../..". Signed-off-by: Guillaume de Rouville <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2.
Problem
parentConfigDirreduced withacc ?? ws.findUp(name, "."), so the first filename that matched anywhere up the tree won — regardless of how far up it was. With["deno.json", "deno.jsonc"]and:findConfigDirsreturned["../.."](parent) instead of[".."](parent/child).The same order-dependence produced the second symptom from the issue comment: standing exactly at
child, walk-down added.while find-up independently added the farther ancestor, yielding[".", ".."]where the local config should shadow it.Downstream consumers hit this too —
dagger/ruff#1(pyproject.tomlbeforeruff.toml) anddagger/pytest#19(pytest.inibeforepyproject.toml).Fix
Search every filename and keep the deepest hit. Every
findUp(name, ".")result lies on the cwd's own ancestor chain, so the deepest directory is the nearest project — no path comparison, no prefix matching.hitRankis 0 for no hit anddepth + 1otherwise, so a hit at the workspace root still outranks nothing.configDirOfanddepthOfare extracted from whatparentConfigDirandancestorRelPathwere already doing inline.The cwd-shadowing case falls out for free: the cwd's own config is now the deepest hit, so it's the one compared against
cwdand dropped.Tests
New fixture
fixtures/find-config-dirs/nearest/plus two checks:nearestMixedFilenameCheckchild/nested→[".."], and it resolves back tochild'sdeno.jsoncmixedFilenameShadowCheckchild→["."], the ancestor does not come backVerified against
v1.0.0-beta.7. With the fix, all 16 checks pass. Withworkspace.dangreverted and only the tests applied, the two new checks fail with exactly the reported numbers:Fixture-based rather than the
withNewFileform of the repro commit, to match how the file's other checks read after #3 — thanks @grouville for the reproduction.Follow-up
Consumers pinning polyfill need repinning once this lands:
dagger/ruff,dagger/pytest,dagger/python-sdk#9,dagger/typescript-sdk#11.