Skip to content

fix: 0.37 bug sweep part 2 - #4283

Merged
Daniel Meppiel (danielmeppiel) merged 32 commits into
mainfrom
danielmeppiel-bug-sweep-037-p2
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 32 commits into
mainfrom
danielmeppiel-bug-sweep-037-p2

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

0.37 bug sweep, part 2. One canonical-owner fix per issue, each with a failing-before installed-CLI test and a bug-ledger row. Stacked on #4217 until it lands, then rebased onto main. Fixes are pushed incrementally; this draft lists every issue it closes.

Issue and approved scope

Moved to part 4 (#4338) at the 16:00 landing cut, with no code here: #4160, #4219, #4224, #4225, #4228, #4233, #4237, #4242, #4244, #4256. #4199 and #4208 are closed by part 1 (#4217). #4243 is closed by #4395 (single finisher for the hook-display printer).

Fixes #4169 (scope record: #4169 (comment))
Fixes #4161
Fixes #4214
Fixes #4215
Fixes #4216
Fixes #4221
Fixes #4241
Fixes #4249
Fixes #4257
Fixes #4261

Part of #4092 (req-mf-021, req-rs-013)

Human scope-approval comment: apm-scope:v1 record posted on each linked issue by the maintainer.

Does this PR complete the issue, or what remains? Completes each issue listed with Fixes.

Oracle changes

  • tests/integration/test_local_bundle_hooks_lifecycle.py::test_bundle_hooks_park_then_register_like_a_source_install (Trust and integrity consistency: bundle reinstall re-evaluates deployed executables #4216, steward-approved; option 1): a newer bundle whose hooks are not approved now expects "Retired hooks from local bundle 'hookpkg'" instead of the "Skipped" line. (a) Retired AND parked: lines 211-213 assert the retired line and the "not approved for this exact bundle content" park line. (b) Exact remedy: lines 216-224 parse the printed executables.allow snippet and assert its key equals the new bundle's exact key. No runnable apm approve exists for a local bundle key, and the remediation catalog that Owner moves: console construction, remediation advice and module ownership #4143 landed has no entry for it, because catalog entries must run an apm command and this remedy is a manifest edit. Routing the hint through the catalog stays a follow-up. (c) Runs it, then I1: lines 225-231 apply the snippet exactly as printed, reinstall, assert the new hook is registered and runs, check the lock against disk (I1, _assert_lock_matches_disk), and run audit --ci.
  • tests/lifecycle/security/test_gate_removal.py (commit 0cb8517): a local bundle approval pins the whole bundle digest, so a bundle redefinition now revokes EVERY executable kind in the gate model, not only the redefined kind. This matches the existing mcp slice comment ("a changed definition reads as a bundle that is not approved yet").

Follow-ups: #4436 (route the local-bundle approval hint through the remediation catalog), #4437 (apm approve does not accept content-bound local-bundle keys)

Strict cells flipped

Type of change

  • Bug fix

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Changelog

  • One line per fix under ## [Unreleased] in CHANGELOG.md.

Spec conformance (OpenAPM v0.1)

  • N/A -- see per-fix notes.

@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Nov 20, 2026
@danielmeppiel
Daniel Meppiel (danielmeppiel) changed the base branch from danielmeppiel-bug-sweep-037 to main November 20, 2026 11:18
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as ready for review November 20, 2026 11:45
Copilot AI balanced review requested due to automatic review settings November 20, 2026 11:45

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

Unresolved defects can commit ref pins for rejected plugins, direct recovery and removal commands at the wrong installation scope, and misreport deployment paths and credential attempts.

6 open issues
What changed in this PR

This bug sweep improves APM’s install lifecycle consistency and CLI diagnostics, with regression coverage and documentation for the changed behavior.

Changes:

  • Stages marketplace ref pins until commit, preserves recorded executable status during apm lock, and includes shared skill directories in bundles.
  • Clarifies cleanup destinations, repository failures, recovery commands, target sources, and advisory drift; reduces duplicate output.
  • Adds unit and installed-CLI regression tests, bug-ledger entries, and corresponding usage documentation.
File Description
tests/​unit/​test_command_logger.py Tests path-based cleanup summaries and totals.
tests/​unit/​marketplace/​test_versioned_resolver.py Updates mocks for staged ref pins.
tests/​unit/​marketplace/​test_marketplace_commands.py Tests shorthand marketplace refs.
tests/​unit/​install/​test_target_contraction_logging.py Adapts cleanup logger test double.
tests/​unit/​install/​test_services_rendering.py Expects every destination folder.
tests/​unit/​install/​test_install_transaction.py Tests commit-only pin persistence.
tests/​unit/​install/​test_drift.py Tests advisory drift severity.
tests/​unit/​install/​phases/​test_cleanup_phase.py Expects structured cleanup results.
tests/​unit/​core/​test_auth_phase3.py Tests credential-source diagnostics.
tests/​unit/​core/​test_auth_outcome.py Tests repository-not-found classification.
tests/​unit/​commands/​test_pack_cli_surface.py Tests JSON license warnings.
tests/​unit/​commands/​test_marketplace_outdated.py Marks remote test entry explicitly.
tests/​test_runnable_prompts.py Expects runnable script-discovery advice.
tests/​integration/​test_stale_cleanup_diagnostics.py Checks named removals across cleanup commands.
tests/​integration/​test_required_lifecycle_state_machine.py Updates folded cleanup expectations.
tests/​integration/​test_repository_not_found_lifecycle.py Exercises repository failures and recovery advice.
tests/​integration/​test_prune_deployment_ledger_e2e.py Checks conditional hook-reconciliation output.
tests/​integration/​test_pack_deprecation_warning_lifecycle.py Checks JSON license-warning preservation.
tests/​integration/​test_pack_bundle_roundtrip_lifecycle.py Tests shared-skill bundle round trips.
tests/​integration/​test_marketplace_registered_ref_lifecycle.py Exercises shorthand registration and pinning advice.
tests/​integration/​test_marketplace_ref_pin_lifecycle.py Checks failed and dry-run pin isolation.
tests/​integration/​test_marketplace_authoring_lifecycle.py Tests local-entry outdated reporting.
tests/​integration/​test_manifest_rewrite_preservation_lifecycle.py Checks relative manifest labels.
tests/​integration/​test_lock_parked_exec_status_lifecycle.py Tests parked executable-status preservation.
tests/​integration/​test_install_summary_destinations_lifecycle.py Checks destination summaries and skill deduplication.
tests/​integration/​test_install_services_phase3w5.py Updates skill fixtures and destination expectations.
tests/​integration/​test_install_services_orchestration.py Updates orchestration rendering expectations.
tests/​integration/​test_install_compile_copilot_dedup_e2e.py Checks intentional zero-output compilation.
tests/​integration/​test_init_reinit_targets_lifecycle.py Tests manifest-based target-source reporting.
tests/​integration/​test_frozen_replay_output_lifecycle.py Checks frozen replay headers and targeting output.
tests/​integration/​test_failure_next_step_lifecycle.py Exercises printed recovery commands.
tests/​integration/​test_executables_gate_integration.py Tests lock-only trust-state carryover.
tests/​integration/​test_audit_drift_exit_contract_lifecycle.py Checks drift severity against exit status.
tests/​integration/​test_architecture_outcome_guards.py Tests component-selection recovery advice.
tests/​integration/​marketplace/​test_build_integration.py Updates staged-pin mock.
tests/​fixtures/​lifecycle_bug_ledger.json Records fixes and regression-test links.
src/​apm_cli/​marketplace/​version_pins.py Adds install-attempt pin staging.
src/​apm_cli/​marketplace/​source_identity.py Identifies shorthand marketplace sources.
src/​apm_cli/​marketplace/​resolver.py Stages resolved pins instead of writing immediately.
src/​apm_cli/​marketplace/​registration.py Parses shorthand ref fragments.
src/​apm_cli/​integration/​targets.py Includes primitive deployment roots in pack prefixes.
src/​apm_cli/​integration/​skill_support.py Centralizes integrated-skill counting.
src/​apm_cli/​integration/​mcp_integrator_install.py Adds quiet target selection.
src/​apm_cli/​integration/​hook_reintegration.py Snapshots merged hook state.
src/​apm_cli/​integration/​hook_integrator.py Reports whether reconciliation changed hooks.
src/​apm_cli/​integration/​cleanup.py Produces directory-folded cleanup path lists.
src/​apm_cli/​install/​validation.py Adds host and credential-source failure details.
src/​apm_cli/​install/​transaction.py Commits or discards staged pins.
src/​apm_cli/​install/​template.py Supplies reinstall specs for recovery advice.
src/​apm_cli/​install/​sources.py Uses replay-aware package header refs.
src/​apm_cli/​install/​source_helpers.py Selects declared refs for replay headers.
src/​apm_cli/​install/​services.py Consolidates skill and destination summaries.
src/​apm_cli/​install/​service_integration.py Silences preliminary MCP target selection.
src/​apm_cli/​install/​presentation/​__init__.py Passes structured cleanup results to logging.
src/​apm_cli/​install/​phases/​resolve.py Adds missing-repository advice and deduplicates failures.
src/​apm_cli/​install/​phases/​post_deps_local.py Reports local cleanup paths.
src/​apm_cli/​install/​phases/​lockfile.py Preserves executable status in lock-only mode.
src/​apm_cli/​install/​phases/​cleanup.py Collects structured cleanup results.
src/​apm_cli/​install/​outcome.py Builds component-selection recovery commands.
src/​apm_cli/​install/​mcp/​command.py Formats relative manifest labels.
src/​apm_cli/​install/​local_bundle_handler.py Reports bundle deployment folders.
src/​apm_cli/​install/​dry_run_plan.py Reuses quiet target selection.
src/​apm_cli/​install/​drift_render.py Supports advisory drift headers.
src/​apm_cli/​install/​deployed_paths.py Formats complete destination-folder summaries.
src/​apm_cli/​deps/​git_reference_resolver.py Raises canonical repository-not-found errors.
src/​apm_cli/​deps/​clone_engine.py Distinguishes missing repositories from clone failures.
src/​apm_cli/​deps/​bare_cache.py Formats repository-not-found clone diagnostics.
src/​apm_cli/​core/​script_runner.py Replaces placeholder advice with apm list.
src/​apm_cli/​core/​null_logger.py Adds a fully silent logger.
src/​apm_cli/​core/​command_logger.py Lists removed paths with matching counts.
src/​apm_cli/​core/​auth.py Formats credential-source and not-found diagnostics.
src/​apm_cli/​core/​auth_outcome.py Recognizes Git repository-not-found wording.
src/​apm_cli/​compilation/​distributed_compiler.py Records complete deduplication suppression.
src/​apm_cli/​commands/​uninstall/​cli.py Uses consistent manifest labels.
src/​apm_cli/​commands/​targets.py Reports manifest-declared target sources.
src/​apm_cli/​commands/​prune.py Names removals and reports actual hook changes.
src/​apm_cli/​commands/​pack.py Preserves authoring warnings in JSON output.
src/​apm_cli/​commands/​marketplace/​outdated.py Skips local-path entries.
src/​apm_cli/​commands/​install.py Uses enriched inaccessible-package diagnostics.
src/​apm_cli/​commands/​compile/​cli.py Avoids warnings for explained deduplication skips.
src/​apm_cli/​commands/​audit.py Aligns advisory drift rendering with policy.
packages/​apm-guide/​.apm/​skills/​apm-usage/​package-authoring.md Documents JSON license warnings.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Documents cleanup lists and shorthand refs.
docs/​src/​content/​docs/​troubleshooting/​install-failures.md Explains repository and credential diagnostics.
docs/​src/​content/​docs/​troubleshooting/​index.md Updates advisory drift examples.
docs/​src/​content/​docs/​troubleshooting/​common-errors.md Documents runnable script-discovery advice.
docs/​src/​content/​docs/​reference/​cli/​uninstall.md Explains named cleanup paths.
docs/​src/​content/​docs/​reference/​cli/​targets.md Documents manifest source labels.
docs/​src/​content/​docs/​reference/​cli/​prune.md Documents removal-path reporting.
docs/​src/​content/​docs/​reference/​cli/​pack.md Documents JSON license warnings.
docs/​src/​content/​docs/​reference/​cli/​marketplace.md Documents shorthand refs and local-entry skips.
docs/​src/​content/​docs/​reference/​cli/​lock.md Documents executable-status preservation.
docs/​src/​content/​docs/​reference/​cli/​install.md Explains cleanup path lists.
docs/​src/​content/​docs/​reference/​cli/​audit.md Documents advisory drift severity.
CHANGELOG.md Records user-visible bug fixes.

Review effort: Balanced

Comment thread src/apm_cli/core/auth.py
Comment on lines +1248 to +1251
sources = list(dict.fromkeys(ctx.source for ctx in contexts if ctx.token))
if sources:
label = "credential" if len(sources) == 1 else "credentials"
return f"{label} tried: {', '.join(sources)}"
if value in available
]
selection = kept or sorted(available)[:1]
argv = ["apm", "install", install_spec]
Comment thread src/apm_cli/install/phases/resolve.py Outdated
Comment on lines +760 to +762
fail_msg += (
f" Run 'apm uninstall {dep_ref.get_identity()}' to remove it from apm.yml."
)
if not self.committed:
cleanup_issues = self._resolution.commit() or []
self.committed = True
self._ref_pins.commit()
Comment thread src/apm_cli/install/validation.py Outdated
reason = f"not accessible or doesn't exist (host: {host}, {tried})"
if verbose:
return reason
return f"{reason}. Run 'apm install --verbose {package}' to see each probe and credential."
if any(path.startswith(f"{directory}/") for directory in directories):
continue
shown = f"{path}/" if path in directories else path
announced.append(shown if "://" in shown else prefix + shown)
…admits

Reinstalling a local bundle re-evaluates the hooks it deployed earlier
through install/local_bundle_hook_trust.py: after a revoked approval, a
bundle deny or org executables.deny_all, the reinstall retires the merged
entries, per-file hook files, copied hook scripts and their lock rows, and
announces it with the exact-key approval hint. Plain install, update and
prune retire through the same entry point.

Closed-world guard install-deployment-local-bundle-hook-retirement: only
the trust owner calls HookIntegrator.retire_local_bundle_hooks.

Fixes #4216

Co-authored-by: Copilot App <[email protected]>
…ep-037-p2-local

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
The package phase and the MCP phase each checked the policy escape
hatch and printed the same warning. The install logger now shows the
policy-disabled warning once per invocation.

Co-authored-by: Copilot App <[email protected]>
…4249)

The package phase and the MCP phase each routed the same policy
discovery outcome and printed its status line. The install logger now
shows each policy status line once per invocation.

Co-authored-by: Copilot App <[email protected]>
apm install <bundle> records the executable types it parked and the exact
approval key in the scope's apm_modules (install/local_bundle_pending.py).
apm approve --pending lists them, re-checked against current trust, with
the unwrapped key to add under executables.allow.

Fixes #4221

Co-authored-by: Copilot App <[email protected]>
…ep-037-p2-local

# Conflicts:
#	scripts/architecture_linter/checks/install_trust_integrity.py
#	src/apm_cli/install/phases/resolve.py
#	tests/fixtures/lifecycle_bug_ledger.json
)

The hook summary printed one identical line per target that received
the hook. The summary owner now prints each distinct hook line once.

Co-authored-by: Copilot App <[email protected]>
Move the approval-key derivation and the deployed-destination report into
helpers so the merged function stays at the Stage 2 limit.

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
A lock read from disk remembers its top-level x- keys, and a lock rebuilt
from resolution carries over the keys of the document it replaces
(deps/lockfile_extensions.py). Removes the strict xfail on
test_lock_top_level_vendor_keys_survive_rewrite and adds an installed-CLI
receipt with a paired install --frozen / audit --ci probe.

Spec: req-lk-014
Fixes #4261

Co-authored-by: Copilot App <[email protected]>
Package validation now counts dependencies.lsp like apm and mcp when it
accepts an apm.yml without .apm/ as a dependency-only package. Uninstalling
another package no longer fails its survivor preflight on an LSP-only
package (gated and approved, ungated, or denied), and an LSP-only package
installs from git as it does from a local path.

Fixes #4161
Fixes #4214
Fixes #4215
Fixes #4257

Co-authored-by: Copilot App <[email protected]>
…n: unknown

A generator stamp that names no release proves no post-0.36 meaning, so the
retired-destination heal treats it like a missing or pre-0.37 stamp and
reports what it moves.

Fixes #4169

Co-authored-by: Copilot App <[email protected]>
…tion: nest

A top-level workspaces: key gets one non-blocking warning naming it as
reserved for OpenAPM v0.2 (req-mf-021). dependencies.conflict_resolution:
nest refuses the install before any write, citing Section 7.2 clause (3)
(req-rs-013). Both decided in models/apm_package.py.

Spec: req-mf-021, req-rs-013
Part of #4092

Co-authored-by: Copilot App <[email protected]>
…sing

test-coverage-expert reserves outcome: missing for an absent test; a
state-fact lifecycle test it could not run in the review is unknown, with
the reason. Deployed copy regenerated with apm install; render_eval and
roster_eval pass.

Co-authored-by: Copilot App <[email protected]>
…ep-037-p2-local

# Conflicts:
#	CONFORMANCE.md
#	src/apm_cli/commands/pack.py
#	src/apm_cli/install/sources.py
#	src/apm_cli/integration/mcp_integrator_install.py
#	tests/fixtures/lifecycle_bug_ledger.json
#	tests/unit/commands/test_pack_cli_surface.py
#	tests/unit/core/test_auth_phase3.py
#	tests/unit/install/test_drift.py
…ep-037-p2-local

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
# Conflicts:
#	src/apm_cli/install/local_bundle_handler.py
#	src/apm_cli/integration/mcp_integrator_install.py
#	tests/fixtures/lifecycle_bug_ledger.json
#	tests/unit/core/test_auth_phase3.py
The output oracle's known cells for #4241, #4249, #4267, #4196 and #4243
no longer fail, and the strict #4257 xfail on the p-lsp git cells passes:
the defects are fixed on this branch.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
#4283 fixes #4241 and #4249; in the train the oracle reports both strict known cells as passing ('the defect now passes, so remove the cell'), so they are removed with their fix. The #4196 ledger row came back through the ledger union although #4217 removed it with its test (on main); its regression test does not exist.

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	src/apm_cli/install/services.py
req-lk-014, req-mf-021 and req-rs-013 each gain one installed-CLI test.

Co-authored-by: Copilot App <[email protected]>
…s hooks retire

The #4216 oracle asserts the earlier hook is retired and the new one is
parked with its exact key, applies the printed executables.allow snippet,
reinstalls, and checks the new hook runs and the lock matches disk.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
#	tests/utils/lifecycle_evidence.py
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
#	tests/utils/lifecycle_evidence.py
A local bundle approval pins the whole bundle digest, so a redefined bundle
loses the approval for every executable kind it ships. The gate model now
revokes all kinds on a bundle redefinition, and the bundle-install hook,
MCP and bin cells that track #4216 move from known_failing to required.

Co-authored-by: Copilot App <[email protected]>
A parked local bundle's record (#4221) lives under apm_modules/; prune now
reads a directory without packages as empty. The needle for the bundle
approval-key guard follows the key's helper, and the strict cells for
#4169 and #4214 are removed now that both hold.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/lifecycle/machines/test_m_source.py
#	tests/lifecycle/security/gate_slices/bin.py
…ement

The three integrity cells for a bundle whose approval no longer matches its
content are required now; an installed-CLI test covers a reinstall with
changed bundle content. The #4216 ledger row and changelog line name the
case.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 9c3e801 into main Nov 21, 2026
80 of 91 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-bug-sweep-037-p2 branch November 21, 2026 05:24
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

2 participants