Repository navigation
test(lifecycle): a credited step that exits non-zero fails with its output - #5875
Open
Daniel Meppiel (danielmeppiel) wants to merge 185 commits into
Open
Daniel Meppiel (danielmeppiel) wants to merge 185 commits into
Daniel Meppiel (danielmeppiel) wants to merge 185 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>
…ing it The build stamp is a freshness hint: a stamp hit only lets the verifier try, and the source digests and the in-memory synthesis still decide. A frozen binary or an installed distribution reuses the verdict build identity; a source or editable tree is fingerprinted by each file's path, size and mtime (one lstat per file, no reads) instead of reading the whole package (~12 MB) once per process. Computed once per process under a lock, with reset_build_stamp for tests. Cells: concurrent stamps fingerprint once; a source-tree stamp reads no content; an installed build reuses the verdict identity; a plugin source edit that keeps size and mtime still fails the digest compare (unit and re-pass lifecycle). Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…o cells Refs #5838 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>
… 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>
… (red-first) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…utput; pin offline rows to exit 0 credit_step returned without a receipt when a credited step exited non-zero, so the witness reported a missing receipt and the command's output was lost (train 11, offline lock). It now fails with the exit and the step's stdout and stderr. The offline converged rows pin exit 0, as their comment states. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical cache-key and image-integrity flaws can misdirect deployments or install unverified bytes, while unsafe file reads can follow symlinks or block indefinitely on FIFOs.
6 open issues
Include adoption roots in deployment memo cache identity · New Verify and seal freshly resolved image outputs before reuse · New Use descriptor-checked reads in the sealed-image fast path · New Reject special files when copying sealed image members · New Preserve symlink-sensitive paths in resolver cache keys · New Align patch scope and validation with the submitted diff · New
What changed in this PR
The stated goal is to make failed credited lifecycle steps report their output immediately. The supplied diff also includes install-performance work and the transition from script listing to an agent-configuration inventory.
Changes:
- Reject unexpected non-zero credited steps and require successful offline operations.
- Add inventory contracts, observation checks, and
apm run --listdocumentation. - Reduce install work through image reuse, memoization, deferred imports, and supporting guards.
| 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 detection. |
| tests/unit/scripts/test_architecture_harness_literals.py | Allows reader registry literals. |
| tests/unit/lens/test_verdict.py | Tests inventory state judgments. |
| tests/unit/lens/test_model.py | Checks model import isolation. |
| tests/unit/lens/readers/test_reader_records.py | Validates reader records. |
| 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 layers. |
| 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 | Checks revised script-list advice. |
| tests/unit/core/test_remediation_w4_phases_targets_catalog.py | Accounts for sealed-image remediation. |
| tests/unit/core/test_remediation_commands_catalog.py | Accounts for inventory remediation. |
| tests/unit/core/test_output_mode.py | Enables update notices during tests. |
| tests/unit/cache/test_instruction_hint_record.py | Tests instruction-hint records. |
| tests/quality/test_scenario_refusal_credit.py | Tests loud credited-step failure. |
| 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 | Adds 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-list golden obligation. |
| tests/lifecycle/scenarios/test_network_offline.py | Requires offline exit zero. |
| tests/lifecycle/scenarios/_kit.py | Rejects failed credits with output. |
| tests/lifecycle/oracles.py | Adds parsed inventory assertions. |
| tests/lifecycle/machines/_spine_kit.py | Observes inventory against model state. |
| tests/lifecycle/list_contract/fixtures/no-match.json | Defines empty-match output. |
| tests/lifecycle/list_contract/fixtures/error.json | Defines 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-list journey metadata. |
| tests/lifecycle/journeys/goldens/J13/01.txt | Pins script-list output. |
| tests/lifecycle/journeys/consumer/J13-run-scripts.yaml | Exercises script-list migration. |
| tests/lifecycle/driver.py | Supports global inventory commands. |
| tests/integration/test_verdict_record.py | Resets cached build identity. |
| tests/integration/test_remaining_modules_coverage.py | Updates install-context mocks. |
| tests/integration/test_local_bundle_hooks_lifecycle.py | Clarifies inventory coverage comments. |
| 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 | Checks forged hints remain advisory. |
| tests/integration/test_failure_next_step_lifecycle.py | Exercises revised script-list advice. |
| tests/integration/test_architecture_pack_lockfile_read.py | Includes lockfile memo ownership. |
| tests/integration/test_architecture_owner_rule_mutations.py | Adds guard mutation cases. |
| tests/integration/test_architecture_outcome_guards.py | Checks repeated-install diagnostics. |
| tests/integration/test_architecture_lockfile_write_authority.py | Updates reader guard expectation. |
| tests/fixtures/perf/plugins.py | Builds representative plugin workloads. |
| 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 | Declares output agreement law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.scripts_transition.json | Declares script migration law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.read_only.json | Declares read-only inventory law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.nondisclosure.json | Declares nondisclosure law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.json_contract.json | Declares JSON output law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.hostile_input.json | Declares hostile-input handling law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.honesty_vocabulary.json | Declares inventory vocabulary limits. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.extra_files.json | Declares extra-file detection law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.exit_contract.json | Declares inventory exit codes. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.confinement.json | Declares path confinement law. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.ci_isolation.json | Declares 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-layout regression coverage. |
| 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 HOME resolution. |
| src/apm_cli/utils/content_hash.py | Exposes hashed payload paths. |
| src/apm_cli/utils/atomic_io.py | Copies caller-verified bytes atomically. |
| src/apm_cli/primitives/discovery.py | Shares one primitive inventory walk. |
| src/apm_cli/policy/__init__.py | Defers policy exports. |
| 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 | Defers marketplace exports. |
| 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 lightweight observation package. |
| src/apm_cli/integration/write_seam.py | Verifies sealed members before copying. |
| src/apm_cli/integration/prompt_integrator.py | Defers unused link resolvers. |
| src/apm_cli/integration/instruction_integrator.py | Defers unused link resolvers. |
| src/apm_cli/integration/cleanup.py | Recognizes proven untracked skill members. |
| src/apm_cli/integration/base_integrator.py | Compares destinations with sealed digests. |
| src/apm_cli/integration/agent_integrator.py | Defers unused link resolvers. |
| src/apm_cli/integration/__init__.py | Loads integrator exports lazily. |
| 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 manifest owner and retained digests. |
| 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 local images. |
| src/apm_cli/install/phases/lockfile.py | Stages instruction-hint records. |
| src/apm_cli/install/phases/lockfile_deploy_records.py | Builds package instruction records. |
| src/apm_cli/install/phases/local_content.py | Invalidates rewritten images and enables reuse. |
| src/apm_cli/install/phases/finalize.py | Uses records for compile hints. |
| src/apm_cli/install/phases/cleanup.py | Removes obsolete 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 | Defers registry exports. |
| src/apm_cli/deps/lockfile.py | Reuses parsed lockfile snapshots. |
| src/apm_cli/deps/lockfile_write_authority.py | Invalidates cached lockfile reads. |
| 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 | Recommends apm run --list. |
| src/apm_cli/core/remediation.py | Adds inventory and integrity advice. |
| src/apm_cli/core/invocation_memo.py | Clears seals at invocation boundaries. |
| src/apm_cli/core/deployment_ledger.py | Reuses resolved containment roots. |
| src/apm_cli/commands/uninstall/engine.py | Removes uninstalled image stamps. |
| src/apm_cli/commands/run.py | Adds script-listing mode. |
| src/apm_cli/commands/deps/__init__.py | Defers dependency command imports. |
| 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 | Defers bundle exports. |
| src/apm_cli/_lazy_exports.py | Shares lazy-export machinery. |
| scripts/architecture_linter/groups/registry_delegation.py | Registers inventory observation guard. |
| scripts/architecture_linter/checks/registry_lens_observation.py | Guards read-only observation ownership. |
| scripts/architecture_linter/checks/registry_harness_literals.py | Recognizes reader registry authority. |
| scripts/architecture_linter/checks/marketplace_bundle_and_audit.py | Exempts vendor install-record filenames. |
| scripts/architecture_linter/checks/install_skills_root_derivation.py | Removes legacy derivation exception. |
| scripts/architecture_linter/checks/install_manifest_snapshot.py | Requires canonical manifest loading. |
| scripts/architecture_linter/checks/install_deployment_analyzers.py | Registers manifest-read guard. |
| scripts/architecture_linter/checks/contracts_lockfile_write_authority.py | Tracks extracted lockfile reader. |
| 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 recovery advice. |
| docs/src/content/docs/reference/targets-matrix.md | Documents legacy skill retirement. |
| docs/src/content/docs/reference/cli/run.md | Documents script-list options and exits. |
| docs/src/content/docs/reference/cli/preview.md | Links to revised script listing. |
| docs/src/content/docs/integrations/canvas.md | Documents installed-canvas visibility. |
| docs/src/content/docs/consumer/install-packages.md | Updates script-list command reference. |
| changelog.d/5875.changed.md | Notes credited-step diagnostics. |
| changelog.d/5866.fixed.md | Notes stored instruction hints. |
| changelog.d/5858.fixed.md | Notes narrower hint discovery. |
| changelog.d/5852.fixed.md | Notes copy-on-write plugin copying. |
| changelog.d/5850.fixed.md | Notes image and root safeguards. |
| changelog.d/5849.changed.md | Notes unchanged-image reuse. |
| changelog.d/5843.fixed.md | Notes reduced HOME lookups. |
| changelog.d/5842.fixed.md | Notes deferred link resolvers. |
| changelog.d/5841.fixed.md | Notes shared discovery and read memos. |
| changelog.d/5840.changed.md | Notes reduced install imports. |
| changelog.d/5839.fixed.md | Notes plugin processing optimizations. |
| changelog.d/5836.fixed.md | Notes legacy skill cleanup. |
| changelog.d/5812.breaking-changes-and-upgrade-notes.md | Explains script-list migration. |
| changelog.d/5812.added.md | Announces configuration inventory. |
| changelog.d/5806.added.md | Announces apm run --list. |
| .github/workflows/merge-train.yml | Runs inventory quality checks. |
| .github/workflows/ci.yml | Runs inventory quality checks. |
| .apm/architecture/owners/install-deployment.json | Registers image and manifest ownership. |
| .apm/architecture/owners/core-runtime.json | Registers lazy exports and observation ownership. |
| .apm/architecture/owners/contracts-tooling.json | Registers lockfile memo ownership. |
Review effort: Balanced
Comment on lines
+35
to
+39
| def _version(path: Path, kind: str, payload: Any) -> tuple[str, Any, tuple[bool, str]]: | ||
| """*payload* plus the inputs adoption reads besides the bytes (user scope, home).""" | ||
| from ..core.scope import is_user_scope_root | ||
|
|
||
| return (kind, payload, (is_user_scope_root(path.parent), str(Path.home()))) |
Comment on lines
+200
to
204
| reused = ( | ||
| reuse_resolved_local_plugin(ctx, dep_key, install_path, original_src) | ||
| if native_detection is None | ||
| else None | ||
| ) |
| import hashlib | ||
|
|
||
| try: | ||
| return hashlib.sha256(path.read_bytes()).hexdigest() if path.is_file() else None |
Comment on lines
+294
to
+299
| from apm_cli.core.remediation import SEALED_IMAGE_CHANGED | ||
| from apm_cli.utils.sealed_files import SealedImageChangedError, sealed_owner | ||
|
|
||
| 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)) |
| "apm_cli.commands.list_cmd", | ||
| "list", | ||
| "List available scripts in the current project", | ||
| "List agent config on disk and its origin.", |
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:
b0f9617a4aa4b8e13711bcbe1b001d7e2e10dd38↑ All 16 credit-using scenario modules run locally: 392 passed. The 4 that fail (3 qualified-host-port host-identity cases, test_update_keeps_unmanaged_and_sibling) fail identically on base 327adcd, on an install exit check (git ls-remote in this local environment), not on the new credit gate.
↑ Offline witness with exit 0 pinned: 7 passed, plus 6 repeat runs of multi-unchanged.
↓ The train-11 lock flake did not reproduce locally, so its cause is still unknown; this change makes the next one print lock's output.
↑ PR CI green on this head: 74 pass, 3 skipping; every lifecycle smoke shard passes with the loud gate, so CI swallowed no other step.
↓ Integration Shard 9 failed once on test_mcp_dependency_targets_lifecycle (dry-run policy preview text), which this diff cannot reach; it passed locally and on one rerun.
Description
Harness hardening under #5838, from the train-11 red on
test_converged_project_works_offline[multi-unchanged](run 47233836916, Lifecycle Smoke Shard 2). The test body passed, but no receipt coveredpair|OP=lock|NET=offline.Mechanism:
lockis not a model-predicted command (tests/lifecycle/model/expected.py:30), so its allowed exit is the whole contract{0, 1, 2}. Whenapm lockexited non-zero offline, the exit check passed and nothing changed.credit_stepthen returned without a receipt and without a message (if step.result.returncode != 0 and not refusal: return), so the command's output was lost.credit_problems/credit_step(tests/lifecycle/scenarios/_kit.py): a credited step that exits non-zero withoutrefusalnow fails. The message names the exit and the credited ids and prints the step's stdout and stderr. The silent return is gone. Declared refusals are unchanged.test_network_offline.py: the converged offline rows pinexit=0, as their comment states ("every one must exit 0").apm lockon a converged project exits 0 in every local run (13 of 13). The train-11 flake did not reproduce, so no product bug is filed; the next occurrence will print its output.cost: none at run time; one exit comparison per credited step.
Issue and approved scope
Issue: Refs #5838 (harness follow-up from train 11, QL and PGM ruling)
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 41209a6:
tests/quality/test_scenario_refusal_credit.py::test_a_credited_step_that_fails_without_a_declared_refusal_fails_loudlyfails withDID NOT RAISE AssertionErroron the base; it passes here. Mutant: restoring the base_kit.pyturns it red.pytestover every module that credits (tests/lifecycle/scenarios/test_*withcredit=, plusmachines/_source_bundle.py), throughlocal-test.sh,APM_E2E_TESTS=1: 392 passed, 4 failed. The same 4 fail on base 327adcd in this environment, on an install exit check, not on the credit gate.tests/lifecycle/scenarios/test_network_offline.py: 7 passed; multi-unchanged was run 6 more times, all green.tests/quality(throughlocal-test.sh): 1,132 passed.Lint mirror:
ruff@0.15.12check and format, assertion-quality ratchet, tm006--changed, complexity ratchet. Test-only diff.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.