Repository navigation
fix: user-scope lifecycle scripts load once; user-scope policy negative cells - #4345
Merged
Daniel Meppiel (danielmeppiel) merged 8 commits intoNov 21, 2026
Merged
Conversation
install -g, update -g and install -g --frozen each get their own cell: with HOME a git checkout whose remote names an org policy that denies the package, the command succeeds, sends no policy request, writes no policy cache, leaves the checkout untouched and prints nothing about policy. apm policy status -g reports the user-scope source as none, with a project-scope control. Spec: OpenAPM v0.1 req-pl-001 and req-pl-011 discover policy from a project's remote git context, req-pl-012 attempts no discovery without a project remote, and Section 2 defines user scope as independent of any project root. Refs #4087 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 14:43
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 14:43
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The lifecycle test can pass without applying the published revision, so it must assert the deployed skill contains v2 content to prove the intended upgrade path was exercised.
1 open issue
What changed in this PR
This test-only follow-up to #4158 expands regression coverage for #4087: user-scope commands must ignore organization policy reachable through a git checkout at HOME.
Changes:
- Splits policy checks into separate cases for
install -g,update -g, andinstall -g --frozen. - Separates
policy status -gcoverage, retaining a project-scope control that discovers the policy. - Updates the lifecycle bug ledger to reference the new tests.
| File | Description |
|---|---|
tests/integration/test_user_scope_manifest_lifecycle.py |
Adds distinct user-scope policy cases and seeds a newer revision for update coverage. |
tests/fixtures/lifecycle_bug_ledger.json |
Updates #4087 regression-test references. |
Review effort: Balanced
…rectly Co-authored-by: copilot-swe-agent[bot] <[email protected]>
At user scope the command manifest is $APM_HOME/apm.yml, which the user tier already loads; lifecycle discovery no longer loads it again as a project tier. The concurrency scenarios park a user-scope holder in a one-shot user-manifest pre-install script, which runs under the lifecycle lock, and keep the git-shim park for project scope. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This was referenced Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…arnival # Conflicts: # CHANGELOG.md # tests/lifecycle/scenarios/test_concurrency.py
… cell Each user-scope negative cell now runs a project-scope install from the same HOME checkout, which the published policy blocks, so the negatives cannot pass vacuously. An installed-CLI cell asserts the user manifest's pre-install script runs once with no project script reported as skipped. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged
5 of 10 tasks
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-curly-carnival
branch
November 21, 2026 05:24
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.

Description
User-scope policy negative cells. User scope is not governed by an org policy reachable from a git checkout at HOME. Each user-scope command now has its own cell:
install -g,update -gandinstall -g --frozen: HOME is a git checkout whose remote names an org whose policy denies the package. The command succeeds, sends no policy request (fixture request log), writes no policy cache, leaves the checkout untouched and prints nothing about policy.apm installfrom the same HOME checkout is blocked by that policy (exit 1, "Install blocked by org policy", a policy request observed), so the user-scope negatives cannot pass vacuously.apm policy status -greports the user-scope source asnone. The control is the same checkout at project scope, which resolves the org policy.It splits the earlier combined user-scope test into separate cells and updates the #4087 ledger row to the new node ids.
User-scope consistency: at user scope the command manifest is
$APM_HOME/apm.yml, which the user tier of lifecycle discovery already loads. Lifecycle discovery (core/lifecycle_scripts.py) now loads it once, as user-tier scripts, rather than also as a project tier. The concurrency scenarios park a user-scope lock holder in a one-shot user-manifestpre-installscript, which runs under the lifecycle lock; project scope keeps the git-shim park.Issue and approved scope
Issue: Fixes #4365
Issue: Refs #4087
Human scope-approval comments: #4365 (comment) (#4365), #4087 (comment) (#4087)
Does this PR complete the issue, or what remains? Completes #4365. #4087 is already fixed by #4158; this adds the negative cells the steward asked for.
Type of change
Testing
Installed CLI (
APM_BINARY_PATHset to the binary under test), all green on this branch:tests/integration/test_user_scope_manifest_lifecycle.py::test_user_scope_command_is_not_governed_by_home_remote_policy[install]tests/integration/test_user_scope_manifest_lifecycle.py::test_user_scope_command_is_not_governed_by_home_remote_policy[update]tests/integration/test_user_scope_manifest_lifecycle.py::test_user_scope_command_is_not_governed_by_home_remote_policy[install-frozen]tests/integration/test_user_scope_manifest_lifecycle.py::test_user_scope_policy_status_reports_no_sourcetests/integration/test_user_scope_manifest_lifecycle.py::test_user_scope_lifecycle_scripts_run_oncetests/unit/core/test_lifecycle_scripts.py::TestDiscoverScripts::test_user_scope_manifest_is_loaded_once,::test_user_scope_runner_skips_no_project_scriptstests/lifecycle/scenarios/test_concurrency.py(all 9 rows, includinguser-install-vs-*, with the engine and binary drivers)Spec coverage, so no waiver: OpenAPM v0.1 req-pl-001 and req-pl-011 discover policy from a project's remote git context, req-pl-012 attempts no discovery without a project remote, and Section 2 defines user scope as independent of any project root.
tests/quality/test_lifecycle_bug_ledger.pypasses; the CI-mirror lint chain (ruff check/format, pylint R0801, auth signals, architecture boundaries, complexity and assertion ratchets) is clean.Changelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)