Skip to content

[0.38] test(install): S13 asserts the bare global install contract - #4561

Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-4544-bare-global-install
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-4544-bare-global-install

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

TL;DR

S13 in tests/integration/test_target_resolution_e2e.py was a strict expected failure. It expected apm install -g --target copilot, run with no user manifest, to deploy. The kept contract is the opposite: the command exits 1, names $APM_HOME/apm.yml, and gives apm install -g <org/repo> as the next step, just like project-scope apm install without apm.yml (S14). S13 now asserts that contract through the installed CLI, and the expected-failure marker is removed. The install reference states the same contract. There is no product change.

What changed

  • S13 (test commit): runs apm install -g --target copilot against the installed CLI. HOME and USERPROFILE point at an isolated fake home, and APM_HOME, APM_TARGET and APM_CONFIG are unset. The test asserts:

    • exit code 1;
    • No <fakehome>/.apm/apm.yml found in the output;
    • the 'apm install -g <org/repo>' next step in the output;
    • no user manifest, no user lockfile and no ~/.copilot;
    • no other file under the fake home, apart from APM's own .apm-lifecycle.lock files and the .cache/ update-check stamp.

    The strict xfail is gone.

  • Docs (last commit): reference/cli/install.md, in the auto-bootstrap note, now states the bare -g contract right after the project-scope sentence.

Decision for Daniel (taken under rule S15, flagged to the PM)

The record's Done-when says nothing is created under the fake HOME ("no .apm/, no copilot files"). On main, a refused bare apm install -g still creates:

  • an empty ~/.apm/apm_modules/ (from ensure_user_dirs() in the user-scope prep);
  • ~/.apm/.apm-lifecycle.lock and ~/.apm-local/.apm-lifecycle.lock (the install transaction takes its locks before the manifest check).

Making "no .apm/" literally true would mean reordering user-scope prep and lock acquisition in commands/install.py, which is a product change. This PR does not make one.

The default I took is the record's intent: no user manifest, lockfile, harness or deployed file. The leftover is limited to APM's own lock files and an empty apm_modules/, and the test names that allowance explicitly. If the empty scaffolding should go too, that is a small follow-up product change: check for the manifest before ensure_user_dirs() and before the lifecycle lock.

Issue and approved scope

Issue: Fixes #4544

Human scope-approval comment: #4544 (comment) (scripts/governance/eligibility.cjs: record-present, contact_confirmation_needed: false).

Does this PR complete the issue, or what remains? It completes it, except for the .apm/ scaffolding decision above.

Controls:

  • S14 is unchanged.
  • The bootstrap path (apm install -g <pkg> with no user manifest creates ~/.apm/apm.yml) keeps its existing coverage: tests/integration/test_global_scope_e2e.py::TestGlobalManifestPlacement::test_auto_bootstrap_creates_user_manifest.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass: CI green at c78f412 (33 pass, 3 skipping).
  • Added tests for new functionality (if applicable): S13 rewritten.

Local results:

  • uv run --extra dev pytest tests/integration/test_target_resolution_e2e.py -k "s13 or s14": 2 passed.
  • uv run --extra dev pytest "tests/integration/test_global_scope_e2e.py::TestGlobalManifestPlacement::test_auto_bootstrap_creates_user_manifest": 1 passed.
  • Lint mirror and architecture linter: see the PM report.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md
  • N/A -- internal-only change (CI, tests, refactor). Behavior and CLI text are unchanged, so per the record there is no CHANGELOG line.

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

A bare `apm install -g` with no user manifest exits 1, names the missing
`$APM_HOME/apm.yml` and gives `apm install -g <org/repo>` as the next step,
like project-scope `apm install` without `apm.yml` (S14). S13 now runs the
installed CLI against that contract instead of expecting a deploy, and its
strict expected failure is removed. It also checks that no user manifest,
lockfile or Copilot file is written; only APM's lock files and the
update-check cache may appear under the isolated HOME.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
The install reference now says, next to the project-scope sentence, that a
bare `apm install -g` with no user manifest exits 1, names the missing
`$APM_HOME/apm.yml` and suggests `apm install -g <org/repo>`.

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

S13 can fail on Windows because its exclusions omit the update-check stamp under AppData/Local/apm/cache, even when installation correctly refuses without deploying anything.

1 open issue
What changed in this PR

This PR addresses #4544 by aligning S13 and the install reference with the existing bare global-install contract. It changes tests and documentation, not product behavior.

Changes:

  • Removes S13's strict expected-failure marker and asserts exit code 1, the missing-manifest message, and the suggested next command.
  • Checks that the refused install creates no manifest, lockfile, or deployment, allowing incidental APM files.
  • Documents the same bare apm install -g behavior alongside project-scope guidance.
File Description
tests/​integration/​test_target_resolution_e2e.py Replaces S13's success expectation with error and filesystem assertions.
docs/​src/​content/​docs/​reference/​cli/​install.md Clarifies behavior when a bare global install has no user manifest.

Review effort: Balanced

for path in fakehome.rglob("*")
if path.is_file()
and path.name != ".apm-lifecycle.lock"
and path.relative_to(fakehome).parts[0] != ".cache"
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit e20c32c into main Nov 21, 2026
39 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-4544-bare-global-install branch November 21, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Decide the bare 'apm install -g' contract when no user manifest exists

2 participants