Skip to content

revert: project root discovery from a subdirectory (#4576) - #5456

Merged
Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
p3-5448-revert-4576
Nov 25, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
p3-5448-revert-4576

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fixes #5448. Refs #4576, re-lands in 0.40 via #4545.

This partially reverts #4576 (project-root discovery from a subdirectory) for 0.39. The red team (#5448) found that the upward walk to the nearest apm.yml stops only at the filesystem root. A stray ~/apm.yml was therefore adopted as the project:

  • A project-scope apm install from a new folder under $HOME edited ~/apm.yml.
  • It deployed into ~/.claude (user scope) and wrote ~/apm.lock.yaml.

With the revert, apm install again works on the current directory only, as in v0.38.1.

Issue and approved scope

Issue: Fixes #5448

Human scope-approval comment: regent ruling 08:29 CET (0.39 scope freeze: revert #4576 for cross-scope data loss), relayed by the program lead.

This PR completes #5448. The discovery feature re-lands in 0.40 with a home and ancestor ceiling, tracked in #4545.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • tests/integration/test_home_manifest_discovery_lifecycle.py: all 3 cases fail on main and pass on the revert.

    • apm install ../../src/pkgs/a in ~/work/newproj with a ~/apm.yml present creates ./apm.yml, deploys into ./.claude and leaves ~/apm.yml and ~/.claude untouched.
    • A bare apm install in an empty ~/work/fresh exits 1 with "No apm.yml found" and writes nothing.
    • After apm install -g <pkg>, a project install from a folder under $HOME does not write ~/apm.lock.yaml.
  • test_target_resolution_e2e, the helpers and update units, and the known-cell test: 149 passed, 1 xfailed ([FEATURE] Project-root discovery: 'apm install' from a subdirectory uses the nearest apm.yml #4545's restored cell).

  • ruff, the architecture linter, pylint R0801, scripts/lint-auth-signals.sh, the complexity ratchet, the assertion-quality ratchet, the test taxonomy and the changelog fragment check are clean. The commit carries an apm-spec-waiver line.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Reverts the train merge 993127a of #4576. Subdirectory discovery
adopted a stray ~/apm.yml and wrote into ~/.claude (cross-scope data
loss, RT-5 #5448). This removes the discovery, the CLI package rebase
and the owner and prefix checks, #4576's cells and docs, and its
changelog fragment; later PRs are untouched. #4545 is open again.

Refs #4576

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
RT-5's three cells from #5448, with HOME pointed at a temp home: a
package install in a new folder stays there, a bare install in an empty
folder exits 1 and writes nothing, and a project install after a user
install never writes ~/apm.lock.yaml. Red on main 8225ec6 (run
locally), green with the revert.

apm-spec-waiver: reverts #4576's install discovery and restores the v0.38.1 install behaviour; no new normative surface

Refs #5448

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 07:34
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Removing the shared ancestor ownership check exposes update and lock to another user’s planted configuration, while the malformed changelog fragment causes validation and release rendering to fail.

2 open issues
What changed in this PR

Reverts #4576 for the 0.39 release to address #5448: project-scope apm install operates from the current directory rather than adopting an ancestor manifest. Bounded discovery remains tracked in #4545.

Changes:

  • Removes install-time root discovery and relative-package rebasing.
  • Adds three lifecycle regressions for home-directory isolation and restores #4545's strict expected failure.
  • Removes discovery documentation and replaces its changelog fragment with a revert notice.
File Description
tests/​unit/​commands/​test_project_root_discovery.py Removes discovery and path-rebasing unit tests.
tests/​quality/​known_cell_issue_states.json Records #4545 as open again.
tests/​integration/​test_target_resolution_e2e.py Removes discovery cases and restores the strict expected failure.
tests/​integration/​test_home_manifest_discovery_lifecycle.py Adds three home-directory isolation regressions.
src/​apm_cli/​commands/​install.py Removes install-time project discovery.
src/​apm_cli/​commands/​_helpers.py Removes rebasing helpers and ancestor ownership filtering.
docs/​src/​content/​docs/​reference/​cli/​install.md Removes automatic discovery documentation.
docs/​src/​content/​docs/​consumer/​install-packages.md Removes the subdirectory installation example.
changelog.d/​5456.fixed.md Adds the revert's user-facing notice.
changelog.d/​4576.changed.md Removes the reverted feature's release entry.

Review effort: Balanced

Comment thread changelog.d/5456.fixed.md Resolved
Comment thread src/apm_cli/commands/_helpers.py Resolved
Partial revert: install's subdirectory discovery and the CLI package
rebase stay reverted (RT-5 cells are the oracle), but the shared
_find_apm_yml walk used by `apm lock` and `apm update` keeps #4576's
hardening: one lstat, regular-file check, and the foreign-uid ancestor
skip with its [!] warning. Restores the owner cells from
test_project_root_discovery.py, adds a lock CLI cell (red without the
uid skip) and a regular-file cell (red without the S_ISREG guard).
Shortens the changelog fragment and names #5456.

Refs #5448

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The restored strict xfail references closed issue #4545, causing the live known-cell check to fail, and filesystem/CLI regression tests are incorrectly marked as unit rather than component tests.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Reopen or retarget closed issue before restoring strict xfail

tests/​quality/​known_cell_issue_states.json:8

GitHub currently reports #4545 as closed, contrary to the PR's reopening claim. The restored strict xfail therefore fails the live known-cell check in .github/workflows/merge-train.yml:150-153. Reopen #4545 and regenerate this snapshot, or retarget the xfail to an open tracker and regenerate it; changing the snapshot alone cannot fix the failure.

2 resolved since last review

Review effort: Balanced

The module drives the filesystem and CliRunner, so it is a component
test. The two helper cells now also assert that no skip warning is
printed (AQ003 for the component tier).

Refs #5448

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The restored S16b xfail fails the live known-cell gate because #4545 remains closed, and the lifecycle test does not exercise the shared ~/.claude ownership case.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

High severity Reopen #4545 before regenerating the known-cell snapshot

tests/​quality/​known_cell_issue_states.json:8

#4545 is currently closed as completed, despite the reopening described in this PR. This OPEN snapshot passes the offline check, but the restored S16b xfail fails the live known-cell gate in .github/workflows/merge-train.yml:150-153. Reopen #4545 for the deferred feature, then regenerate the snapshot with python -m tests.quality.known_cell_issues --write; changing this entry to CLOSED alone would fail the offline gate.

Medium severity Target Claude globally to test shared skill ownership

tests/​integration/​test_home_manifest_discovery_lifecycle.py:114

On this fresh HOME, the global install defaults to Copilot (active_targets_user_scope() falls back to copilot); the stray home manifest's targets: [claude] does not configure the user manifest. The subsequent project install targets Claude, so this never exercises #5448's shared ~/.claude ownership case. Select --target claude for the global install, assert that the user skill and lock exist, and verify both remain unchanged after the project install.

1 resolved since last review

Review effort: Balanced

@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Nov 25, 2026
)

Regenerated tests/quality/known_cell_issue_states.json.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
#4545 was reopened; it stays open until the 0.40 re-land of #4576.

Refs #5448

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the change restoring current-directory-only project-scope installs.

No open issues 🎉

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 73b01d9 into main Nov 25, 2026
62 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the p3-5448-revert-4576 branch November 25, 2026 08:34
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 25, 2026
Takes #5456 and regenerates the known cell issue snapshot: 2824, 3648,
3703, 4543, 4545, 5435 and 5461, all OPEN.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot AI mentioned this pull request Nov 25, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 25, 2026
… HOME (#4545)

Re-lands #4576 (reverted by #5456) with a HOME ceiling in the single walk
owner _find_apm_yml, and a scope guard that refuses a project root equal to
the home directory, naming apm install -g and --root <dir>.

apm-spec-waiver: discovery ceiling and scope guard are CLI scope fixes, not a spec change
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-integration Run the full integration suite (ci-integration.yml) on this PR before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apm install from a new folder under $HOME adopts a stray ~/apm.yml and deploys into ~/.claude (subdirectory discovery, #4576)

2 participants