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
test(lifecycle): witness prune and marketplace bin cells through whole native plugins (#4894) - #4975
The lifecycle generator rule U-BIN removed every project-scope PRIM=bin cell because it assumed bin/ never deploys at project scope. That holds for loose bin/ (exec_gate.plugin_bin_deployable), but a trusted Claude plugin that ships bin/ deploys whole to .agents/plugins/<plugin>/. So prune and marketplace reach bin/ at project scope, and four T1 cells had no witness.
Changes (test corpus only, no src/ change):
tests/lifecycle/generator/rules.py, bin_pin.py: U-BIN no longer removes project-scope bin cells. Its evidence covers the whole-plugin path (claude_plugins/admission.py, native_plugins/record.py, native_plugins/uninstall.py, reference/cli/prune.md) as well as plugin_bin_deployable. The pin now hashes plugin_bin_deployable, admission _UNSUPPORTED_ROOTS and PLUGINS_RELATIVE. If the pin changes, the project-scope bin cells become must-cover.
tests/lifecycle/generator/covering.py: covering rows no longer claim U-BIN cells. Loose bin/ in a row never deploys at project scope.
tests/lifecycle/machines/_gate_plugin_bin.py (new) and test_m_gate.py::test_gate_plugin_bin_spine_credits_project_scope_prune_cells: an M-GATE side-door spine drives p-native-claude-bin from git on the claude target at project scope:
install --trust-bin with no executables block, undeclare, prune (GATE=none, orphan)
install --trust-bin, an empty executables block turns the gate on, prune (GATE=unapproved-exec)
Each retiring prune must remove every file of the plugin root (bin/ included), the plugin's enabledPlugins keys in .claude/settings.json and .github/copilot/settings.json, and its lockfile native_plugin record. It must also keep apm.yml declarations as the step left them. I1-I9 run after every step.
tests/lifecycle/generator/witnesses.py: registers the spine. Its deploying installs also credit pair|PRIM=bin|SCOPE=project.
Regenerated tests/quality/lifecycle_obligations.json. Stale comments that said bin/ never deploys at project scope now say loose bin/.
Obligation status changes (python -m tests.lifecycle.generator --counts):
Measured against main at the latest merge (after #4758 and #5012):
main
this PR
required
2383
2388
known-failing
3
3
baseline
41
37
removed by U-BIN
1
0
U-BIN-OPS (pack, marketplace and bundle-install only; audit and prune stay out of BIN_LESS_OPS) and U-MCPOWN-USER from main are unchanged.
pair|PRIM=bin|GATE=denied-dependency moves from known-failing (#3703, a user-scope install that ignores the org deny) to required. The project-scope spine proves it, and machine witnesses take precedence in the generator. The user-scope defect stays in the ledger as a strict known failure: tests/lifecycle/scenarios/test_policy_pairs.py::test_a_denied_plugin_with_bin_is_refused_at_user_scope still runs under known_defect("#3703", ...) and still fails strictly (verified on this branch).
CLI behavior observed on main (all exit 0, matching reference/cli/prune.md): a prune after an approval is removed, after apm deny, or under an org dependencies.deny retires the plugin root (bin/ included), drops the lock record and clears both enabledPlugins keys. An orphan prune also removes the lock entry. marketplace add under the deny leaves the project unchanged. Removing the whole executables block turns the gate off, and both install and prune keep the plugin, as the gate opt-in docs describe. No product defect was found.
Does this PR complete the issue, or what remains? It completes it. --counts no longer removes the reachable project-scope bin cells, and the prune x bin gate cells have a witness that fails if prune keeps the root or bin/.
Type of change
Bug fix
New feature
Documentation
Maintenance / refactor
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Validation evidence:
uv run --extra dev pytest tests/lifecycle/generator tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/quality/test_gate_cell_obligations.py tests/lifecycle/machines/test_m_gate.py::test_gate_plugin_bin_spine_credits_project_scope_prune_cells tests/lifecycle/machines/test_m_gate.py::test_gate_bin_spine_credits_user_scope_bin_cells -n 4 -> 96 passed
uv run --extra dev pytest tests/lifecycle/scenarios/test_policy_pairs.py::test_a_denied_plugin_with_bin_is_refused_at_user_scope -> 1 passed (strict known failure still holds)
Negative control: making retire_gated_native_plugins return early in a local, reverted src/ edit fails the new spine with I4: p-native-claude-bin/bin/claude still deployed but not allowed
uv run --extra dev python -m tests.lifecycle.generator --check -> up to date
uv run --extra dev python scripts/check_obligation_status_ratchet.py --base-ref origin/main -> clean
uv run --extra dev ruff check and ruff format --check on the changed files -> clean
uv run --extra dev python -m tests.quality.taxonomy --changed -> clean; scripts/check_complexity_ratchet.py --base-ref origin/main -> clean
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.
…e native plugins (#4894)
U-BIN assumed bin/ never deploys at project scope, but a trusted Claude
plugin that ships bin/ deploys whole to .agents/plugins/<plugin>/. The rule
now removes no project-scope bin cell; its pin covers the whole-plugin path
(claude_plugins/admission.py _UNSUPPORTED_ROOTS, native_plugins/record.py
PLUGINS_RELATIVE) beside plugin_bin_deployable, and a changed pin makes
those cells must-cover. Covering rows no longer claim them.
A new M-GATE plugin bin spine drives p-native-claude-bin at project scope:
install --trust-bin with the gate off, then prune of the orphaned plugin
(none), prune after the gate turns on over the deployed plugin
(unapproved-exec), and, after approve and install --trust-bin, marketplace
add and prune under an org dependency deny (denied-dependency). Each prune
must remove every file of the root, bin/ included, the enabledPlugins keys
and the lockfile record.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The lifecycle tests leave pruning regressions undetected because they do not fully verify dependency and lockfile outcomes or create and check plugin declarations for both Claude and Copilot.
This test-only PR addresses #4894 by recognizing that trusted native plugins can deploy bin/ at project scope. It updates the lifecycle coverage generator and adds a whole-plugin witness without changing CLI behavior.
Changes:
Preserve project-scope bin obligations and expand U-BIN’s source pin and evidence.
Add lifecycle coverage for orphan and gate-driven prune, plus marketplace non-mutation.
Register the witness, regenerate obligations, and clarify loose-bin deployment comments.
File
Description
tests/quality/lifecycle_obligations.json
Regenerate coverage statuses, witness mappings, and U-BIN evidence.
…plugin bin spine
After install the plugin must be declared in both harness settings files
(claude enabled, copilot pinned off), so the prune check sees a removal in
each. A gate-retiring prune must keep the declared dependency's lock row and
drop only its native_plugin record; an orphan prune must leave no row, and
deletes apm.lock.yaml when no dependency remains (reference/cli/prune.md).
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Because u_bin_applies() requires an explicit SCOPE=project, it does not filter T1/T3 bin IDs, which omit scope. This leaves T1|OP=prune|PRIM=bin|GATE=revoked-after-deploy credited to generated_cover-01's prune --dry-run, even though its loose p-exec bin/ never deploys. Evaluate the predicate with the row's known project scope, then regenerate the replay rows and obligations so these cells are not reported as covered without a genuine bin witness.
On the "previously missed issue" in the review overview (covering rows credit T1/T3 bin cells without a deployed bin/):
This convention predates this PR and reaches past prune. Covering rows act on p-exec at project scope and credit the T1, T3 and pair cells of its bin unit for every OP. Its loose bin/ never deploys there, so those receipts prove that the command handled a package that carries bin/. They do not prove that a bin/ was deployed. That covers 79 obligations today (34 T1, 16 T3, 29 pair), including T1|OP=prune|PRIM=bin|GATE=revoked-after-deploy. This PR changes none of them.
This PR narrows only the cells U-BIN names (SCOPE=project with PRIM=bin). Only the whole-plugin path can witness those. Applying the same filter to all scope-less bin cells would move 79 required cells back to baseline and needs witnesses for each OP. That is a separate change from #4894's accepted scope, so it is left for a follow-up decision rather than folded here.
The pin-drift check replaces bin_pin.predicate_digest and observes only
classify's verdict, which is a unit seam, not a component outcome (AQ003).
It now lives in tests/lifecycle/generator/test_u_bin_seam.py. The test that
only restated bin_pin.PREDICATES is dropped.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The bin deployment pin omits the admission function, allowing a critical deployment-admission change to leave the digest unchanged and evade the required transition check.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Plugin pin omits the bin-deploy admission function
tests/lifecycle/generator/bin_pin.py:33
The whole-plugin portion of this pin covers _UNSUPPORTED_ROOTS and PLUGINS_RELATIVE, but not the admission function that decides whether bin/ deploys. Reversing elif ships_bin and skip_bin: in plan_native_claude_plugin leaves the digest equal to U_BIN_PIN, so that admission change does not trigger the must-cover transition. Include the admission function in PREDICATES, regenerate the approved digest and catalog, and add a source-mutation test for this case.
Keeps U-BIN-OPS (audit and prune stay out of BIN_LESS_OPS) and
U-MCPOWN-USER from main, the bundle, pack and render witness credits, and
this branch's whole-plugin U-BIN re-derivation and plugin bin spine. The
lifecycle obligations are regenerated once.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The pin omits whole-plugin admission logic, allowing a trusted-bin-plugin behavior change to leave the digest unchanged; planner coverage, a source-mutation regression, and updated pin and ledger values are still needed.
Regenerated; the #4981 named removals now match the 127 bin cells the
filter demotes against this base.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
bin_pin: main's element_tokens refactor plus train 6's user_org_policy_digest on it (pins unchanged). Ledger 3/1/2419: audit x bin x none and the two named #3703 removals.
Co-authored-by: Copilot App <[email protected]>
On 2026-11-23 the job took 252 s at p50, 296 s at p90 and 299 s at most
across 30 green runs, against a 300 s timeout, and about 9 runs were
cancelled at the cap (microsoft#4975, microsoft#4964, microsoft#5001, microsoft#4982). The cap moves to 10
minutes as headroom only: the scaling assertion, selection and the job's
non-required status are unchanged. The ratchet topology pin follows.
Co-authored-by: Copilot App <[email protected]>
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
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
The lifecycle generator rule U-BIN removed every project-scope
PRIM=bincell because it assumed bin/ never deploys at project scope. That holds for loose bin/ (exec_gate.plugin_bin_deployable), but a trusted Claude plugin that ships bin/ deploys whole to.agents/plugins/<plugin>/. So prune and marketplace reach bin/ at project scope, and four T1 cells had no witness.Changes (test corpus only, no
src/change):tests/lifecycle/generator/rules.py,bin_pin.py: U-BIN no longer removes project-scope bin cells. Its evidence covers the whole-plugin path (claude_plugins/admission.py,native_plugins/record.py,native_plugins/uninstall.py,reference/cli/prune.md) as well asplugin_bin_deployable. The pin now hashesplugin_bin_deployable, admission_UNSUPPORTED_ROOTSandPLUGINS_RELATIVE. If the pin changes, the project-scope bin cells become must-cover.tests/lifecycle/generator/covering.py: covering rows no longer claim U-BIN cells. Loose bin/ in a row never deploys at project scope.tests/lifecycle/machines/_gate_plugin_bin.py(new) andtest_m_gate.py::test_gate_plugin_bin_spine_credits_project_scope_prune_cells: an M-GATE side-door spine drivesp-native-claude-binfrom git on the claude target at project scope:install --trust-binwith no executables block, undeclare,prune(GATE=none, orphan)install --trust-bin, an empty executables block turns the gate on,prune(GATE=unapproved-exec)approve,install --trust-bin, org policy denies the plugin,marketplace add(project bytes unchanged),prune(GATE=denied-dependency)Each retiring prune must remove every file of the plugin root (bin/ included), the plugin's
enabledPluginskeys in.claude/settings.jsonand.github/copilot/settings.json, and its lockfilenative_pluginrecord. It must also keepapm.ymldeclarations as the step left them. I1-I9 run after every step.tests/lifecycle/generator/witnesses.py: registers the spine. Its deploying installs also creditpair|PRIM=bin|SCOPE=project.Regenerated
tests/quality/lifecycle_obligations.json. Stale comments that said bin/ never deploys at project scope now say loose bin/.Obligation status changes (
python -m tests.lifecycle.generator --counts):Measured against
mainat the latest merge (after #4758 and #5012):U-BIN-OPS (pack, marketplace and bundle-install only; audit and prune stay out of
BIN_LESS_OPS) and U-MCPOWN-USER frommainare unchanged.Cells credited:
T1|OP=prune|PRIM=bin|GATE=none,T1|OP=prune|PRIM=bin|GATE=unapproved-exec,T1|OP=prune|PRIM=bin|GATE=denied-dependency,T1|OP=marketplace|PRIM=bin|GATE=denied-dependency(baseline -> required), andpair|PRIM=bin|SCOPE=project(removed -> required).pair|PRIM=bin|GATE=denied-dependencymoves from known-failing (#3703, a user-scope install that ignores the org deny) to required. The project-scope spine proves it, and machine witnesses take precedence in the generator. The user-scope defect stays in the ledger as a strict known failure:tests/lifecycle/scenarios/test_policy_pairs.py::test_a_denied_plugin_with_bin_is_refused_at_user_scopestill runs underknown_defect("#3703", ...)and still fails strictly (verified on this branch).CLI behavior observed on main (all exit 0, matching
reference/cli/prune.md): a prune after an approval is removed, afterapm deny, or under an orgdependencies.denyretires the plugin root (bin/ included), drops the lock record and clears bothenabledPluginskeys. An orphan prune also removes the lock entry.marketplace addunder the deny leaves the project unchanged. Removing the wholeexecutablesblock turns the gate off, and both install and prune keep the plugin, as the gate opt-in docs describe. No product defect was found.Issue and approved scope
Issue: Fixes #4894
Human scope-approval comment: #4894 (comment)
Does this PR complete the issue, or what remains? It completes it.
--countsno longer removes the reachable project-scope bin cells, and the prune x bin gate cells have a witness that fails if prune keeps the root or bin/.Type of change
Testing
Validation evidence:
uv run --extra dev pytest tests/lifecycle/generator tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/quality/test_gate_cell_obligations.py tests/lifecycle/machines/test_m_gate.py::test_gate_plugin_bin_spine_credits_project_scope_prune_cells tests/lifecycle/machines/test_m_gate.py::test_gate_bin_spine_credits_user_scope_bin_cells -n 4-> 96 passeduv run --extra dev pytest tests/lifecycle/scenarios/test_policy_pairs.py::test_a_denied_plugin_with_bin_is_refused_at_user_scope-> 1 passed (strict known failure still holds)retire_gated_native_pluginsreturn early in a local, revertedsrc/edit fails the new spine withI4: p-native-claude-bin/bin/claude still deployed but not alloweduv run --extra dev python -m tests.lifecycle.generator --check-> up to dateuv run --extra dev python scripts/check_obligation_status_ratchet.py --base-ref origin/main-> cleanuv run --extra dev ruff checkandruff format --checkon the changed files -> cleanuv run --extra dev python -m tests.quality.taxonomy --changed-> clean;scripts/check_complexity_ratchet.py --base-ref origin/main-> cleanChangelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)