Skip to content

perf(install): one walk per tree in the local-plugin verifier (#5838 slice 5) - #5876

Draft
Daniel Meppiel (danielmeppiel) wants to merge 307 commits into
mainfrom
perf-5838-slice5
Draft

Daniel Meppiel (danielmeppiel) wants to merge 307 commits into
mainfrom
perf-5838-slice5

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Slice 5 of #5838: one walk per tree in the local-plugin verifier. Train 14: it merges signed #5870c0b71ac (merge-only), so its rows are measured on the tree it lands on.

  • scan_package_tree (utils/content_hash.py) walks a tree once without following links and reads each payload file once. It yields the payload set, each file's SHA-256, both package digests from the same bytes, and, for a strict scan, the link/special/hardlink/junction refusals.
  • verify_unchanged_local_plugin scans the source and the image once each: leaf listings [4, 3, 3] -> [1, 1, 1]. The image's raw part is checked file by file against the source's digests, replacing the image digest pass and the member re-hash. Tamper reasons are unchanged.
  • detect_package_type: exact pass-through dedupes. The verifier reuses its eligibility detection, and the resolver hands its detection to validate_apm_package, consumed before any normalization. A run-wide path memo is unsafe because normalization rewrites images in place.
  • The fix(skills): install and update remove bytecode caches from deployed skills #5837 bytecode prune reuses the copy's pre-walk instead of walking each deployed skill again. A recorded cache whose path now crosses a link below the skill root is skipped (AUD C2). A folder swapped to a link after the walk cannot route the removal outside it.
  • The tamper parametrize gains same-path raw byte edits of a skill file, a reference and plugin.json, which only the raw per-file compare catches (AUD C1).

cost: fewer syscalls everywhere, with nothing added; stat/lstat on install-50-skills are byte-equal to base. On macOS (same world, cbc2f38 -> head), sequential verify of 23 plugins: ~460 ms -> ~225 ms. Re-pass scandir 5,071 -> 3,578, stat 31,234 -> 26,546, hashed bytes -1.9 MB. install-50-skills scandir 704 -> 654.

Budget rows (Linux, composed tree cbc2f38 + #5870c0b71ac + #5876, scratch #5878)

Journey Counter Before After
install-g-23-plugins-repass scandir 4,052 2,691
install-g-23-plugins-repass stat 21,034 16,333
install-g-23-plugins-repass hash_objects 2,065 1,805
install-g-23-plugins-repass hashed_bytes 13,758,926 11,819,456
install-g-23-plugins-repass open_reads 2,682 2,394
install-50-skills scandir 704 654
install-g-50-skills scandir 704 599
install-g-50-skills-linked scandir 652 547
install-g-14-plugins scandir 3,279 2,884

Rows within their slack, the v0.39.2-anchored path rows, and older rows that drift independently of this PR are unchanged.

Validation

  • Mutants: drop the strict refusal -> the hardlink cell goes red. Delete the raw per-file compare -> 3/3 C1 cells go red. Drop the C2 link guard -> its cell goes red.
  • Local (local-test.sh, APM_BINARY_PATH=.venv/bin/apm): 8,292 passed across the bytecode lifecycle, arch policy, unit/integration and unit/install suites; 11,534 passed in the neighbour sweep; the row validator passes 18/18.
  • The CI-mirror lint is clean: ruff 0.15.12 check/format, R0801, auth signals, complexity ratchet, tm006, architecture linter.

Issue and approved scope

Issue: Refs #5838

Human scope-approval comment: #5838 (comment)

Does this PR complete the issue, or what remains? No; slice 5 of the floor plan.

Type of change

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

Testing

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

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

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

Agent assessment

  • Change confidence: high. Every refusal and tamper reason is pinned by existing and new cells, and mutants prove each guard. Rows were measured on the landing tree.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

…target lists

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- the pi target (registry profile, catalog capability, .pi detection, skills
  in .agents/skills, commands in .pi/prompts, PI_CODING_AGENT_DIR user root,
  read verbatim), trust hint, init picker from the registry, unsupported
  primitive warning once, governance_dirs for unmanaged_files;
- project cleanup removes only roots that do not signal their target, and only
  roots that do are created before a write (materializes_root); an auto_create
  target's merged hook config is created with its root;
- the trust hint also fires for project-only .apm content;
- harness conformance: every applicable Pi cell is required, HC-PLUGIN-01
  .dryrun cells are required with an exact-line oracle, a known_failing
  section records non-required cells with a strict KnownFailure witness,
  PI_CODING_AGENT_DIR is scrubbed in tests/conftest.py, Pi journey variants
  and Pi receipts;
- real-harness Pi 1.6.0 lane with the cross-spawn and minimatch overrides.

apm-spec-waiver: adds the pi target as registry data on the shared target layer; no change to an OpenAPM v0.1 requirement
apm-spec-waiver: policy default scan dirs now come from registry data; the existing list is byte-identical and pi adds .pi

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… the 'not qualified' label

- finalize_native_plugin no longer claims native registration: the Copilot
  owner reports its own outcome (a refused name or fingerprint says 'not
  activated'), and this line names only the targets without a native Agent
  Plugins host. A failing-before test covers a refused plugin with pi,copilot.
- The Pi status is qualified against Pi 1.6.0: the real-harness lane loads the
  deployed skills and prompt templates at both scopes (4/4) and every applicable
  Pi conformance cell is required (zero baseline), so the 'packed, not
  qualified' wording goes from the targets matrix and the changelog fragment.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The unsupported-primitive warning used one per-run bool shared by every
flagged target, so with copilot-cowork,pi a Cowork warning for one package
silenced Pi's warning for a later package. The guard is now a per-target
set on InstallContext; cowork_nonsupported_warned keeps its meaning for
existing callers.

HC-PLUGIN-03.overlap now requires exactly one plugin skill copy, so a
cell that drops the skill no longer passes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Return before touching ctx when no target is flagged, and lazily
initialise unsupported_warned_targets so partial install contexts
(SimpleNamespace stubs) keep working.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…gate read

known_failing (non-required cells new at the base) and required_known_failing
(the shrink-only ledger of required cells) never share a cell: the overlap
check refuses a required one, the ledger check an unrequired one. The
closed-issue gate (known_cells) reads both sections through load_ratchet.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… renders it

The install summary prints each warning as '  [!] <message>'
(DiagnosticCollector._render_warning_group), so the exact-line oracle
anchors on that indent. The pi cells pass with receipts; changing the
emitted text in target_warnings.py turns them red.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
)

Red-first: openclaw, grok-cloud and copilot-cowork listed in apm.yml
exit 2 on main even with their experimental flag enabled, while
--target accepts them. A disabled flag keeps the Unknown target error
for install and for compile.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ME; import budget

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ved workspace roots are unsupported

Refs #5754, #5746

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…5815)

The manifest token validator rejected every experimental target, so a
target that --target accepts with its flag enabled exited 2 when
listed in apm.yml. It now accepts an experimental target while its own
flag (the capability's experimental_flag, via is_enabled) is enabled;
a disabled one keeps the Unknown target error for every reader of the
declaration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…home spelling

A malformed file documented for two harnesses yields one coverage cell per
harness; the text view now reports the file once. Paths recorded under the
unresolved HOME spelling (a symlinked home) shorten to ~ like the rest.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ets: (#5815)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The user lockfile reads a row under a target root outside $HOME (for
example CLAUDE_CONFIG_DIR elsewhere) as an absolute value. Such a value is
now admitted when it lies inside the target's root as install resolves it:
the '..' check stays lexical and only the admitted root is resolved, never
the recorded value. An APM MCP entry the readers did not observe now names
the lockfile it was read from as its location path, never an empty path.

Refs #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The lens read-only guard reserves .replace( for Path.replace; check both
POSIX and Windows component forms instead.

Refs #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A registry server without a dependency overlay reaches the writers only
through _overlaid_server_infos; this pins that its mapping-form headers
are stored as list entries and render and judge like the list form.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- HC-LIST-01..10, 13, 14, 15 and 03.targets are live; 348 cells move to
  required (never baseline) with witnesses in test_list_conformance.py
  and test_list_readers_conformance.py. HC-LIST-11, 12 and 16 stay
  pending-witness.
- The witness helper is check_witness (it calls check_obligation).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
)

Manifest reconciliation classified declared targets with the stable-only
list, so an enabled experimental target removed from apm.yml stayed
deployed as supplemental. is_manifest_target in core/apm_yml.py is the
one answer for parsing and reconciliation. Adds lifecycle cells for that
and for install <pkg> --target openclaw while apm.yml also declares it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A recorded value with a .. component is refused even when it normalizes
back inside the target root, in POSIX and Windows spellings, and nothing
is looked up on it.

Refs #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Claude's docs: with CLAUDE_CONFIG_DIR set, 'The same applies to .claude.json,
which otherwise sits at ~/.claude.json' (claude-directory). APM's claude
adapter writes user MCP there too (resolve_user_claude_unresolved_path).

Refs #5746, #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…e first-run journey

- INV-L1 includes the project's own local deployed files, which list
  shows as APM items (spine mandatory replay green on every variant).
- imports.list is measured on an empty project with an empty HOME and a
  minimal environment, the journey the row was measured on.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…yed it (#5815)

With its flag enabled, an experimental target missing from apm.yml
targets: is reconciled like a stable one (retired by a plain install);
with its flag disabled, its deployment and lock rows are kept. Docs and
the changelog fragment state the behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
An APM MCP row for a runtime with no signal folder (opencode at user
scope) left the runtime undetected, so its documented MCP file was never
read and the entry never matched.

Refs #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ing it

A local skills-only plugin that resolve sealed this run skips link-resolver
discovery and skill planning when its deploy is proven current
(install/local_plugin_replay.py):
- P3/CG1: the deployed path set is derived from the seal by the planner's
  own mapping (skill_preflight.skill_destinations), under this run's
  targets and deployment plan.
- RP2/CG3: it must equal the lock row's set exactly; anything else takes
  the full integrate.
- RP1/P7: each deployed file is read (regular, unlinked) and must hash to
  the sealed member digest, so a rendered member, a user edit or a
  missing file takes the full path.
- P4: any policy in effect disables replay for the run; frozen, dry-run,
  --force and skill selections do too.
- P5: a skill directory another package of this run deploys is never
  replayed.
- RP5: the scanner judges the sealed bytes; any finding takes the full
  path, which reports it as today.
- The commit gate keeps every replayed plan in its input.
A replayed package records the converged full path's outcome: the same
deployed values, completed reintegration and "(files unchanged)" line,
and it writes nothing.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… oversize hint records

Test-only. Each cell fails on its mutant: following a directory symlink,
entering a universally skipped directory, accepting an int flag, and
dropping the entry cap.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- N1 (AUD): a replayed package hands the sealed digests it verified to
  the lockfile phase (ctx.package_verified_hashes), which records them
  instead of re-reading the deployed files. That saves one read per file
  and closes the window between verification and the lock write. Cell:
  bytes swapped into a deployed file after verification are never
  recorded (mutant: re-read -> red).
- The resolver never widens past the package root. Cell: a link into
  another plugin's root, which arrives in a later run, keeps the replayed
  render byte-equal to a fresh install.
- template.dependency_deployment_plan is the one plan builder for skill
  preflight and replay (R0801 on the composed tree).
- The changelog line is shortened.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- D1 (AUD): _holds computes both digests from one buffer: the raw sha256
  the seal binds, and content_hash_of_bytes, the CRLF->LF hash that
  compute_file_hash records and apm audit verifies (apm#1952). Cell: a
  CRLF SKILL.md replays, its lock hash equals compute_file_hash of the
  deployed file, and apm audit is clean (mutant: raw digest -> red).
- package_verified_hashes is write-once per dependency key.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
one single train t1204011 (1 links, mechanical merges only)

Stack-Base: 69f51bc

Queue-Base: 641743f
…run's seal

3d (#5866) built each verified package's hint list with
package_instruction_list. That rides integrate's discovery on the full
path, but parses every replayed package again (23 walks on the
re-pass). A replayed package now stages no fresh list. Finalize reads
its stored hint record under the content hash the seal verified this
run (K). A missing, corrupt or stale record walks the package (R), and
the record stays advisory (A, 3d P4).

Cells (3d's module, replay path): a kept record answers with no package
listed; a missing, corrupt or stale record walks and still prints the
hint; a forged record hides only the hint line, with deployed bytes
identical. Mutant (no replay branch): these cells and 3d's
test_the_install_hint_walks_no_recorded_package go red.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rifier

Slice 5 of #5838, step 1. verify_unchanged_local_plugin walks the source
and its image several times on every unchanged re-pass. Two cells, red on
the train-11 tip cbc2f38:
- each tree is walked once and each file read once: a leaf directory of
  the source, the image's raw payload and its .apm copy is listed
  [4, 3, 3] times today, target [1, 1, 1];
- the source is classified once (detect_package_type: 2 calls, target 1).

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…age_hashes

- install-g-23-plugins-repass rows re-measured on the train-11 tip
  cbc2f38 + #58707bed305 (scratch #5874, Linux Lifecycle Smoke run
  47241016951); budget = measured + max(1, 5%).
  - discover_primitives and planned_skill_files 23 -> 0
  - lstat 15233 -> 7877; stat 37297 -> 21034; scandir 5450 -> 4052
  - open_reads 4545 -> 2682; realpath 1204 -> 696
  - hashed_bytes 23.4 -> 13.8 MB; hash_objects 3365 -> 2065
  - lockfile_reads 24 -> 23; path_home 71 -> 49
- Closed-world owner rule install-deployment-package-hash-writer (AUD):
  only source_helpers.record_package_digests writes ctx.package_hashes,
  which keys the lock row and the replayed hint record. Registered in
  _EXPECTED_RULE_ID_TEXT, with one sorted MutationCase (a second writer
  -> red).

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Slice 5 of #5838, step 2.
- scan_package_tree (utils/content_hash.py) walks a tree once without
  following links and reads each payload file once, yielding the payload
  set, each file's SHA-256, the package digests (legacy and framed, from
  the same bytes) and, for a strict scan, the link/special/hardlink/
  junction refusals.
- verify_unchanged_local_plugin scans the source and the image once each
  (leaf listings [4, 3, 3] -> [1, 1, 1]); the image's raw part is checked
  file by file against the source's digests and the .apm/skills copies
  against theirs, replacing the image package-digest pass and the member
  re-hash. Tamper reasons are unchanged.
- detect_package_type: the verifier reuses its eligibility detection, and
  the resolver hands its detection to validate_apm_package (consumed
  before any normalization; nothing is written in between). On the
  23-plugin re-pass 161 -> 115 calls; a run-wide path memo was rejected
  because normalization rewrites images in place.
- The #5837 bytecode prune reuses the copy's pre-walk (tree_file_hashes
  collects the outermost __pycache__ folders) instead of walking each
  deployed skill again; uninstall keeps its own walk.

The format-precedence rule pins the resolver's classification as
`detected = detect_package_type(install_path)`.

cost: verify reads each file once per tree; no extra syscall anywhere.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
scan_package_tree tests exclusions on the relative-part tuple it already
holds and reads with a plain open instead of building PurePath/Path
objects per file. Same views and digests; on the 23-plugin re-pass the
verifier's 46 scans now cost about their open and scandir calls.

Sequential verify of the 23 plugins on macOS: cbc2f38 about 460 ms,
this head about 225 ms.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… per-file tamper

The prune of caches recorded by the copy walk skips any cache whose path
now crosses a link below the skill root, so a folder swapped to a link
after the walk cannot route the removal outside it. The tamper parametrize
gains same-path byte edits of a skill file, a reference and the plugin
manifest, which only the raw per-file compare catches.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… prune call

The prune call now passes the caches the copy walk recorded; the mutation
fragment follows it so the guard is still proven by removing the call.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ured on the train-14 tree

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

# Conflicts:
#	tests/unit/install/test_local_plugin_image.py
Re-measured on cbc2f38 + #5870c0b71ac + #5876 (scratch #5878, Linux
Lifecycle Smoke run 47256467695); budget = measured + max(1, 5%).
- install-g-23-plugins-repass: scandir 4052 -> 2691, stat 21034 -> 16333,
  hash_objects 2065 -> 1805, hashed_bytes 13758926 -> 11819456,
  open_reads 2682 -> 2394 (one walk per tree in the verifier).
- scandir on the skill journeys (the prune folds into the copy walk):
  install-50-skills 704 -> 654, install-g-50-skills 704 -> 599,
  install-g-50-skills-linked 652 -> 547, install-g-14-plugins 3279 -> 2884.
Rows within their slack, and the v0.39.2-anchored path rows, are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Dec 4, 2026
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as ready for review December 4, 2026 04:01
Copilot AI balanced review requested due to automatic review settings December 4, 2026 04:01

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

Overlapping invocations can reuse stale manifest seals, and the import-diet test can pass even when apm list crashes.

2 open issues
What changed in this PR

This PR advances #5838’s local-plugin install performance work by reducing repeated discovery, reads, and deployment planning. The supplied changes also include Pi support, read-only inventory groundwork, and supporting test and CI updates.

Changes:

  • Reuse verified plugin data, package discovery, and per-run caches.
  • Extend target integration and transition script listing to apm run --list.
  • Add regression coverage, architecture guards, documentation, and bounded CI setup steps.
File Description
tests/​utils/​source_tree_guard.py Reject imports from foreign checkouts.
tests/​unit/​test_source_tree_guard.py Test checkout-origin classification.
tests/​unit/​test_mcp_integrator_overlay.py Expect canonical header lists.
tests/​unit/​test_mcp_command.py Tighten hidden-option detection.
tests/​unit/​test_init_command_selection.py Cover expanded target picker.
tests/​unit/​test_github_mcp_auth_policy.py Check preserved header value types.
tests/​unit/​test_github_mcp_auth_policy_logic.py Verify normalized header overlays.
tests/​unit/​scripts/​test_architecture_runner.py Register new guard identifiers.
tests/​unit/​scripts/​test_architecture_removed_plugin_tombstone.py Test vendor-filename exception.
tests/​unit/​scripts/​test_architecture_harness_literals.py Cover registry literal allowances.
tests/​unit/​lens/​test_model.py Enforce lightweight model imports.
tests/​unit/​lens/​readers/​__init__.py Initialize reader-test package.
tests/​unit/​lens/​__init__.py Initialize lens-test package.
tests/​unit/​integration/​test_targets.py Cover Pi user roots.
tests/​unit/​integration/​test_targets_registry_completeness.py Include registry-declared adapters.
tests/​unit/​integration/​test_skill_bytecode_prune.py Test cache discovery and containment.
tests/​unit/​integration/​test_hook_shared_scope_claims.py Isolate command-memo coverage.
tests/​unit/​integration/​test_data_driven_dispatch.py Include Pi command bucket.
tests/​unit/​integration/​test_base_integrator.py Test shared-root cleanup boundaries.
tests/​unit/​integration/​test_antigravity_target.py Cover selected-target root creation.
tests/​unit/​install/​test_sources_selection.py Extend install-context stub.
tests/​unit/​install/​test_sources_materialisation.py Extend materialization-context stub.
tests/​unit/​install/​test_finalize_phase.py Track local file changes.
tests/​unit/​install/​phases/​test_finalize_compile_hint.py Update finalize-context fixture.
tests/​unit/​core/​test_target_resolution_v2.py Cover experimental manifest targets.
tests/​unit/​core/​test_target_catalog.py Characterize Pi capabilities.
tests/​unit/​core/​test_target_catalog_io.py Update valid-target expectations.
tests/​unit/​core/​test_scope.py Include Pi scope support.
tests/​unit/​core/​test_runnable_prompts.py Update script-listing hint assertion.
tests/​unit/​core/​test_remediation_w4_phases_targets_catalog.py Document sealed-image refusal coverage.
tests/​unit/​core/​test_remediation_commands_catalog.py Record inventory remediation coverage.
tests/​unit/​core/​test_output_mode.py Isolate update-notice environment.
tests/​unit/​copilot_plugins/​test_capability.py Test Pi native-plugin refusal.
tests/​unit/​adapters/​test_mcp_remote_transport_shapes.py Cover dynamic adapter shapes.
tests/​quality/​test_known_cells_cite_open_issues.py Validate forward-law issue tracking.
tests/​quality/​test_ci_topology.py Cache repeated lifecycle collection.
tests/​quality/​lifecycle_obligations.json Add Pi target obligations.
tests/​quality/​known_cell_issue_states.json Extend known-issue snapshot.
tests/​quality/​generated_obligations.json Record script-listing golden obligation.
tests/​lifecycle/​test_marketplace_registry_reads.py Assert actual marketplace table rows.
tests/​lifecycle/​machines/​_spine_kit.py Observe inventory against reference state.
tests/​lifecycle/​list_contract/​fixtures/​no-match.json Define empty inventory fixture.
tests/​lifecycle/​list_contract/​fixtures/​error.json Define JSON usage-error fixture.
tests/​lifecycle/​journeys/​index.yaml Update script-listing journey index.
tests/​lifecycle/​journeys/​goldens/​J13/​01.txt Capture script-listing output.
tests/​lifecycle/​journeys/​consumer/​J13-run-scripts.yaml Exercise apm run --list.
tests/​lifecycle/​journeys/​consumer/​J10-global-setup.yaml Add Pi global-install variant.
tests/​lifecycle/​journeys/​consumer/​J09-switch-harness.yaml Add Pi target-switch variant.
tests/​lifecycle/​journeys/​consumer/​J08-uninstall-cleanup.yaml Add Pi cleanup variant.
tests/​lifecycle/​journeys/​consumer/​J03-ci-gate.yaml Add Pi CI journey variant.
tests/​lifecycle/​journeys/​consumer/​J02-team-onboarding.yaml Add Pi onboarding variant.
tests/​lifecycle/​journeys/​consumer/​J01-first-run.yaml Add Pi first-run variant.
tests/​lifecycle/​driver.py Support global inventory invocation.
tests/​integration/​test_verdict_record.py Reset cached build identity between cases.
tests/​integration/​test_remaining_modules_coverage.py Update install-context mocks.
tests/​integration/​test_mcp_integrator_install_flow.py Expect canonical header overlays.
tests/​integration/​test_local_bundle_hooks_lifecycle.py Clarify inventory coverage comment.
tests/​integration/​test_list_import_diet.py Check inventory import budget.
tests/​integration/​test_install_sources_classification.py Update source-context mock.
tests/​integration/​test_install_services_orchestration.py Expect one warning channel.
tests/​integration/​test_failure_next_step_lifecycle.py Verify script-listing remediation.
tests/​integration/​test_copilot_root_mcp_json_lifecycle.py Include Pi in all-target expectations.
tests/​integration/​test_architecture_skill_preflight.py Update preflight mutation anchor.
tests/​integration/​test_architecture_pack_lockfile_read.py Include lockfile memo owner.
tests/​integration/​test_architecture_outcome_guards.py Verify unchanged-plugin diagnostics.
tests/​integration/​test_architecture_lockfile_write_authority.py Update reader guard expectation.
tests/​integration/​test_architecture_hook_package_admission.py Update detection mutation anchor.
tests/​fixtures/​perf/​count_budgets.py Add plugin journeys and counters.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.text_json_agree.json Define text/JSON agreement law.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.scripts_transition.json Define script-listing migration law.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.read_only.json Define read-only inventory law.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.nondisclosure.json Define output nondisclosure law.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.json_contract.json Define inventory JSON contract.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.hostile_input.json Define hostile-input handling law.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.honesty_vocabulary.json Define neutral status vocabulary.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.extra_files.json Define extra-file drift behavior.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.exit_contract.json Define inventory exit codes.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.confinement.json Define filesystem confinement law.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.ci_isolation.json Define CI profile isolation.
tests/​fixtures/​lifecycle_bug_ledger/​property_catalog/​list.audit_is_the_gate.json Distinguish inventory from audit enforcement.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​5830.json Record legacy-layout regression witnesses.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​5773.json Extend MCP refusal witnesses.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​2908.json Record Pi lifecycle witnesses.
tests/​conftest.py Guard source imports and scrub Pi roots.
src/​apm_cli/​utils/​yaml_io.py Read sealed YAML bytes.
src/​apm_cli/​utils/​atomic_io.py Copy already-verified bytes atomically.
src/​apm_cli/​primitives/​discovery.py Share one discovery inventory.
src/​apm_cli/​policy/​unmanaged_scan.py Derive governance roots from registry.
src/​apm_cli/​policy/​__init__.py Load policy exports lazily.
src/​apm_cli/​models/​validation.py Reuse detection and sealed manifests.
src/​apm_cli/​models/​manifest_io.py Validate sealed manifest text.
src/​apm_cli/​lens/​ci_scope.py Define inventory CI detection.
src/​apm_cli/​lens/​__init__.py Introduce lightweight observation package.
src/​apm_cli/​integration/​target_locators.py Extract target locator delegates.
src/​apm_cli/​integration/​skill_support.py Collect caches during existing walk.
src/​apm_cli/​integration/​skill_integrator.py Reuse recorded caches for pruning.
src/​apm_cli/​integration/​prompt_integrator.py Defer unused link-resolver setup.
src/​apm_cli/​integration/​mcp_user_scope_runtimes.py Include dynamically declared runtimes.
src/​apm_cli/​integration/​mcp_integrator_install.py Normalize headers and emit trust hints.
src/​apm_cli/​integration/​instruction_integrator.py Initialize resolver only when needed.
src/​apm_cli/​integration/​hook_integrator.py Honor selected targets' automatic roots.
src/​apm_cli/​integration/​agent_integrator.py Avoid resolver setup without agents.
src/​apm_cli/​install/​verdict_record.py Cache process build identity.
src/​apm_cli/​install/​template.py Share dependency deployment planning.
src/​apm_cli/​install/​source_helpers.py Use manifest owner and reuse digests.
src/​apm_cli/​install/​services.py Remove redundant warning logger argument.
src/​apm_cli/​install/​service.py Reconcile frozen MCP overlay refusals.
src/​apm_cli/​install/​run_memos.py Centralize install memo resets.
src/​apm_cli/​install/​pipeline.py Reset run caches through shared helper.
src/​apm_cli/​install/​phases/​targets.py Respect root-materialization capability.
src/​apm_cli/​install/​phases/​resolve.py Preserve reusable local plugin images.
src/​apm_cli/​install/​phases/​lockfile.py Reuse verified deployment hashes.
src/​apm_cli/​install/​phases/​lockfile_deploy_records.py Stage instruction-hint records.
src/​apm_cli/​install/​phases/​cleanup.py Forget removed plugin-image stamps.
src/​apm_cli/​install/​native_plugin_admission.py Report unsupported native-plugin targets.
src/​apm_cli/​install/​helpers/​reconciliation_scope.py Recognize enabled experimental targets.
src/​apm_cli/​install/​context.py Track replay, hints, and warning state.
src/​apm_cli/​deps/​registry/​config_loader.py Memoize unchanged registry parsing.
src/​apm_cli/​deps/​registry/​__init__.py Load registry exports lazily.
src/​apm_cli/​deps/​lockfile_write_authority.py Invalidate reads after lockfile writes.
src/​apm_cli/​deps/​file_provenance.py Expose shared file classification.
src/​apm_cli/​deps/​apm_resolver.py Pass detection directly to validation.
src/​apm_cli/​core/​target_catalog.py Register Pi capabilities and ordering.
src/​apm_cli/​core/​script_runner.py Recommend apm run --list.
src/​apm_cli/​core/​remediation.py Add inventory and sealed-image advice.
src/​apm_cli/​core/​invocation_memo.py Reset seals at invocation boundaries.
src/​apm_cli/​core/​deployment_ledger.py Reuse root-containment resolution.
src/​apm_cli/​core/​apm_yml.py Accept enabled experimental targets.
src/​apm_cli/​commands/​uninstall/​engine.py Remove plugin-image stamps on uninstall.
src/​apm_cli/​commands/​init.py Derive picker order from catalog.
src/​apm_cli/​commands/​deps/​__init__.py Resolve dependency commands lazily.
src/​apm_cli/​commands/​_helpers.py Defer installed-package helper imports.
src/​apm_cli/​commands/​__init__.py Remove eager command imports.
src/​apm_cli/​cli.py Update inventory dispatch and offline handling.
src/​apm_cli/​bundle/​__init__.py Load bundle exports lazily.
src/​apm_cli/​adapters/​client/​pi.py Add registry-bound Pi MCP adapter.
src/​apm_cli/​adapters/​client/​gemini.py Apply registry-based root creation.
src/​apm_cli/​adapters/​client/​_remote_shapes.py Resolve dynamic transport capabilities.
src/​apm_cli/​_lazy_exports.py Provide shared lazy-export helpers.
scripts/​real_harness/​npm/​pi-1.6.0/​README.md Explain dependency override pins.
scripts/​real_harness/​npm/​pi-1.6.0/​package.json Pin Pi harness dependencies.
scripts/​real_harness/​npm/​pi-1.6.0/​.npmrc Select public npm registry.
scripts/​real_harness/​expected.json Add Pi loading expectations.
scripts/​ci-apt-install.sh Bound apt attempts with timeouts.
scripts/​architecture_linter/​groups/​registry_delegation.py Register inventory architecture rules.
scripts/​architecture_linter/​checks/​marketplace_catalog_and_contract.py Update package-detection guard anchor.
scripts/​architecture_linter/​checks/​marketplace_bundle_and_audit.py Allow documented vendor record filename.
scripts/​architecture_linter/​checks/​install_skills_root_derivation.py Remove legacy derivation exception.
scripts/​architecture_linter/​checks/​install_manifest_snapshot.py Require canonical manifest loading.
scripts/​architecture_linter/​checks/​install_deployment_analyzers.py Register manifest, hash, and cache guards.
scripts/​architecture_linter/​checks/​install_cleanup_target_roots.py Update bytecode cleanup owner.
scripts/​architecture_linter/​checks/​contracts_lockfile_write_authority.py Track extracted document reader.
scripts/​architecture_linter/​checks/​contracts_lockfile_regular_read.py Update regular-reader delegation route.
scripts/​architecture_linter/​checks/​contracts_lockfile_generator.py Update version-warning delegation route.
README.md Add Pi to supported harnesses.
packages/​apm-guide/​.apm/​skills/​apm-usage/​workflow.md Explain experimental manifest targets.
packages/​apm-guide/​.apm/​skills/​apm-usage/​dependencies.md Document Pi targets and environment values.
docs/​src/​content/​docs/​troubleshooting/​index.md Explain inventory versus package listing.
docs/​src/​content/​docs/​troubleshooting/​common-errors.md Update script-discovery remediation.
docs/​src/​content/​docs/​reference/​cli/​targets.md Document Pi auto-detection.
docs/​src/​content/​docs/​reference/​cli/​preview.md Link to new script-listing command.
docs/​src/​content/​docs/​integrations/​canvas.md Clarify canvas inventory visibility.
docs/​src/​content/​docs/​consumer/​install-packages.md Update script-listing reference.
docs/​src/​content/​docs/​consumer/​choose-harnesses.mdx Document Pi roots and trust requirements.
CONFORMANCE.md Update target-detection coverage count.
CONFORMANCE.json Include Pi conformance witness.
changelog.d/​5876.fixed.md Note single-walk verification improvement.
changelog.d/​5870.changed.md Note verified deployment replay.
changelog.d/​5866.fixed.md Note stored compile-hint records.
changelog.d/​5858.fixed.md Note instruction-only hint discovery.
changelog.d/​5852.fixed.md Note copy-on-write plugin copying.
changelog.d/​5850.fixed.md Note image-reuse path safeguards.
changelog.d/​5849.changed.md Note unchanged plugin-image reuse.
changelog.d/​5843.fixed.md Note reduced home-path lookups.
changelog.d/​5842.fixed.md Note deferred link-resolver construction.
changelog.d/​5841.fixed.md Note shared walks and read caches.
changelog.d/​5840.changed.md Note reduced install imports.
changelog.d/​5839.fixed.md Note normalization and scanner improvements.
changelog.d/​5837.fixed.md Note deployed bytecode cleanup.
changelog.d/​5836.fixed.md Note legacy skill-copy retirement.
changelog.d/​5816.fixed.md Note experimental manifest-target support.
changelog.d/​5814.fixed.md Note MCP header and frozen fixes.
changelog.d/​5812.breaking-changes-and-upgrade-notes.md Explain script-listing migration.
changelog.d/​5812.added.md Announce offline agent inventory.
changelog.d/​5806.added.md Announce apm run --list.
changelog.d/​5785.added.md Announce Pi MCP support.
changelog.d/​5771.fixed.md Note cleanup and picker improvements.
changelog.d/​5771.added.md Announce Pi target support.
build/​apm.spec Bundle dynamically loaded client adapters.
apm.lock.yaml Refresh release-acceptance script hashes.
.github/​workflows/​merge-train.yml Run inventory quality contracts.
.github/​workflows/​lifecycle-security.yml Bound shell-runtime installation.
.github/​workflows/​lifecycle-journeys.yml Bound shell-runtime installation.
.github/​workflows/​ci.yml Add inventory guards and setup timeouts.
.github/​workflows/​ci-integration.yml Bound apt setup in integration lanes.
.apm/​skills/​release-acceptance/​scripts/​world.py Isolate Pi user configuration.
.apm/​architecture/​owners/​hooks-integrations.json Register MCP encoding and locator ownership.
.apm/​architecture/​owners/​core-runtime.json Register lazy exports and inventory ownership.
.apm/​architecture/​owners/​contracts-tooling.json Extend lockfile ownership to read memo.
.agents/​skills/​release-acceptance/​scripts/​world.py Sync Pi environment isolation.

Review effort: Balanced

Comment on lines +49 to +50
if sealed_files is not None:
sealed_files.reset()
"import sys\n"
"from click.testing import CliRunner\n"
"from apm_cli.cli import cli\n"
"CliRunner().invoke(cli, ['list', '-f', 'json'])\n"
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as draft December 4, 2026 04:10
…adable-dir refusals

Three tamper cases close surviving mutants of scan_package_tree:
- a member replaced by a link to a copy of its own bytes (stat follows links);
- a link inside __pycache__ (the strict scan skips excluded directories);
- an unlistable directory (an OSError on scandir is not refused).
Each passes at head and on cbc2f38; each fails under its mutant.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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

Development

Successfully merging this pull request may close these issues.

2 participants