You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Project-root discovery: 'apm install' from a subdirectory uses the nearest apm.yml #4545
status/acceptedHuman scope approval; verify the issue's approval record and review contact before work.type/featureNew capability, new flag, new primitive.
Proposals are welcome before implementation. For substantive changes, wait
for a responsible human maintainer to approve the scope and identify a review
contact. An automated recommendation, label alone, or silence is not approval.
See Contributing.
Is your feature request related to a problem? Please describe. apm install run from a subdirectory of a project fails with "No apm.yml found" instead of using the project root's apm.yml. #888 added --root <dir> as the explicit way to target another directory, but the command does not discover the project root on its own. tests/integration/test_target_resolution_e2e.py::test_s16b_provenance_uses_project_root expects an install from <project>/subdir to succeed and to report target provenance from the project root (CLAUDE.md), so it stays an xfail.
Describe the solution you'd like
When the working directory has no apm.yml, project-scope commands find the nearest ancestor apm.yml (bounded, for example by the git root) and anchor install, provenance and deploy paths to that directory. Done when:
an install from a subdirectory deploys and records state exactly as an install from the root would;
provenance names the project-root signal;
--root keeps precedence;
S16b passes without its xfail marker.
Describe alternatives you've considered
Require --root (or cd to the root) and make S16b assert the current error and its next step.
Additional context
Follow-up to #888 (closed, --root).
Decision: approve
Area: project
Scope: Project-scope apm install (including --dry-run and positional packages) discovers the project root with the existing owner _find_apm_yml (commands/_helpers.py), the same walk apm lock and apm update use. When the working directory has no apm.yml and an ancestor does, install anchors sources, deploy paths, apm_modules/, apm.lock.yaml and target provenance to that root, restores the working directory on exit, and prints the same "Using apm.yml at ... (project root: ...)" line. --root keeps its current meaning and precedence. -g is unaffected. With no ancestor apm.yml, behavior is unchanged: the bare form errors and a positional package bootstraps.
Done when: S16b passes without its strict xfail marker. A new installed-CLI test (APM_BINARY_PATH) runs apm install from <project>/subdir and fails on main. It passes with the change and produces the same lockfile, deployed files and provenance (CLAUDE.md) as an install from the root, with nothing written under subdir/. Controls: --root DIR from a subdirectory keeps today's sources and writes; a cwd with its own apm.yml inside a parent project uses the nearest one; no ancestor apm.yml keeps the current error and the bootstrap; apm install --dry-run from the subdirectory previews the root project; -g ignores the walk. Docs: reference/cli/install.md (working directory and --root) and the install-packages consumer page, by topic. One CHANGELOG line (Changed).
Out of scope: root discovery for other commands (compile, prune, uninstall, audit, deps, which stay cwd-based; a follow-up); bounding the walk at the git root for any command; changing --root semantics; #4544.
Review contact: Daniel Meppiel (@danielmeppiel)
Decision: approve
Area: project
Scope: Project-scope apm install (including --dry-run and positional packages) discovers the project root with the existing owner _find_apm_yml (commands/_helpers.py), the same walk apm lock and apm update use. When the working directory has no apm.yml and an ancestor does, install anchors sources, deploy paths, apm_modules/, apm.lock.yaml and target provenance to that root, restores the working directory on exit, and prints the same "Using apm.yml at ... (project root: ...)" line before project writes. Dependency adds update the root apm.yml; local bundles keep their current contract. Relative CLI paths resolve from the invoking directory; relative dependency paths are recorded against the project root. --root keeps its current meaning and precedence (no walk). -g is unaffected. With no ancestor apm.yml, behavior is unchanged: the bare form errors and a positional package bootstraps.
Done when: S16b passes without its strict xfail marker. Installed-CLI tests (APM_BINARY_PATH) run from <project>/subdir and fail on main: (1) bare apm install produces the same lockfile, deployed files and provenance (CLAUDE.md) as an install from the root; (2) apm install <package> adds the package to the root apm.yml and lockfile and prints the notice; (3) apm install ./pkg with pkg under subdir/ records ./subdir/pkg in the root apm.yml and installs it. All three leave subdir/ unchanged from setup. Controls: --root DIR from a subdirectory keeps today's sources and writes, and apm install --root . <package> still bootstraps in the subdirectory; a cwd with its own apm.yml inside a parent project uses the nearest one; no ancestor apm.yml keeps the current error and the bootstrap; apm install --dry-run from the subdirectory previews the root project; -g ignores the walk. Docs: reference/cli/install.md (working directory and --root) and the install-packages consumer page, by topic. One CHANGELOG line (Changed) saying that an add from a subdirectory edits the ancestor apm.yml.
Out of scope: root discovery for other commands (compile, prune, uninstall, audit, deps, which stay cwd-based; a follow-up); bounding the walk at the git root for any command; changing --root semantics; #4544.
Review contact: Daniel Meppiel (@danielmeppiel)
The record above supersedes the earlier apm-scope:v1 record on this issue from today (2026-11-21). It was amended after a precedent review: the walk-up to the nearest apm.yml stands; relative CLI paths resolve from the directory where the command was run and are recorded relative to the project root; local bundles keep their contract; bounding the walk at the git root and root discovery for other commands stay out of scope. Community PR #4576 is the preferred implementation.
Reopening again: #4576 (which implemented this) is being partially reverted by #5456 for 0.39 because subdirectory discovery could adopt a stray ~/apm.yml and write user-scope files (#5448). The discovery feature re-lands in 0.40 with a HOME/ancestor ceiling; this issue tracks that. Please don't close it until the re-land merges.
status/acceptedHuman scope approval; verify the issue's approval record and review contact before work.type/featureNew capability, new flag, new primitive.
Activity
danielmeppiel commentedon Nov 21, 2026
Decision: approve
Area: project
Scope: Project-scope
apm install(including--dry-runand positional packages) discovers the project root with the existing owner_find_apm_yml(commands/_helpers.py), the same walkapm lockandapm updateuse. When the working directory has noapm.ymland an ancestor does, install anchors sources, deploy paths,apm_modules/,apm.lock.yamland target provenance to that root, restores the working directory on exit, and prints the same "Using apm.yml at ... (project root: ...)" line.--rootkeeps its current meaning and precedence.-gis unaffected. With no ancestorapm.yml, behavior is unchanged: the bare form errors and a positional package bootstraps.Done when: S16b passes without its strict xfail marker. A new installed-CLI test (APM_BINARY_PATH) runs
apm installfrom<project>/subdirand fails on main. It passes with the change and produces the same lockfile, deployed files and provenance (CLAUDE.md) as an install from the root, with nothing written undersubdir/. Controls:--root DIRfrom a subdirectory keeps today's sources and writes; a cwd with its ownapm.ymlinside a parent project uses the nearest one; no ancestorapm.ymlkeeps the current error and the bootstrap;apm install --dry-runfrom the subdirectory previews the root project;-gignores the walk. Docs: reference/cli/install.md (working directory and--root) and the install-packages consumer page, by topic. One CHANGELOG line (Changed).Out of scope: root discovery for other commands (compile, prune, uninstall, audit, deps, which stay cwd-based; a follow-up); bounding the walk at the git root for any command; changing
--rootsemantics; #4544.Review contact: Daniel Meppiel (@danielmeppiel)
danielmeppiel commentedon Nov 21, 2026
Decision: approve
Area: project
Scope: Project-scope
apm install(including--dry-runand positional packages) discovers the project root with the existing owner_find_apm_yml(commands/_helpers.py), the same walkapm lockandapm updateuse. When the working directory has noapm.ymland an ancestor does, install anchors sources, deploy paths,apm_modules/,apm.lock.yamland target provenance to that root, restores the working directory on exit, and prints the same "Using apm.yml at ... (project root: ...)" line before project writes. Dependency adds update the rootapm.yml; local bundles keep their current contract. Relative CLI paths resolve from the invoking directory; relative dependency paths are recorded against the project root.--rootkeeps its current meaning and precedence (no walk).-gis unaffected. With no ancestorapm.yml, behavior is unchanged: the bare form errors and a positional package bootstraps.Done when: S16b passes without its strict xfail marker. Installed-CLI tests (APM_BINARY_PATH) run from
<project>/subdirand fail on main: (1) bareapm installproduces the same lockfile, deployed files and provenance (CLAUDE.md) as an install from the root; (2)apm install <package>adds the package to the rootapm.ymland lockfile and prints the notice; (3)apm install ./pkgwithpkgundersubdir/records./subdir/pkgin the rootapm.ymland installs it. All three leavesubdir/unchanged from setup. Controls:--root DIRfrom a subdirectory keeps today's sources and writes, andapm install --root . <package>still bootstraps in the subdirectory; a cwd with its ownapm.ymlinside a parent project uses the nearest one; no ancestorapm.ymlkeeps the current error and the bootstrap;apm install --dry-runfrom the subdirectory previews the root project;-gignores the walk. Docs: reference/cli/install.md (working directory and--root) and the install-packages consumer page, by topic. One CHANGELOG line (Changed) saying that an add from a subdirectory edits the ancestorapm.yml.Out of scope: root discovery for other commands (compile, prune, uninstall, audit, deps, which stay cwd-based; a follow-up); bounding the walk at the git root for any command; changing
--rootsemantics; #4544.Review contact: Daniel Meppiel (@danielmeppiel)
danielmeppiel commentedon Nov 21, 2026
The record above supersedes the earlier apm-scope:v1 record on this issue from today (2026-11-21). It was amended after a precedent review: the walk-up to the nearest apm.yml stands; relative CLI paths resolve from the directory where the command was run and are recorded relative to the project root; local bundles keep their contract; bounding the walk at the git root and root discovery for other commands stay out of scope. Community PR #4576 is the preferred implementation.
danielmeppiel commentedon Nov 21, 2026
Moved from 0.38.0 to 0.38.1 in the 0.38 release cut (2026-11-21). Scope and acceptance are unchanged.
danielmeppiel commentedon Nov 21, 2026
Moved to 0.38.0: maintainer direction is that found bugs and in-flight accepted work ship in 0.38.
feat(install): discover project root from subdirectory using nearest …
28 remaining items
danielmeppiel commentedon Nov 25, 2026
Reopening again: #4576 (which implemented this) is being partially reverted by #5456 for 0.39 because subdirectory discovery could adopt a stray ~/apm.yml and write user-scope files (#5448). The discovery feature re-lands in 0.40 with a HOME/ancestor ceiling; this issue tracks that. Please don't close it until the re-land merges.
test(quality): record #4545 as open again in the known-cell snapshot
Revert microsoft#4576: project root discovery from a subdirectory (mi…
feat(install): discover project root from a subdirectory, never above…
fix(install): one HOME ceiling and scope guard shared by install, upd…
test: HOME project upgrade cell; credit #4576 in changelog (#4545)
test: observe an outcome in the sibling-prefix HOME cell (#4545)
perf(install): remember each HOME-level verdict once per process (#4545)
perf(install): identity-stat only HOME, match its ancestors by spelli…
perf(install): budget the one-time HOME identity stats; restore full-…
test: pin HOME identity stats constant per walk depth; co-sign budget…
chore(install): restore the F5/C1 comments in install.py (#4545)