Skip to content

fix(0.37): tier-2 consistency polish at the owners (#3967, #3940) [PR C of #3983] - #3992

Merged
Daniel Meppiel (danielmeppiel) merged 112 commits into
mainfrom
danielmeppiel-0-37-owner-hardening-c
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 112 commits into
mainfrom
danielmeppiel-0-37-owner-hardening-c

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

PR C of the #3983 umbrella (0.37 owner hardening). Stack: #3996 (docs redesign) <- PR B (#3989) <- this PR; PR A (#3988) has landed on main. It holds the tier-2 consistency polish from #3967, the Antigravity user-scope skills move (#3940) and one docs-sweep correction (#3948). Each fix sits in the owner that already makes the decision. Help and vocabulary text is derived from the catalog, adapters or detection owners rather than edited as strings.

Item Owner Change
C5a core/target_detection.parse_target_field target: agents warns once per run (the duplicate from the targets phase is gone).
C5b update user-scope path apm update -g names the user manifest it actually read.
C5c (PR A) advertised_manifest_target_names vscode no longer advertised in headers and errors.
C5d install/mcp/retired_destinations.report_retired_mcp_heal; errors._signal_list from SIGNAL_WHITELIST Uninstall reports retired MCP heals; .github/mcp.json is emptied, never deleted (docs).
C5e retired_destinations.preview_retired_mcp_moves (new, read-only, reuses split_mcp_claims and the heal's proof) install --dry-run previews servers moving from .github/mcp.json / .vscode/mcp.json to .mcp.json, and tells a move from a plain removal (R4).
C4 filter_excluded_mcp_runtimes --exclude reads values the same way --target does: case-folded, alias warns and canonicalizes, unknown values warn (exit code unchanged, per decision 5). Project MCP installs and LSP servers read --exclude through the same normalizer (R2, LSP --exclude).
B4 deps list rows and apm find Ported packages keep their host:port lock key, so they never collapse.
B5a deps/lockfile_generator.refusal_exit Every command, apm install included (R5), renders the newer-lockfile refusal with the same [x] prefix on stderr; the user-scope lockfile is named by path. Closed-world guard: only install and pack may call check_current_cli directly.
B5c DependencyTree.add_declaration_error -> ProspectiveInstallPlan.dependency_declaration_errors install --dry-run shows the #3895 shared-directory and nested-declaration refusals without --verbose (exit code unchanged).
B5d commands/approve._not_found_message A port-less apm approve owner/repo names the ported key to approve. It still never grants across ports.
A6/N3 commands/view + admit_marketplace_resolution apm view x@mkt fixes the swallowed TypeError call, and never suggests installing an entry that install refuses (#1326).
S8 scripts/runtime/setup-codex.sh / .ps1 wire_api follows the installed Codex version: chat for v0.116 and later, including latest. Docs updated.
S11 mcp_user_scope_runtimes.user_scope_runtime_labels The user-scope runtime list is derived from adapters; install -g --help keeps no list of its own. The helpers move to their own module so mcp_integrator_install.py stays under the 2100-line gate.
#3940 integration/targets.py antigravity user_root_dir + lockfile-recorded cleanup owner -g skills land in ~/.gemini/config/skills/; recorded old-path copies are retired on the next -g install; unrecorded files are never touched.
#3948 docs Removes the stale "policy engine is experimental" note from the apm-usage governance skill. The policy-page banners are already gone on #3996's redesigned pages.
P13 CommandLogger.refusal (stderr console, as R5) Org-policy refusals from install, install --frozen and update, and the bare apm approve usage error, print on stderr. Exit codes unchanged.
Q1 commands/uninstall/cli.py, commands/prune.py, install/phases/finalize.py uninstall and prune hint apm compile when removed instructions are still compiled into AGENTS.md / GEMINI.md.
Q2 compilation/distributed_compiler.py compile --clean reports the orphaned AGENTS.md it removes instead of telling you to run --clean.
Q6 output/script_formatters.py apm run labels a runtime-less script Shell script, not Unknown.

Docs re-home on #3996

Journey-page edits are re-homed on #3996's redesigned pages through the CDO patch (docs: 0.37 owner-hardening behaviour on the redesigned pages (#3992)). Deleted pages are not resurrected; reference pages (reference/**) and the apm-usage skill keep this PR's edits.

Red-team folds

  • R2: project MCP --exclude VSCode honoured (mixed case reads through the runtime normalizer).
  • R4: the dry run no longer labels a retirement as a move to a destination install never writes.
  • R5: apm install sends the newer-lockfile refusal to stderr like every other command.
  • P13: policy refusals and the approve usage error on stderr (subprocess test captures both streams).
  • Q1, Q2, Q6: compile hint after uninstall/prune, compile --clean wording, Shell script label (side branch danielmeppiel-0-37-c-ux-folds, merged).

Issue and approved scope

Issue: Fixes #3967, Fixes #3940. Refs #3983 #3948

Human scope-approval comment: #3983 scope records (umbrella, no-deferral rule); #3940: #3940 (comment) ; #3948 docs item forwarded by the coordinator under the docs-sweep scope.

Does this PR complete the issue, or what remains? #3967 is complete across #3988 (C5c, B5b) and this PR (every other item). #3940 is complete. #3948 gets only the policy-banner correction here.

Type of change

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

Testing

  • Tested locally (targeted, -n 2; the full matrix runs in CI)
  • All existing tests pass (CI)
  • Added tests for new functionality (if applicable)

Each new test was confirmed to fail on the base with the src change reverted:

  • tests/unit/test_view_command.py::...::test_marketplace_ref_hint_names_a_refused_entry_as_refused
  • tests/unit/deps/test_lockfile_generator.py::test_every_command_renders_the_refusal_like_install, plus an assertion in tests/integration/test_lockfile_generator_gate_lifecycle.py::test_user_scope_lockfile_is_guarded (17 passed)
  • tests/unit/install/test_dry_run_graph.py::test_two_hosts_one_slot_is_a_declaration_error and tests/unit/install/test_dry_run_render.py::...::test_declaration_errors_show_without_verbose
  • tests/unit/commands/test_approve_deny.py::test_port_less_name_points_at_the_ported_package
  • tests/unit/install/test_copilot_project_mcp_destination.py::test_dry_run_preview_names_exactly_what_the_heal_moves and test_dry_run_render.py::...::test_retired_mcp_moves_are_previewed_for_project_scope
  • tests/unit/test_runtime_setup_codex_script.py::test_setup_codex_config_matches_the_installed_version
  • tests/unit/commands/test_find_cli_surface.py::test_ported_and_default_port_packages_stay_distinct
  • The earlier C commits (C4, C5a/b/d, B4, S11, [FEATURE] Align Antigravity user-scope skill root with ~/.gemini/config/skills/ #3940) each carry a regression test.
  • P13: tests/integration/test_policy_refusal_stderr_lifecycle.py::test_policy_refusals_and_approve_usage_error_write_stderr fails on the base (violation missing from stderr); mutation-breaks reverting only the update route or only the approve route each fail it.
  • S11 contract: tests/unit/install/test_no_policy_flag.py::...::test_install_help_lists_kiro_runtime_and_global_scope asserts the derived list (Kiro included) rather than a hard-coded one.
  • Q1/Q2/Q6: tests/unit/test_removal_compile_hint.py, tests/unit/compilation/test_empty_agents_shells_1730.py, tests/unit/test_script_formatters.py.
  • New mutation case: contracts-tooling-lockfile-generator-gate (prune bypassing require_current_cli).

Lint contract on HEAD:

  • uvx [email protected] check and format --check on src/, tests/ and the linter scripts: clean.
  • pylint R0801: 10.00/10.
  • scripts/lint-auth-signals.sh: clean.
  • scripts/lint-architecture-boundaries.sh: rc 0.
  • File-length and relative_to guards: clean.

CI: ci.yml runs only on PRs to main, so this PR's full matrix runs through the release/0.37-train PR (#4002).

Changelog

  • One line per change under ## [Unreleased] ((#3967, #3992), (#3940, #3992)).
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

No req-XXX behaviour changes. Exit codes and normative surfaces are unchanged.

…nt (#3959)

Harvested from #3976; the positional install reads the lock lazily.

Co-authored-by: Copilot App <[email protected]>
…a same-store deny (#3957)

Harvested from #3979.

Co-authored-by: Copilot App <[email protected]>
A partial name could grant or deny execution for another package.

Co-authored-by: Copilot App <[email protected]>
… executables: (#3954)

exec_trust_context_for_project takes the manifest file instead of deriving
apm.yml from a caller-chosen root; -g resolves APM_HOME/apm.yml through
core.scope.get_manifest_path. A closed-world guard registers every caller.
Supersedes #3969 and keeps its lifecycle test.

Co-authored-by: Copilot App <[email protected]>
Every caller of the shared install entry now runs inside a registered
catalog-freshness envelope; the guard is closed-world.

Co-authored-by: Copilot App <[email protected]>
APM_NO_SCRIPTS, org executables.deny_all and project script trust now apply;
LifecycleScriptRunner is built only by build_runner_from_context, guarded
closed-world by the new lifecycle-script-firing-gate owner.

Co-authored-by: Copilot App <[email protected]>
#3966)

The only opt-out is a dependency's own authored .mcp.json; a closed-world
guard refuses any other.

Co-authored-by: Copilot App <[email protected]>
… the gate was never on (#3958)

Harvested from #3981 (b4cface, cb015e6); the trust read uses the scope manifest.

Co-authored-by: Copilot App <[email protected]>
Reads the manifest restriction through the same owner install uses.

Co-authored-by: Copilot App <[email protected]>
- compile's no-output hint names targets:, not the deprecated target:
- pack's mismatch hint no longer suggests the deprecated pack --target
- skip messages name executables.allow instead of allowExecutables
- origin and freshness errors say marketplace, not catalog
- generated apm.yml headers and unknown-target errors stop listing vscode
- config docs show default_client: copilot

Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

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

Harvested from #3980. Raw apm.yml readers must pass the manifest path to
manifest_target_restriction; only APMPackage-loaded configs may omit it
(closed-world guard).

Co-authored-by: Copilot App <[email protected]>
…idity owner (#3964)

A warm copy that contradicts apm.lock.yaml routes audit to the lock-pinned
scratch replay, as a cold checkout does; replay's own marker check now asks
drift.locked_copy_holds_commit. The copy-validity guard is closed-world.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
…egration (#3874)

Every requested package resolves and downloads before any is integrated, so
a failed multi-package install leaves no untracked deployed files. Guarded
by the install-outcome rule.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

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

The committed plugin pin covers path and bytes; the exec bit stays only in
the per-machine integrity hash, because Windows derives it from file
extensions and an approval made on macOS would park on Windows. The
trust-fingerprint guard requires the mode-less pin and owns it closed-world.

apm-spec-waiver: approval pin binding is implementation-defined; root digest integrity unchanged

Co-authored-by: Copilot App <[email protected]>
…call (C5d)

C5d wrapped the uninstall heal in report_retired_mcp_heal, which re-indented
its stored_configs argument to match the remove_stale call; the mutation
case now anchors on the removal call's fail_on_write_error line.

Co-authored-by: Copilot App <[email protected]>
…ics (Q1)

Q1 passes ctx.diagnostics into the shared instruction scan. InstallContext
always has the field (default None) and the scan accepts None, so the fake
context now mirrors the real shape instead of production growing a getattr.

Co-authored-by: Copilot App <[email protected]>
…ize boundary (Q1)

Q1 passed ctx.diagnostics into the shared instruction scan eagerly, so a
context without diagnostics raised AttributeError before any scan. The hint
owner now reads it as optional; the spec test's fake context (no
diagnostics) is restored to keep proving that boundary.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

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
Take #3992's Q2 branch (no 'run --clean' after removal, dry-run previews the
cleanup), which subsumes #4004's equivalent change; both sides' tests kept.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

PR C lands the #3967 consistency polish and #3940 at their owners. The merge worker merged B forward and folded P13, the S11 test contract, two guard drifts and the Q1/Q2/Q6 side branch.

panel-mode=lean; personas=python-architect,supply-chain-security-expert,test-coverage-expert,doc-writer,apm-ceo

cc Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Scope matches the #3983 record for PR C:

Nothing from PR B leaked in. B's own regression found here (the drift.py LOC budget) was fixed on B and merged forward.

The panel's findings were seams, not design problems:

  • Policy refusals printed on stdout while the lockfile refusal used stderr. There is one refusal owner now.
  • A test still asserted the hard-coded -g runtime list that S11 removed.
  • C5d's re-indent made a mutation anchor ambiguous.
  • Q1's compile hint required diagnostics that a context may not carry.

All are folded, each with a test that fails on the base.

Aligned with:

  • Secure by default: policy refusals keep exit code 1 and now reach stderr, where CI collects errors.
  • Portable by manifest: runtime lists and exclusions derive from the adapters and one normalizer.

Panel summary

Persona B R N Takeaway
Python Architect 0 2 1 Each #3967 item sits in its owner. Two second-renderer seams and a LOC-budget regression from B were folded.
Supply Chain Security Expert 0 0 1 No trust or policy decision changes; refusals keep their exit codes.
Test Coverage Expert 0 2 0 Every fold has a test that fails on the base. The tip-probe failure came from a test that still encoded the pre-S11 list.
Doc Writer 0 2 0 Journey pages come from #3996 plus the CDO patch. The PR body and one CHANGELOG line lagged the code.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 4 follow-ups

  1. [Python Architect] Route policy refusals and the approve usage error through CommandLogger.refusal on stderr (P13, 4f3f41f). -- One refusal renderer, as R5 established.
  2. [Test Coverage Expert] A subprocess test captures stdout and stderr separately, and the S11 help test asserts the derived list (86c8f91). -- CliRunner mixes the two streams, and tests must assert the derived contract.
  3. [Python Architect] Fix the guards that drifted (each guard that drifts silently stops guarding):
    • drift.py LOC budget on B (ac5eee6);
    • removal-baseline mutation anchor (dd2a54c);
    • Q1 optional diagnostics at the finalize owner (8a1de96).
  4. [Doc Writer] Update the PR body and the S11 CHANGELOG line (done). -- Reviewers see the real scope and behaviour.

Recommendation

Ready for maintainer review after #3996 and #3989 land. The full matrix runs on the release/0.37-train PR. Every finding is folded.

Folded in this run

Copilot signals reviewed

  • None: Copilot has not reviewed this PR (0 threads).

Regression-trap evidence (mutation-break gate)

  • tests/integration/test_policy_refusal_stderr_lifecycle.py::test_policy_refusals_and_approve_usage_error_write_stderr -- three mutations, each restored afterwards; the test FAILED every time:
    • the whole P13 change reverted;
    • only the update route reverted;
    • only the approve route reverted.
  • tests/spec_conformance/test_manifest_reqs.py::test_consumer_emits_project_compile_guidance_for_dependency_instructions -- removed the optional diagnostics read; the test FAILED (AttributeError); guard restored.

Lint contract

Check Result
uvx [email protected] check and format --check silent
scripts/lint-auth-signals.sh clean
scripts/lint-architecture-boundaries.sh exit 0
pylint R0801 10.00/10
file-length (2100) clean

CI

ci.yml runs only on PRs to main, so this PR's full matrix runs through the release/0.37-train PR (#4002). Exact-head targeted evidence at 8a1de96, all passed:

  • 1140 unit tests;
  • 58 lifecycle tests;
  • 902 architecture mutation tests.

Mergeability status

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#3992 8a1de96 ship_now 2 7 0 1 green (rollup) MERGEABLE CLEAN base #3989; matrix via #4002

Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

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
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
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
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
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
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
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
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
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
@danielmeppiel
Daniel Meppiel (danielmeppiel) changed the base branch from danielmeppiel-0-37-owner-hardening-b to main November 20, 2026 06:28
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 8160ec3 into main Nov 20, 2026
6 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-0-37-owner-hardening-c branch November 20, 2026 06:40
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
Takeshi Masukawa (takeaship) pushed a commit to takeaship/apm that referenced this pull request Nov 20, 2026
…0.37 owner changes

- test_mcp_install_flow: the plan-view stub gains bundle_owned, the field
  uninstall cleanup now reads (the integration twin of the unit fixture fix).
- test_fail_before_integrate_lifecycle: publish the fixtures on a generic git
  host so pre-install validation uses git ls-remote, which honors the
  insteadOf rewrite. A github.com ref was probed through the REST API and
  404'd under the frozen binary, so the test never reached the microsoft#3874 barrier.
  It also asserts that the failed run names notapkg.
- test_govern_core_contract: policy refusals print on stderr (microsoft#3967, microsoft#3992),
  so the pinned-constraint check is asserted there.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant