Repository navigation
perf(install): decide the install -g hint from per-package instruction records - #5866
Open
Daniel Meppiel (danielmeppiel) wants to merge 182 commits into
Open
Daniel Meppiel (danielmeppiel) wants to merge 182 commits into
Daniel Meppiel (danielmeppiel) wants to merge 182 commits into
Conversation
…t collected fails A required cell in tests/quality/harness_conformance.json must earn a passing receipt. Until now ReceiptWitnessPlugin only checked witnesses that passed, so a skipped witness left its required cell unproven without failing anything. - ReceiptWitnessPlugin fails a skipped or xfailed witness of a required cell (setup or call phase), naming every cell and the skip reason. A cell that no longer applies leaves through the contract (applies()), not a run-time skip. Skips of nodes that witness no required cell stay skips. - harness_ratchet.uncollected_witnesses(): every required witness node must be collected (pytest --collect-only over the witness modules), so a renamed or unparametrized witness is refused. - Mutation tests: a required witness that skips fails the gate (pytester), a skip outside required cells stays a skip, and a dropped node is named as not collected. Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…easured; plain skips and untracked xfails fail Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…quired cells A required cell's witness passes with a receipt, or is a strict KnownFailure listed in required_known_failing whose tracking equals the ledger issue, whose issue is open (closed-issue gate), and whose failure matches. Any other xfail, a skip in any phase, an uncollected node or a strict XPASS fails. The ledger only shrinks against the merge-base; a base without the section compares against the frozen 8-cell #5797 set. Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds src/apm_cli/lens/: model.py, the stdlib-only interface contract of the apm list inventory (frozen dataclasses Source, Evidence, HarnessRef, Location, Item, CoverageCell, NotVisible, Inventory), and verdict.py, the only evidence -> state judgment (state, folder_content, item_state). Registers the lens-observation owner with guard registry-delegation-lens-observation: model.py imports only the standard library, only verdict.py writes an APM health state, and no lens module writes, deletes, spawns or opens a socket. One mutation case proves it. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
J13 step 1 now runs 'apm run --list' against an O1 golden captured from today's 'apm list' (the 0.39 scripts table), and asserts it runs nothing. Step 4's diagnose advice moves to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
'apm run --list' prints the 'apm list' scripts table or the No scripts found panel byte-for-byte, exits 0 and runs nothing, so bare 'apm list' can switch to the agent-config inventory. The script-not-found hint and the docs now point to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds the test-only R0 layer of the apm list test plan: structured oracles, pending-witness promises, laws, schema, mutations and static guards. No committed cells: every HC-LIST promise stays pending-witness, so the harness ratchet is untouched. - oracles.Evidence gains json_equal and rows_equal (parsed path plus expected value), checked inside check_obligation; a mismatch or an unparseable output fails with no receipt. - tests/lifecycle/list_oracle.py is the one parser of apm list output (schema-validated JSON views; text rows by header column spans; summary and footer by exact clause and line). - HC-LIST-01..15 and HC-LIST-03.targets appended to harness_contract.py as pending-witness; HC-LIST-07 carries scopes=(user,) with a citation. - P-LAW-list.* laws in the property catalog as forward laws citing #5745; the ledger guard accepts a law only when bug-referenced or forward with a cited issue. - JSON Schema plus 4 outcome fixtures; S137 AST guard; C6 clone proof; tests/lifecycle/mutations/list.yaml. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lens/apm_layers.py reads one scope's lockfile once and turns its deployment ledger rows into logical items: kind and name come from the target layout, rows for one physical path are deduped (targets kept apart), and projections of one package item collapse into one item with several locations. Each unique physical file is classified once through deps/file_provenance.classify_file (made public at its owner). Folder items get a bounded recursive name walk without link following: a file outside the record makes the folder modified, a partial walk leaves it unverifiable. Recorded values that escape their root are rejected lexically, before any filesystem call. 'orphaned' is not produced in 0.40 (declared is 'yes' for every locked owner). Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
'apm run --list' no longer imports from list_cmd, whose scripts body goes away when bare 'apm list' switches to the inventory. The renderer lives in run.py (a new module would need an architecture owner); output stays byte-identical. The list_cmd unit cases are ported to test_run_list.py. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lens/inventory.build(ctx) reads each requested scope's APM layer once, asks the reader package for native observations (an empty scan until the readers land) and joins them: a native observation at or inside a path an APM item lists is dropped, so one physical path is one location; a scope whose lockfile is unreadable turns its native items into not-checked. APM locations take HARNESSES from the reader records and keep ledger targets apart. --target and NAME selection run before states are summarised, and under exactly one --target same-name copies get the documented ORDER (higher/lower with order_rank, coexist, or unknown; a missing copy is never ranked). The context carries the keys the renderer needs. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…es detection The build input key for the --target selection is 'harnesses' (the target vocabulary guard rejects a raw targets read in src). build() resolves the detected harnesses (signal folders at the project and home roots, apm.yml targets and ledger targets, kept to harness reader records) and passes the selection and the detected set to the readers' scan. ORDER under one target now uses the readers' tier_of and the record's ranked/coexist/unknown rule: copies in one tier tie, and a copy whose tier cannot be read is unknown. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MCP ledger rows (uri locators under target mcp, one per runtime) become MCP claims instead of file items. The inventory joins each claim to the readers' observation of that server name for that runtime at that scope: the location takes the observed config path and entry pointer, the observation is claimed (not listed again as unrecorded), and the entry is compared with the recorded fingerprint through the ownership owner's mcp_native_hash, imported only when an entry is compared. Entry values are read only for that comparison and never returned; the item carries the readers' keys-only shape. An entry not observed is unverifiable. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mark test_run_list.py as component (it writes apm.yml and drives Click), and keep the docs truthful while bare 'apm list' still lists scripts. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Run tests/quality/test_list_{conformance_guards,oracle}.py in the
ratchet contracts job (ci.yml and merge-train.yml, kept identical).
- P-LAW-list.* forward laws are phase 0: no spine transition covers them
until the list observation invariant lands.
- list_oracle: the command kind and Commands section; an empty inventory
summary has no clause; rows() refuses -v detail lines, and details()
attaches them to the row above.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
User-scope APM items now say they are declared in the $APM_HOME manifest, shown as ~/.apm/apm.yml when it sits under the home root; project items keep apm.yml. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The oracle unit test credited a pending-witness cell id; use a neutral cell id so the pending-witness leak guard stays clean. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Under -g the project scope has no root, so context.roots values may be null. Reader order rules name the item kind (skill), unlike sources (skills); HC-LIST-10 now applies where a skill rule is recorded. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…paths
- Item names drop any extension the registry gives the primitive, so one
instruction deployed as name.instructions.md and name.md is one item.
- ORDER ranks each copy by the tier of its best location the target reads;
only copies sharing a best tier tie.
- Recorded paths that map to no primitive layout, and paths not confined to
their root, are coverage cells, never a made-up 'file' item; 'canvas'
joins the kind vocabulary.
- User-scope rows under $HOME are matched under the target root install
resolves (root variables such as CLAUDE_CONFIG_DIR honoured).
- Path dedupe and the ancestor manifest hint are separator-agnostic
('../apm.yml' on every OS).
- The folder walk cap is a read_layer parameter, so tests pass it instead
of patching the owner.
Refs #5754
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Link ownership through path_security.user_owned_link, native activation keys from native_plugins.settings, no target-vocabulary reads, records.py counted as registry data by the harness-literal guard, and a vendor file name is not the removed plugin-lifecycle symbol. Refs #5746, #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…olders by descriptor Folds AUD F1-F3: the managed-settings ownership gate is re-checked on fstat, subfolders below a root are opened O_NOFOLLOW and listed by descriptor, and the tombstone exemption applies only to the quoted installed_plugins.json name. Refs #5746, #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… evidence not_visible[].os and record OS rows use linux, macos and windows (sys.platform mapped once). A plugin activation entry in a settings file now sets configured and evidence_source on the install record with the same plugin id (narrowest scope, then the file read last); an entry with no install record is one plugin item with present no. Install records carry plugin@marketplace ids. Tests are Windows-safe (bytes for frontmatter, absolute tmp system paths). Refs #5746, #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ine bypass Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…overy (red-first) The calls table now counts discover_primitives at its owner module, so the finalize hint's full discovery of the user apm_modules shows: 15 discoveries for 14 local plugins. Parity cells pin the cheap presence check against discover_global_instructions over global, scoped-only, same-name and unparseable worlds; the hint cells patch the new seam. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…very After install -g, finalize discovered and parsed every primitive of every installed package to print one hint line. It now parses only instruction files, in discovery's order with its first-wins naming, and stops at the first global one. The hint text and trigger are unchanged. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Seals exist only after install imports utils.sealed_files, so the manifest and receipt readers ask through yaml_io.sealed_bytes, which returns None when the registry was never loaded, and invocation_scope resets it only when present. Read-only commands such as apm list no longer import the registry (imports.list stays 111 on the train-7 tree). verdict_record stays within its LOC budget once composed. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…it module The parity cells imported the user_root_context owner into a component module that patches that owner's symbols, tripping the AQ003/AQ004 quality ratchets. They now live in their own unit module, which patches nothing. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Re-measured install-g-14-plugins and install-g-23-plugins-repass on the train-7 tip 23a1586 with this change (scratch #5859, Linux Lifecycle Smoke run 47195071297); budget = measured + max(1, 5%). - Re-pass: copytree and normalize 23 -> 0, files_written 602 -> 58, lstat, stat, scandir, realpath and open_reads tightened. - Re-pass hashed_bytes and hash_objects raised for AUD's verification (sealed members + F1 dest digest); the redundant share is removed in slice 5 (c8ec3603 plan section 20). - Fresh lstat_calls raised for the source-tree stamp fingerprint (one lstat per apm_cli file, once per process; frozen and wheel installs stat once). At 97d4782 the same tree measured 183,956,207 / 586,664,850 hashed bytes and 24,100 / 74,006 open reads: red against these rows. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
On install -g, finalize walks the whole user apm_modules to decide one hint line. The calls table now counts that walk (_parsed_instructions): 1 on both plugin journeys, expected 0. The parity cells check the hint against full discovery from per-package records, with one record missing, and over stray, skip-dir and nested-repository worlds. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…n records Each user-scope package verified this run gets an advisory hint record in the deploy store, keyed by its content hash: its instructions as [[name, is_global], ...] in discovery order. Finalize merges the records in discovery's walk order (first name wins) and walks only what has no record: stray files outside packages, or a package without a valid record. The hint is identical; the records decide nothing else. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…forged-record cells Packages kept from the previous lockfile get their hint record looked up like any other locked package. A forged record changes only the hint line; the deployed tree stays byte-identical. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…isting a package The live staging tree at the apm_modules root is scratch, not installed content, so a global instruction inside a backup no longer raises the hint. A recorded package root contributes its record after an lstat of .git, without being listed. The no-record path uses the same walk. 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>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 3, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
December 3, 2026 23:20
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Sealed-cache reads can hang on replacement FIFOs, and path memoization can conflate distinct containment roots, producing incorrect resolutions.
5 open issues
What changed in this PR
This PR advances #5838 by using per-package instruction records to decide the apm install -g compile hint without rescanning recorded packages. The supplied changes also include stacked install optimizations and the read-only apm list inventory work.
Changes:
- Stage and reuse advisory instruction records, with malformed-record and deployment-isolation tests.
- Reduce repeated discovery, parsing, imports and local-plugin copying.
- Add inventory contracts, architecture guards, lifecycle coverage and updated CLI documentation.
| File | Description |
|---|---|
| tests/unit/scripts/test_architecture_runner.py | Registers new guard expectations. |
| tests/unit/scripts/test_architecture_removed_plugin_tombstone.py | Tests removed-symbol enforcement. |
| tests/unit/scripts/test_architecture_harness_literals.py | Allows harness reader registry data. |
| tests/unit/lens/test_verdict.py | Tests inventory state judgments. |
| tests/unit/lens/test_model.py | Checks dependency-free model imports. |
| tests/unit/lens/readers/__init__.py | Initializes reader tests. |
| tests/unit/lens/__init__.py | Initializes inventory tests. |
| tests/unit/integration/test_hook_shared_scope_claims.py | Isolates lockfile memo counting. |
| tests/unit/install/test_sources_selection.py | Updates install context mocks. |
| tests/unit/install/test_sources_materialisation.py | Updates materialization mocks. |
| tests/unit/core/test_runnable_prompts.py | Updates script-listing advice assertions. |
| tests/unit/core/test_remediation_w4_phases_targets_catalog.py | Documents sealed-image refusal coverage. |
| tests/unit/core/test_remediation_commands_catalog.py | Records inventory remediation coverage. |
| tests/unit/core/test_output_mode.py | Enables update notices in tests. |
| tests/unit/cache/test_instruction_hint_record.py | Tests hint record validation. |
| tests/quality/test_lifecycle_bug_ledger.py | Validates forward lifecycle laws. |
| tests/quality/test_known_cells_cite_open_issues.py | Tests forward-law issue tracking. |
| tests/quality/promise-catalog.json | Registers inventory and performance promises. |
| tests/quality/known_cell_issues.py | Tracks forward laws and harness failures. |
| tests/quality/known_cell_issue_states.json | Adds tracked issue states. |
| tests/quality/generated_obligations.json | Adds script-listing golden obligation. |
| tests/lifecycle/oracles.py | Adds parsed inventory assertions. |
| tests/lifecycle/machines/_spine_kit.py | Checks inventory against lifecycle state. |
| tests/lifecycle/list_contract/fixtures/no-match.json | Defines empty inventory output. |
| tests/lifecycle/list_contract/fixtures/error.json | Defines usage-error output. |
| tests/lifecycle/list_contract/fixtures/drift-unknown.json | Defines drift and uncertainty output. |
| tests/lifecycle/list_contract/fixtures/clean.json | Defines clean inventory output. |
| tests/lifecycle/journeys/index.yaml | Updates script-listing journey. |
| tests/lifecycle/journeys/goldens/J13/01.txt | Captures script-listing output. |
| tests/lifecycle/journeys/consumer/J13-run-scripts.yaml | Exercises apm run --list. |
| tests/lifecycle/driver.py | Supports global inventory invocation. |
| tests/integration/test_verdict_record.py | Resets build identity between cases. |
| tests/integration/test_remaining_modules_coverage.py | Updates install context mocks. |
| tests/integration/test_local_bundle_hooks_lifecycle.py | Clarifies inventory coverage comment. |
| tests/integration/test_list_import_diet.py | Checks lightweight inventory imports. |
| tests/integration/test_install_sources_classification.py | Updates source classification mocks. |
| tests/integration/test_install_hint_records.py | Tests advisory-only record effects. |
| tests/integration/test_failure_next_step_lifecycle.py | Verifies runnable script-listing advice. |
| tests/integration/test_architecture_pack_lockfile_read.py | Includes lockfile memo ownership. |
| tests/integration/test_architecture_owner_rule_mutations.py | Adds owner guard mutations. |
| tests/integration/test_architecture_outcome_guards.py | Checks repeat-install diagnostics. |
| tests/integration/test_architecture_lockfile_write_authority.py | Updates read-route expectation. |
| tests/fixtures/perf/plugins.py | Builds deterministic multi-plugin fixtures. |
| tests/fixtures/perf/counters.py | Adds function-call counters. |
| tests/fixtures/perf/count_budgets.py | Adds plugin journeys and counters. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.text_json_agree.json | Defines text/JSON parity law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.scripts_transition.json | Defines script-listing transition law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.read_only.json | Defines read-only inventory law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.nondisclosure.json | Defines output nondisclosure law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.json_contract.json | Defines JSON output law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.hostile_input.json | Defines hostile-input handling law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.honesty_vocabulary.json | Defines inventory vocabulary constraints. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.extra_files.json | Defines extra-file detection law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.exit_contract.json | Defines inventory exit codes. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.confinement.json | Defines filesystem confinement law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.ci_isolation.json | Defines CI scope isolation. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.audit_is_the_gate.json | Separates inventory from audit enforcement. |
| tests/fixtures/lifecycle_bug_ledger/bugs/5830.json | Records legacy skill cleanup regression. |
| src/apm_cli/utils/yaml_io.py | Reads sealed YAML bytes. |
| src/apm_cli/utils/sealed_files.py | Stores invocation-scoped verified bytes. |
| src/apm_cli/utils/realpath.py | Reuses directory proofs and roots. |
| src/apm_cli/utils/path_security.py | Reduces repeated containment work. |
| src/apm_cli/utils/content_hash.py | Exposes hashed payload paths. |
| src/apm_cli/utils/atomic_io.py | Copies preverified bytes atomically. |
| src/apm_cli/primitives/discovery.py | Shares one discovery inventory. |
| src/apm_cli/policy/__init__.py | Lazily exports policy APIs. |
| src/apm_cli/models/validation.py | Reuses sealed normalized manifests. |
| src/apm_cli/models/manifest_io.py | Reads verified manifest bytes. |
| src/apm_cli/marketplace/__init__.py | Lazily exports marketplace APIs. |
| src/apm_cli/lens/verdict.py | Centralizes inventory state judgments. |
| src/apm_cli/lens/ci_scope.py | Defines inventory CI detection. |
| src/apm_cli/lens/__init__.py | Introduces read-only inventory package. |
| src/apm_cli/integration/write_seam.py | Verifies sealed members before copying. |
| src/apm_cli/integration/prompt_integrator.py | Defers unnecessary link resolver initialization. |
| src/apm_cli/integration/instruction_integrator.py | Defers unnecessary link resolver initialization. |
| src/apm_cli/integration/cleanup.py | Uses rendered evidence for legacy cleanup. |
| src/apm_cli/integration/base_integrator.py | Uses sealed digests for unchanged files. |
| src/apm_cli/integration/agent_integrator.py | Defers unnecessary link resolver initialization. |
| src/apm_cli/integration/__init__.py | Lazily exports integrator APIs. |
| src/apm_cli/install/verdict_record.py | Memoizes build identity. |
| src/apm_cli/install/sources.py | Reuses resolved local-plugin images. |
| src/apm_cli/install/source_helpers.py | Uses sealed manifest loading. |
| src/apm_cli/install/run_memos.py | Centralizes install memo resets. |
| src/apm_cli/install/pipeline.py | Resets memos at pipeline start. |
| src/apm_cli/install/phases/resolve.py | Records and reuses plugin images. |
| src/apm_cli/install/phases/lockfile.py | Stages instruction hint records. |
| src/apm_cli/install/phases/lockfile_deploy_records.py | Builds per-package hint records. |
| src/apm_cli/install/phases/local_content.py | Coordinates plugin image reuse. |
| src/apm_cli/install/phases/finalize.py | Consults records for compile hints. |
| src/apm_cli/install/phases/cleanup.py | Invalidates removed image stamps. |
| src/apm_cli/install/context.py | Carries image and hint state. |
| src/apm_cli/deps/registry/config_loader.py | Memoizes unchanged registry parsing. |
| src/apm_cli/deps/registry/__init__.py | Lazily exports registry APIs. |
| src/apm_cli/deps/lockfile.py | Reuses parsed lockfile snapshots. |
| src/apm_cli/deps/lockfile_write_authority.py | Invalidates snapshots after mutations. |
| src/apm_cli/deps/lockfile_read_memo.py | Stores independent lockfile snapshots. |
| src/apm_cli/deps/file_provenance.py | Exposes shared file classification. |
| src/apm_cli/core/script_runner.py | Points users to run --list. |
| src/apm_cli/core/remediation.py | Adds inventory and image remediation. |
| src/apm_cli/core/invocation_memo.py | Resets seals between invocations. |
| src/apm_cli/core/deployment_ledger.py | Reuses resolved containment roots. |
| src/apm_cli/commands/uninstall/engine.py | Invalidates removed plugin stamps. |
| src/apm_cli/commands/deps/__init__.py | Lazily loads dependency commands. |
| src/apm_cli/commands/_helpers.py | Defers package-scanner imports. |
| src/apm_cli/commands/__init__.py | Removes eager command imports. |
| src/apm_cli/cli.py | Updates inventory help and offline handling. |
| src/apm_cli/bundle/__init__.py | Lazily exports bundle APIs. |
| src/apm_cli/_lazy_exports.py | Provides shared lazy-export helper. |
| scripts/architecture_linter/groups/registry_delegation.py | Registers inventory architecture guard. |
| scripts/architecture_linter/checks/registry_lens_observation.py | Guards read-only inventory ownership. |
| scripts/architecture_linter/checks/registry_harness_literals.py | Recognizes reader registry data. |
| scripts/architecture_linter/checks/marketplace_bundle_and_audit.py | Exempts documented vendor filename. |
| scripts/architecture_linter/checks/install_skills_root_derivation.py | Removes obsolete migration exception. |
| scripts/architecture_linter/checks/install_manifest_snapshot.py | Requires canonical manifest loading. |
| scripts/architecture_linter/checks/install_deployment_analyzers.py | Registers sealed-manifest read guard. |
| scripts/architecture_linter/checks/contracts_lockfile_write_authority.py | Updates lockfile read routing. |
| scripts/architecture_linter/checks/contracts_lockfile_regular_read.py | Updates regular-reader routing. |
| scripts/architecture_linter/checks/contracts_lockfile_generator.py | Updates version-warning routing. |
| packages/apm-guide/.apm/skills/apm-usage/commands.md | Documents inventory and script listing. |
| docs/src/content/docs/troubleshooting/index.md | Explains inventory versus package listing. |
| docs/src/content/docs/troubleshooting/common-errors.md | Updates script-not-found advice. |
| docs/src/content/docs/reference/targets-matrix.md | Documents legacy skill cleanup. |
| docs/src/content/docs/reference/cli/run.md | Documents run --list. |
| docs/src/content/docs/reference/cli/preview.md | Updates script-listing reference. |
| docs/src/content/docs/integrations/canvas.md | Documents installed canvas visibility. |
| docs/src/content/docs/consumer/install-packages.md | Updates script-listing command. |
| changelog.d/5866.fixed.md | Announces recorded compile hints. |
| changelog.d/5858.fixed.md | Announces instruction-only hint discovery. |
| changelog.d/5852.fixed.md | Announces copy-on-write plugin copying. |
| changelog.d/5850.fixed.md | Records image and root fixes. |
| changelog.d/5849.changed.md | Announces unchanged plugin reuse. |
| changelog.d/5843.fixed.md | Records reduced HOME lookups. |
| changelog.d/5842.fixed.md | Records deferred link resolver initialization. |
| changelog.d/5841.fixed.md | Records discovery and parsing reuse. |
| changelog.d/5840.changed.md | Records lighter install imports. |
| changelog.d/5839.fixed.md | Records normalization and scanning optimizations. |
| changelog.d/5836.fixed.md | Announces legacy skill cleanup. |
| changelog.d/5812.breaking-changes-and-upgrade-notes.md | Explains script-listing migration. |
| changelog.d/5812.added.md | Announces agent configuration inventory. |
| changelog.d/5806.added.md | Announces run --list. |
| .github/workflows/merge-train.yml | Runs inventory quality contracts. |
| .github/workflows/ci.yml | Runs inventory quality contracts. |
| .apm/architecture/owners/install-deployment.json | Registers image and manifest ownership. |
| .apm/architecture/owners/core-runtime.json | Registers lazy exports and inventory ownership. |
| .apm/architecture/owners/contracts-tooling.json | Registers lockfile memo ownership. |
Review effort: Balanced
|
|
||
| owner = sealed_owner(source) | ||
|
|
||
| data = Path(source).read_bytes() |
| memo = _memo(_ROOTS) | ||
| if memo is None: | ||
| return resolve_path(path) | ||
| key = (type(path), os.path.abspath(path)) |
| return entries | ||
| if not stores: | ||
| stores.append(DeployStore.open_default()) | ||
| return stores[0].instruction_record(key) if stores[0] is not None else None |
| self._attach_content_hashes(lockfile) | ||
| # Bind this run's deployed bytes to each verified package (committed later). | ||
| stage_package_records(self.ctx, lockfile) | ||
| stage_instruction_records(self.ctx, lockfile) |
| "import sys\n" | ||
| "from click.testing import CliRunner\n" | ||
| "from apm_cli.cli import cli\n" | ||
| "CliRunner().invoke(cli, ['list', '-f', 'json'])\n" |
… 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>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 4, 2026
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 4, 2026
…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>
Draft
6 of 10 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
327adcdaa2ca305bb193a93a6ce0039b87691fc4test_the_install_hint_walks_no_recorded_packagereads 1 parse walk on the parent, 0 here.↑ 60 parity cases (walk / all-recorded / first-missing, across stray-file, skip-dir owner and nested-repo worlds) agree with
discover_global_instructions. Three merge-walk mutants each turn a cell red.↑ Store cells: no-deploy package commits a record; stale key, 6 malformed shapes and a linked record all miss; a hint record is never read as a render record. Blob-gated-commit and lax-bool mutants each go red.
↑ P4 two-world cell: a forged empty record changes only the hint line; the deployed tree is byte-identical.
↑ Cost cell pins 2 listed directories in finalize (apm_modules and its owner level). Mutants: no staging skip reads 5; no record lookup reads 381.
↑ Staging cell: a global instruction only in the live staging tree raises no hint; the same name below an owner level still does. Any-depth-skip and no-.git-check mutants each go red.
↑ c8ec3603 floor PASS at this head: deployed tree, lock and apm.yml identical to #5858; re-pass finalize scandir 764 to 2, wall 449 ms to about 1 ms.
↑ Local: 7,586 passed across install, compilation, cache, cost and quality; lint mirror clean.
↑ AUD SECURITY GO at this head (424 targeted cells re-run by AUD).
↑ Budget rows
calls._hint_listing= 2 added for both plugin journeys; c5f1c53's shard 5 failed only on that unbudgeted counter.↑ Composes cleanly on train-10 tip 69f51bc (tree 51098dff); the helper sits above its caller so it no longer abuts #5785's trust hint. Merged #584944bd348 (train 8, real head) so the
fs.files_writtenrow edit composes; history has no queue commits.↑
install-g-14-plugins fs.files_written779 to 822 (budget 864), measured on scratch #5867 on the composed tree: one staged and committed hint record per integrated package.↑ PR CI green on this head: 74 pass, 3 skipping, tier2 included.
↑ Composed scratch #5867 (tree 51098dff = merge-tree(69f51bc, 0b888cb); this head composes to 2acfd383, tests only) green: 80 pass, 3 skipping; budget rows hold on the train-10 tree.
↑ QL fold (test-only, 327adcd): parity worlds for a linked instruction dir and node_modules (under a package and as an owner), with a check that the hint never lists them; flag-int and oversize hint records miss. Mutants W3 (follow dir links) 4 red, W5 (enter skipped dirs) 10 red, W6 (int flag) and W7 (no cap) 1 red each.
↓ QL re-sign on the test-only fold pending.
Description
Slice 3d of #5838 (floor plan sections 21-23; c8ec3603 and AUD ruling (E) EXACT). Stacked on #5858 @8cf3f5fc, plus #5849 @44bd348e for the budget rows (real PR heads only). Budget rows measured on merge-tree(69f51bc, this head), the train-10 tip.
After #5858,
apm install -gstill walked every package in the userapm_modulesto decide itsapm compile -ghint. This PR records, per package, the instruction list the hint needs, so a re-pass reads records instead of walking packages.cache/deploy_store.DeployStore. A hint-only record keyed byinstruction_record_key(package key, content_hash)and staged throughstage_instruction_record->commit_stagedin the same commit as the package's other records. It is written for every integrated package, including packages that deploy no files.[[name, is_global], ...]in discovery order, first-wins within the package, failed parses excluded._valid_hintchecks it strictly (str names of 1..255 chars, bool flags, at most 10000 entries); anything else is a miss, and that package is walked.*.instructions.mdoutside locked package roots are still found. The merge walk lists onlyapm_modulesowner levels that are not recorded package roots, with discovery's rules (sorted children, non-root.gitpruned,DEFAULT_SKIP_DIRSon owner-path parts, no symlinks)..apm-resolution-stagingtree at theapm_modulesroot is scratch, not installed content, and is not entered. Before this, a global instruction inside a staging backup could raise the hint (also true on main). The same name below an owner level is still read, matching discovery.The hint text and trigger are unchanged.
cost: one bounded record read and one
.gitlstat per package not re-integrated, one record write per changed package. Finalize lists only the owner levels: 2 directories on the 14-plugin world, fresh and re-pass (the cost cell pins it), with no package listed.Issue and approved scope
Issue: Refs #5838 (slice 3d of the floor plan)
Human scope-approval comment: #5838 (comment)
Does this PR complete the issue, or what remains? It does not; later floor-plan slices remain.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Red-first 6aa44c9 (test-only on perf(install): decide the user root-context hint without a full discovery (#5838 slice 3c) #5858): the cost cell reads 1
_parsed_instructionswalk of a recorded package; this head reads 0.pytest tests/integration/test_install_hint_records.py tests/unit/cache tests/unit/compilation tests/unit/install tests/integration/test_local_plugin_install_cost.py tests/quality(throughlocal-test.sh,APM_E2E_TESTS=1): 7,586 passed, 15 skipped, 0 failed.Lint mirror clean:
ruff@0.15.12check and format; pylint R0801;lint-auth-signals.sh; complexity ratchet--base-ref origin/main; architecture boundaries; tm006--changed.Changelog
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)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.