Skip to content

findConfigDirs selects enclosing config by filename order instead of distance #2

Description

@grouville

Context

#1 implemented dagger/dagger#13688 and documents that findConfigDirs returns the nearest enclosing project. While reviewing dagger/typescript-sdk#11, a nested mixed-filename layout exposed that parentConfigDir instead accepts the first successful findUp in filename order.

Reproduction

Signed-off failing integration test: grouville@cbefe1a

git clone https://github.com/dagger/polyfill.git
cd polyfill
git fetch https://github.com/grouville/polyfill.git repro/nearest-mixed-config
git cherry-pick cbefe1ac5f72d91c763774b85f7d25c9a4c5a93c
dagger --x-release=v1.0.0-beta.7 check e-2-e:find-config-dirs-nearest-mixed-filename-check --progress=plain

The test constructs:

parent/
├── deno.json
└── child/
    ├── deno.jsonc
    └── nested/  # cwd

with filenames ordered as ["deno.json", "deno.jsonc"].

Expected: [".."], resolving to the nearer parent/child project.

Actual: ["../.."], resolving to parent, because the farther deno.json is checked first.

The lookup should compare all successful findUp results and select the closest ancestor regardless of filename order.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions