Repository navigation
test(cli): pin import-time TLS injection; integration onto _lazy_exports (#5840 follow-ups) - #5861
Open
Daniel Meppiel (danielmeppiel) wants to merge 89 commits into
Open
Daniel Meppiel (danielmeppiel) wants to merge 89 commits into
Daniel Meppiel (danielmeppiel) wants to merge 89 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>
… 111 - The live-promise and C6 (b) guards scan test_list_conformance.py and test_list_readers_conformance.py. - imports.list: linux measured 111 on the CI runner (train t1203010), equal to darwin; exact, shrink-only, trim in #5817. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
list-missing-items joins COMPONENT_ONLY: apm list only observes, the printed sentence is asserted in tests/unit/lens/test_render.py, and its 'apm install' is the executed dependencies-not-installed command. apm-spec-waiver: lazy PEP 562 exports in integration/__init__.py and the commands packages; import-time only, no OpenAPM-observable behaviour change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
apm-spec-waiver: deps/file_provenance.py classify_file rename (C) and integration/__init__.py lazy PEP 562 exports (D); import-time only, no req-* behaviour change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…t (S141) D removed the scripts table from list_cmd (run.py is its single owner, #5806). TestListCmd in tests/integration/test_coverage_phase4.py patched list_cmd._list_available_scripts/_get_console and is deleted. Each of its seven behaviours already has an exact oracle in tests/unit/commands/test_run_list.py: - test_no_scripts_shows_warning_and_example -> test_run_list_prints_the_0_39_list_output_and_runs_nothing[no-scripts-panel] (exact bytes) + test_no_scripts_panel_gets_the_example_block - test_scripts_shown_via_fallback_no_console -> test_plain_fallback_without_console[start-is-default, no-default] (exact output) - test_start_script_marked_as_default -> test_run_list_prints_the_0_39_list_output_and_runs_nothing[scripts-table] (exact "[>] | start" row) + test_plain_fallback_without_console[start-is-default] - test_scripts_shown_via_rich_console -> test_rich_console_prints_table_then_default_note (console.print call count) + [scripts-table] exact table - test_exception_in_list_scripts_exits_1 -> test_read_error_exits_1_with_the_error (exit 1 + "[x] Error listing scripts: disk error") - test_no_scripts_rich_panel_import_error_fallback -> test_no_scripts_panel_fallback_on_import_or_name_error (exact output, ImportError and NameError) - test_rich_console_exception_falls_back_to_simple -> test_rich_failure_falls_back_to_plain_once (one plain listing, every name, default note) Stale text after the bare apm list switch: the canvas page's "not shown by apm list", and a lifecycle test docstring that said apm list never reads the lock. (troubleshooting/index.md is B's hunk; fixed there to avoid a merge conflict.) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The failed `apm run missing` prints the exact stderr line "Run 'apm run --list' to see each script and its command." The test runs that step, checks that it reaches the scripts table, and checks that it changes no durable state. Docs: the troubleshooting entry and the run reference no longer say what bare `apm list` shows. The entry points to `apm run --list` for scripts, so it stays true before and after the inventory switch. Refs #5756 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>
After the switch, bare 'apm list' is the inventory: each row is an item a harness reads and SOURCE names the package that installed it. The entry now says so, shows 'apm list <package>' for one package, keeps the 'apm deps' pointers and 'apm run --list' for scripts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Merges B's signed head (no rebase) so D merges cleanly after B on main. packages/apm-guide/.apm/skills/apm-usage/commands.md, Scripts table, resolved to exactly two rows after `apm preview SCRIPT`: B's `apm run --list` row as B has it, then D's `apm list [NAME]` inventory row. The stale "`apm list` | List available scripts" row is removed (S141); no other "List available scripts" or apm-list-means-scripts text remains in the tree. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rime # Conflicts: # tests/quality/known_cell_issue_states.json # tests/quality/known_cell_issues.py
…il() A required witness carrying a ledgered strict KnownFailure mark could call pytest.xfail() with text matching the mark and pass the gate with no receipt. Only the mark's own expected failure may stand in for a receipt; an imperative xfail or skip is rejected before the ledger exemption. Regression: mark + imperative xfail -> failed (xfailed before). Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Parallel xdist workers resolving the ratchet base ran concurrent shallow fetches in one clone and collided on .git/shallow.lock. The base is now fetched once per test session (PYTEST_XDIST_TESTRUNUID, shared by the workers) under a filelock in the git common dir, and cached there. Regressions: a resolution while another fetch holds shallow.lock reuses the session's base, and eight concurrent workers resolve the same base (both failed before on the shallow.lock collision). Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Importing apm_cli.commands.install must not load other verbs, the package-registry HTTP stack, bundle pack/unpack or the marketplace builder, and stays within an apm_cli module budget. Fails on main: 377 apm_cli modules, including commands.deps and deps.registry.client. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
commands/__init__ no longer imports the deps verb, and the registry, bundle, marketplace, policy and integration packages resolve their re-exports on first use (PEP 562) through one helper. Importing the install verb loads 272 apm_cli modules instead of 377. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Every name the lazily exporting packages re-exported on main still resolves to its submodule's object; the deps stub resolves the deps group; and the CLI injects truststore before the registry HTTP client module loads. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The cell printed ssl.SSLContext's identity after calling configure_process_tls_trust(), so it could not show that importing the CLI had already injected truststore. It now reads it right after the import. Removing the import-time injection turns it red; the old line stayed green. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
apm_cli.integration hand-rolled its PEP 562 __getattr__ and __dir__. It now uses the shared owner, which gains lazy_dir so dir() still lists every export before it loads. The export set is unchanged; a cell pins that dir() names every export without loading an integrator. Refs #5838 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 21:45
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved test blind spots and environment-dependent assertions weaken regression coverage, while user-visible command changes lack documented approval within this PR’s scope.
8 open issues
Separate unapproved CLI changes from TLS follow-ups · New Assert CLI exit code in import-diet test · New Use pathlib ancestry checks for cross-platform path handling · New Compare APM paths against planted skill file ancestry · New Avoid repairing deleted skill files during observations · New Observe generated end-state when every-step mode is off · New Stub file UID to make ownership-swap test deterministic · New Clear inherited TLS overrides in default-injection test · New
What changed in this PR
Strengthens APM’s lazy-import and TLS startup guarantees following #5840. The supplied changes also include the apm list inventory migration and lifecycle-test safeguards.
Changes:
- Centralizes lazy exports and tests import-time TLS injection.
- Moves script listing to
apm run --list, with inventory contracts and documentation. - Extends lifecycle observations, architecture guards, and ratchet checks.
| File | Description |
|---|---|
| tests/unit/test_list_command.py | Removes migrated script-list tests. |
| tests/unit/test_cli_lazy_dispatch.py | Tests TLS timing and lazy exports. |
| tests/unit/scripts/test_architecture_runner.py | Registers the lens rule expectation. |
| tests/unit/scripts/test_architecture_removed_plugin_tombstone.py | Tests removed-symbol detection. |
| tests/unit/scripts/test_architecture_harness_literals.py | Allows reader-record target literals. |
| tests/unit/lens/test_verdict.py | Tests inventory state judgments. |
| tests/unit/lens/test_model.py | Enforces standard-library-only imports. |
| tests/unit/lens/readers/test_reader_walk.py | Tests bounded, defensive file reads. |
| tests/unit/lens/readers/test_reader_records.py | Validates reader metadata. |
| tests/unit/lens/readers/__init__.py | Initializes reader tests. |
| tests/unit/lens/_list_fixtures.py | Supplies synthetic inventories. |
| tests/unit/lens/__init__.py | Initializes lens tests. |
| tests/unit/data/lazy_export_surface.json | Records expected public exports. |
| tests/unit/core/test_runnable_prompts.py | Updates script-list advice assertion. |
| tests/unit/core/test_remediation_commands_catalog.py | Accounts for inventory remediation. |
| tests/unit/commands/test_run_list.py | Tests migrated script-list output. |
| tests/unit/commands/test_list_command.py | Tests inventory command behavior. |
| 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 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 the script-list golden obligation. |
| tests/perf/count_budgets.json | Records inventory import budget. |
| tests/lifecycle/scenarios/_list_kit.py | Provides inventory lifecycle fixtures. |
| tests/lifecycle/oracles.py | Adds parsed inventory assertions. |
| tests/lifecycle/obligations.py | Rejects unapproved skipped witnesses. |
| tests/lifecycle/machines/_spine_kit.py | Connects inventory observations to transitions. |
| tests/lifecycle/machines/_list_observation.py | Checks inventory against lifecycle 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 uncertain-state output. |
| tests/lifecycle/list_contract/fixtures/clean.json | Defines clean inventory output. |
| tests/lifecycle/journeys/index.yaml | Updates the script-list journey. |
| tests/lifecycle/journeys/goldens/J13/01.txt | Captures expected script-list output. |
| tests/lifecycle/journeys/consumer/J13-run-scripts.yaml | Migrates script discovery and advice. |
| tests/lifecycle/harness_ratchet.py | Adds failure tracking and synchronized base fetching. |
| tests/lifecycle/driver.py | Supports global inventory invocation. |
| tests/integration/test_local_bundle_hooks_lifecycle.py | Clarifies inventory coverage in a docstring. |
| tests/integration/test_list_import_diet.py | Checks inventory import dependencies. |
| tests/integration/test_failure_next_step_lifecycle.py | Verifies updated script-list remediation. |
| tests/integration/test_coverage_phase4.py | Removes migrated renderer tests. |
| tests/integration/test_architecture_owner_rule_mutations.py | Adds a lens-owner mutation case. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.text_json_agree.json | Defines text/JSON agreement. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.scripts_transition.json | Defines script-list compatibility. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.read_only.json | Defines read-only behavior. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.nondisclosure.json | Defines sensitive-value protection. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.json_contract.json | Defines JSON output guarantees. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.hostile_input.json | Defines hostile-input handling. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.honesty_vocabulary.json | Defines observation vocabulary. |
| tests/fixtures/lifecycle_bug_ledger/property_catalog/list.extra_files.json | Defines extra-file drift detection. |
| 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 path confinement. |
| 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. |
| src/apm_cli/policy/__init__.py | Lazily resolves policy exports. |
| src/apm_cli/marketplace/__init__.py | Lazily resolves marketplace exports. |
| src/apm_cli/lens/verdict.py | Centralizes inventory state judgments. |
| src/apm_cli/lens/model.py | Defines inventory data contracts. |
| src/apm_cli/lens/ci_scope.py | Determines CI scope restrictions. |
| src/apm_cli/lens/__init__.py | Introduces the observation package. |
| src/apm_cli/integration/__init__.py | Uses shared lazy exports and discovery. |
| src/apm_cli/deps/registry/__init__.py | Lazily resolves registry exports. |
| src/apm_cli/deps/file_provenance.py | Exposes shared file classification. |
| src/apm_cli/core/script_runner.py | Updates missing-script advice. |
| src/apm_cli/core/remediation.py | Adds missing-item remediation. |
| src/apm_cli/commands/run.py | Adds non-executing script listing. |
| src/apm_cli/commands/deps/__init__.py | Defers dependency command imports. |
| src/apm_cli/commands/_helpers.py | Defers installed-package scanner imports. |
| src/apm_cli/commands/__init__.py | Removes eager command imports. |
| src/apm_cli/cli.py | Updates dispatch and offline handling. |
| src/apm_cli/bundle/__init__.py | Lazily resolves bundle exports. |
| src/apm_cli/_lazy_exports.py | Provides shared lazy-export helpers. |
| scripts/architecture_linter/groups/registry_delegation.py | Registers lens architecture checks. |
| scripts/architecture_linter/checks/registry_lens_observation.py | Guards observation ownership and side effects. |
| scripts/architecture_linter/checks/registry_harness_literals.py | Recognizes reader records as registry data. |
| scripts/architecture_linter/checks/marketplace_bundle_and_audit.py | Exempts the vendor install-record filename. |
| packages/apm-guide/.apm/skills/apm-usage/commands.md | Documents revised listing commands. |
| docs/src/content/docs/troubleshooting/index.md | Explains inventory versus package listing. |
| docs/src/content/docs/troubleshooting/common-errors.md | Updates script-discovery guidance. |
| docs/src/content/docs/reference/cli/run.md | Documents run --list. |
| docs/src/content/docs/reference/cli/preview.md | Updates the script-list link. |
| docs/src/content/docs/reference/cli/list.md | Documents inventory behavior and output. |
| docs/src/content/docs/integrations/canvas.md | Describes canvas inventory visibility. |
| docs/src/content/docs/consumer/install-packages.md | Updates script-list guidance. |
| changelog.d/5840.changed.md | Announces reduced install imports. |
| changelog.d/5812.breaking-changes-and-upgrade-notes.md | Explains the listing-command migration. |
| changelog.d/5812.added.md | Announces inventory listing. |
| changelog.d/5806.added.md | Announces run --list. |
| .github/workflows/merge-train.yml | Runs inventory quality checks. |
| .github/workflows/ci.yml | Runs inventory quality checks. |
| .apm/architecture/owners/core-runtime.json | Registers lazy-export and lens ownership. |
Review effort: Balanced
Comment on lines
+97
to
+101
| @click.option( | ||
| "--list", | ||
| "list_scripts", | ||
| is_flag=True, | ||
| help="List the scripts in apm.yml and exit (runs nothing)", |
| "import sys\n" | ||
| "from click.testing import CliRunner\n" | ||
| "from apm_cli.cli import cli\n" | ||
| "CliRunner().invoke(cli, ['list', '-f', 'json'])\n" |
| def _locations(world: ListWorld) -> list[str]: | ||
| """Recorded locations as list shows them: a folder once, not its members.""" | ||
| paths = set(recorded_paths(world.lock_path, world.deploy_root).values()) | ||
| return sorted(p for p in paths if not any(p.startswith(f"{o}/") for o in paths)) |
Comment on lines
+147
to
+148
| claimed = {os.path.realpath(path) for path in world.planted} | ||
| assert not claimed & set(observed), f"INV-L3: a planted item is claimed: {claimed}" |
| lock_path=self.project.root / "apm.lock.yaml", | ||
| roots=roots, | ||
| expected_states=states, | ||
| planted=_list_observation.plant(self.scenario.isolated.home), |
Comment on lines
+1098
to
+1101
| @invariant() | ||
| def list_observation_matches_model(self) -> None: | ||
| if _list_observation.every_step(): | ||
| _list_observation.observe_list(self.list_world()) |
Comment on lines
+181
to
+183
| monkeypatch.setattr(os, "lstat", root_owned_lstat) | ||
| result = read_file(str(managed), 1024, root_owned=True) | ||
| assert (result.status, result.reason) == ("unreadable", "not root-owned or world-writable") |
| "context = urllib3.util.ssl_.create_urllib3_context()\n" | ||
| "print('CONTEXT', isinstance(context, truststore.SSLContext), RegistryClient.__name__)\n" | ||
| ) | ||
| env = {k: v for k, v in os.environ.items() if k != "APM_DISABLE_TRUSTSTORE"} |
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:
07dfb19d0a8300bd6246582fd46d3448a32fa677AT_IMPORT False); the old line stayed green under the same mutation.↑ integration/init: same export set and object identity (surface cell),
apm listimport diet and startup budget unchanged; a new dir() cell goes red when__dir__is dropped.↑ tests/unit/test_cli_lazy_dispatch.py, test_list_import_diet.py, test_cli_startup_import_budget.py, tests/unit/integration: 3,660 passed.
↓ CI not observed yet.
Description
Two QL follow-ups from #5840 (owner 687bbe84, handed to me while they are on slice 8). Based on #5840's head
e9c179d0, with signed #5834 (5b839832) merged for the list promise-catalog rows its tests cite.test_install_path_injects_tls_trust_before_any_http_client_loadsprintedssl.SSLContext is truststore.SSLContextafter callingconfigure_process_tls_trust(), so it could not show that importing the CLI had already injected truststore. It now reads the identity right afterimport apm_cli.cli, before any explicit configure call. Mutation partner: removing the import-time injection incli.pyturns the new line red; the old cell stays green under that mutation.apm_cli.integrationhand-rolled its PEP 562__getattr__/__dir__. It now uses_lazy_exports.lazy_exports, likepolicy,bundle,marketplaceanddeps.registry. The owner gainslazy_dirsodir()still lists every export before it loads. The export set and the TYPE_CHECKING imports are unchanged.cost: 0 (no import added on any CLI path;
apm_cli._lazy_exportsis already loaded by the other lazy packages).Issue and approved scope
Issue: Refs #5838
Human scope-approval comment: #5838 (comment)
Does this PR complete the issue, or what remains? It does not; these are #5840 review follow-ups.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
pytest tests/unit/test_cli_lazy_dispatch.py tests/integration/test_list_import_diet.py tests/integration/test_cli_startup_import_budget.py tests/unit/integration: 3,660 passed (throughlocal-test.sh).Mutations: no import-time TLS injection turns the new TLS line red; dropping
__dir__turnstest_integration_dir_lists_its_exports_without_loading_themred.Lint mirror clean:
ruff@0.15.12check and format; pylint R0801;lint-auth-signals.sh; complexity ratchet; architecture boundaries.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.