Skip to content

test(lifecycle): security tables, journeys and lifecycle-file triage (T3) - #4156

Merged
Daniel Meppiel (danielmeppiel) merged 103 commits into
mainfrom
danielmeppiel-redesigned-doodle
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 103 commits into
mainfrom
danielmeppiel-redesigned-doodle

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

T3 of the lifecycle test family: security tables, the 25 documented user journeys and the triage of existing lifecycle files. Every table row and journey step oracle credits one generated obligation id, and only through an oracle receipt (oracles.check_obligation). The receipt ratchet holds every required id.

Builds on the lifecycle family core (#4142), the shared world, the promise catalog (#4146) and the journey index (#4152). Lands after the core.

Area What it adds
Obligation space tests/lifecycle/obligation_space.py expands the reviewed model export tests/quality/security_obligations.json (G 244, P 224, I 116, E 281, M 38, C 22) and one id per journey step oracle (284). tests/lifecycle/witnesses.py derives required witnesses and known-failing cells into tests/quality/generated_obligations.json.
Gate removal (#4107) security/test_gate_removal.py: one parametrized test over auto-discovered gate_paths/<path>.py and gate_slices/<kind>.py. Hook, mcp, lsp, bin, native and script kinds run across install, update, frozen, uninstall/prune, audit, dry-run, user scope, bundle, unpack, marketplace and native-plugin paths.
Policy outcomes (#4108) security/test_policy_outcomes.py: the owner table at the routing owner (not patched), plus site E2E rows from a SITE_SLICES registry.
Integrity, egress, origin, credentials (#4109) security/test_integrity.py, security/test_egress.py (per-host egress_slices/) and security/test_origin_and_credentials.py.
Journeys (#4110-#4112) journeys/test_journeys.py runner (schema in its docstring), the 25 journey files, goldens for J01, J02, J03, E01 (plus O1 steps), regen_goldens.py (refuses non-ASCII or duplicate lines) and .github/workflows/lifecycle-journeys.yml (3 OS, nightly plus workflow_dispatch with a ref input).
Lifecycle file triage (#4114) Absorbed replay rows, a shared scenario scaffold (tests/utils/lifecycle_scenario.py) and tests/lifecycle/replay/dispositions.{md,json} (every *_lifecycle*.py file with its disposition).

Issue and approved scope

Fixes #4107
Fixes #4108
Fixes #4109
Fixes #4110
Fixes #4111
Fixes #4112
Fixes #4114

Human scope-approval comments: #4107 (issuecomment-7034007932), #4108 (-7034009662), #4109 (-7034011476), #4110 (-7034013132), #4111 (-7034014921), #4112 (-7034016741), #4114 (-7034018821).

Does this PR complete the issue, or what remains? Gate 2 is best-effort by maintainer decision: cells still in the derived baseline are listed per space in a residual tracking issue at the cut. Most of the residual needs world services: proxy redirects, host API routes, an ADO auth-required mode, a package registry and more published world packages.

Type of change

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

Testing

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

Local results on this branch:

Command Result
pytest tests/lifecycle/security/test_gate_removal.py -n 2 106 passed, 93 xfailed (strict)
pytest tests/lifecycle/security/test_policy_outcomes.py -n 0 70 passed, 13 xfailed (strict)
pytest tests/lifecycle/security/test_integrity.py -n 0 95 passed, 9 xfailed (strict)
pytest tests/lifecycle/security/test_origin_and_credentials.py -n 0 46 passed, 1 xfailed (strict)
pytest tests/lifecycle/security/test_egress.py -n 2 64 passed
pytest tests/lifecycle/journeys/test_journeys.py -m "not live" -n 2 26 passed (all 25 journeys, witness ratchet enforced)
pytest tests/quality/test_generated_obligations.py 14 passed, including the real negative control: a witness passes with its oracle call and fails the ratchet when the call is removed

Generated coverage (required witnesses + known-failing cells on public issues / universe): G 155/244, P 74/224, I 94/116, E 63/281, M 29/38, C 15/22, J 259/284.

Strict known cells on main defects point at public issues #4053, #4154, #4171, #4178-#4185, #4196, #4208, #4215, #4221, #4224 and #4225. Cells about policy and approval enforcement behavior carry pending tracking until their issues are filed.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

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

Co-authored-by: Copilot [email protected]

…obligation ratchet (#4093)

Create tests/lifecycle/: a pure reference model (model/state.py,
model/expected.py), a driver (engine|binary), the cross-cutting oracle
promoted from tests/utils/lifecycle_oracle.py with receipts written only
by the oracle, snapshot helpers, a fallback world until T-0W lands, and a
row runner with one example replay row. tests/quality/promise_obligations.json
splits the 91 invariant x operation pairs and 107 GATE cells into required
rows (witness tests must earn the receipt, checked in the lifecycle shards)
and a baseline owned by later lanes. Old oracle/snapshot paths keep shims.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…T1 core, re-apply world driver/rows deltas

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4107-#4112)

oracles.check_obligation(cell_id, strength, before, after, result, evidence)
is the one entry point that credits a generated obligation. The oracle
checks the evidence itself (snapshot paths, unchanged bytes, egress log,
persisted-secret scan, exit, output, owner value) and writes the receipt
only when every fact holds; unit, e2e and e2e-evidence strengths set the
minimum evidence.

tests/lifecycle/obligation_space.py expands the reviewed model export
tests/quality/security_obligations.json (G 244, P 224, I 116, E 281, M 38,
C 22 = 925) and one row per journey step oracle of the journey index. The
P collapse after the routing owner lands is a recorded, disabled rule.
obligations.py loads the generated space with required witnesses, a derived
per-lane baseline and a separate known-failing list that earns no receipt.

(cherry picked from commit c3deb38)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…as a replay row

Add tests/lifecycle/test_absorbed_rows.py, which replays every
replay/rows/absorbed_*.yaml row, and the first absorbed row: a gated
package audits green, apm update deploys an approval and retires a deny,
and a dry run changes nothing (#3958). Row replay leaves the reference
model unchanged on --dry-run steps.

Record the T-10 disposition table for the 260 tests/integration
*_lifecycle* modules under t10-evidence/.

Part of #4114

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Draft one bug-ledger row per cited issue (115 new, 12 extensions of
existing rows) and list 83 no-issue regression traps for review. The
ledger itself is unchanged.

Part of #4114

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… kept lifecycle traps in the ledger

Add the LSP-only uninstall row (#4045, #3768) and refusal probes to the
absorbed rows, so they earn P-INV-I7 receipts for uninstall, update and
approve-deny; promote those obligations from baseline to required.
The source integration params stay: the rows do not check their lock
fields and per-step output, so they are not a superset.

Add 115 bug-ledger rows and extend 12 existing rows with the kept
tests/integration lifecycle modules that trap each issue.

Part of #4114

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The hook JS sidecar contract and the package target hook routing e2e
module each carried the same private _new_scenario scaffold. Move it to
tests/utils/lifecycle_scenario.py and use it from both; the collected
node set is unchanged.

Part of #4114

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ite (#4108)

Owner tier: the 18 P|owner outcome classes at route_discovery_outcome and
resolve_trust_policy (not patched), each x enforcement off/warn/block, one
unit-strength oracle receipt per row. Site tier: SITE_SLICES registry of
decision sites run through RowReplay (I1-I9) with one e2e receipt per
P|<site>|<class> row. Strict expected failures carry placeholder tracking
until their issues are filed.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
#4110)

tests/lifecycle/journeys/test_journeys.py replays every persona journey
YAML in a fresh hermetic world through the driver, applies the index step
oracles (O1-O9, O12, O13; O10 deferred, O11 pending) and I1-I9 around every
apm command. normalize.py holds N1-N7; regen_goldens.py writes and checks
goldens and refuses non-ASCII or duplicate lines. J01-J03 (golden, PR tier)
with goldens; the run-in-ci page pins the current release. Strict known
cells carry placeholder tracking until their issues are filed.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active findings show known-failure handling breaks two journeys, nested-command parsing and scope placement are incorrect, and J08 setup fails on macOS due to nonportable sed syntax.

4 open issues
What changed in this PR

This PR expands APM's lifecycle test family with security tables, documented user journeys, and shared replay infrastructure. It builds on the lifecycle core, promise catalog, and journey index to track coverage through oracle receipts.

Changes:

  • Adds gate-removal and host-specific egress cases using a shared, isolated test world.
  • Adds journey scenarios and golden output transcripts for consumer, producer, and enterprise workflows.
  • Consolidates lifecycle helpers, updates CI collection, and corrects related documentation.
File Description
tests/​utils/​world_snapshot.py Re-exports the shared snapshot restore helper.
tests/​utils/​lifecycle_state.py Uses canonical lifecycle surface capture.
tests/​utils/​lifecycle_scenario.py Adds a reusable isolated CLI scenario.
tests/​utils/​click_tree.py Resolves command references against Click definitions.
tests/​utils/​apm_lifecycle_runner.py Applies output checks to command results.
tests/​quality/​test_quality_baselines.py Updates expectations for per-test duplicate detection.
tests/​quality/​test_gate_cell_obligations.py Uses relocated state-machine and oracle modules.
tests/​quality/​test_ci_topology.py Includes lifecycle tests in smoke collection.
tests/​quality/​gate_cell_obligations.json Updates the documented state-machine path.
tests/​quality/​cli_docs_surface_expected.json Initializes strict CLI-documentation exceptions.
tests/​lifecycle/​world/​scopes.py Adds scope, policy, registry, and credential setup helpers.
tests/​lifecycle/​world/​fixtures.py Provides template and per-test world fixtures.
tests/​lifecycle/​world/​contract.py Defines package, service, and world interfaces.
tests/​lifecycle/​world/​clone.py Copies worlds and rewrites carried paths.
tests/​lifecycle/​world/​__init__.py Exposes shared world helpers.
tests/​lifecycle/​test_core_example.py Adds core replay and approval-mutation checks.
tests/​lifecycle/​test_absorbed_rows.py Runs absorbed lifecycle replay rows.
tests/​lifecycle/​security/​gate_slices/​script.py Defines script-trust removal cases.
tests/​lifecycle/​security/​gate_slices/​native.py Defines native-plugin gate cases.
tests/​lifecycle/​security/​gate_slices/​mcp.py Defines MCP gate-removal cases.
tests/​lifecycle/​security/​gate_slices/​lsp.py Defines LSP gate-removal cases.
tests/​lifecycle/​security/​gate_slices/​hook.py Defines hook gate-removal cases.
tests/​lifecycle/​security/​gate_slices/​__init__.py Defines and discovers gate-case tables.
tests/​lifecycle/​security/​gate_paths/​update.py Registers update-based gate removal.
tests/​lifecycle/​security/​gate_paths/​unpack.py Registers executable-bundle refusal checks.
tests/​lifecycle/​security/​gate_paths/​uninstall_prune_rebuild.py Registers uninstall and prune reconciliation.
tests/​lifecycle/​security/​gate_paths/​native_plugin.py Registers user-scope native-plugin setup.
tests/​lifecycle/​security/​gate_paths/​marketplace_install.py Registers marketplace gate setup.
tests/​lifecycle/​security/​gate_paths/​lifecycle_scripts.py Registers lifecycle-script trust scenarios.
tests/​lifecycle/​security/​gate_paths/​install.py Registers project install reconciliation.
tests/​lifecycle/​security/​gate_paths/​install_g.py Registers user-scope install reconciliation.
tests/​lifecycle/​security/​gate_paths/​frozen.py Registers frozen refusal and recovery.
tests/​lifecycle/​security/​gate_paths/​frozen_g.py Registers user-scope frozen checks.
tests/​lifecycle/​security/​gate_paths/​dry_run.py Registers gate-removal preview checks.
tests/​lifecycle/​security/​gate_paths/​bundle_install.py Registers local-bundle approval scenarios.
tests/​lifecycle/​security/​gate_paths/​audit_ci.py Registers audit and frozen agreement checks.
tests/​lifecycle/​security/​gate_paths/​__init__.py Defines and discovers execution paths.
tests/​lifecycle/​security/​egress_slices/​gitlab.py Defines GitLab credential and egress cases.
tests/​lifecycle/​security/​egress_slices/​github.py Defines GitHub credential and egress cases.
tests/​lifecycle/​security/​egress_slices/​ghes.py Defines GitHub Enterprise Server cases.
tests/​lifecycle/​security/​egress_slices/​ghe_com.py Defines Enterprise Cloud host cases.
tests/​lifecycle/​security/​egress_slices/​generic.py Defines generic-host credential isolation cases.
tests/​lifecycle/​security/​egress_slices/​ado.py Defines Azure DevOps egress cases.
tests/​lifecycle/​security/​egress_slices/​__init__.py Defines and discovers host-case tables.
tests/​lifecycle/​security/​__init__.py Establishes the security test package.
tests/​lifecycle/​replay/​rows/​core_gate_row.yaml Defines the core deny-and-retire replay.
tests/​lifecycle/​replay/​rows/​absorbed_update_executables_decision.yaml Replays approval and denial through update.
tests/​lifecycle/​replay/​rows/​absorbed_uninstall_lsp_only_scope.yaml Replays LSP-only uninstall cleanup.
tests/​lifecycle/​model/​expected.py Derives deployment, lock, and exit expectations.
tests/​lifecycle/​model/​__init__.py Establishes the reference-model package.
tests/​lifecycle/​machines/​test_m_gate.py Uses shared driver and relocated helpers.
tests/​lifecycle/​machines/​conftest.py Writes visited gate-cell evidence.
tests/​lifecycle/​machines/​__init__.py Establishes the state-machine package.
tests/​lifecycle/​journeys/​twins_producer.py Provides local producer publishing remotes.
tests/​lifecycle/​journeys/​twins_policy.py Provides enterprise policy fixtures.
tests/​lifecycle/​journeys/​twins_consumer_b.py Provides a local doctor-probe repository.
tests/​lifecycle/​journeys/​producer/​P04-hooks-and-lifecycle-scripts.yaml Exercises script trust and revocation.
tests/​lifecycle/​journeys/​producer/​P02-pack-and-release-from-ci.yaml Exercises bundle packaging and consumption.
tests/​lifecycle/​journeys/​goldens/​P01/​02.txt Records producer install output.
tests/​lifecycle/​journeys/​goldens/​J05/​06.txt Records frozen marketplace restoration.
tests/​lifecycle/​journeys/​goldens/​J03/​04.txt Records frozen drift refusal.
tests/​lifecycle/​journeys/​goldens/​J03/​03.txt Records successful SARIF audit output.
tests/​lifecycle/​journeys/​goldens/​J03/​02.txt Records frozen verification output.
tests/​lifecycle/​journeys/​goldens/​J02/​03.txt Records onboarding audit output.
tests/​lifecycle/​journeys/​goldens/​J02/​02.txt Records fresh-clone frozen installation.
tests/​lifecycle/​journeys/​goldens/​J01/​06.txt Records repeated installation output.
tests/​lifecycle/​journeys/​goldens/​J01/​04.txt Records initial package installation.
tests/​lifecycle/​journeys/​goldens/​J01/​03.txt Records project initialization output.
tests/​lifecycle/​journeys/​goldens/​E01/​04.txt Records failing policy SARIF output.
tests/​lifecycle/​journeys/​goldens/​E01/​03.txt Records warning-mode policy audit output.
tests/​lifecycle/​journeys/​enterprise/​E06-private-registry.yaml Exercises private registry configuration and recovery.
tests/​lifecycle/​journeys/​enterprise/​E05-audit-evidence-sbom.yaml Exercises audit reports and SBOM exports.
tests/​lifecycle/​journeys/​enterprise/​E04-private-hosts.yaml Exercises private-host authentication diagnostics.
tests/​lifecycle/​journeys/​enterprise/​E03-proxy-only-air-gapped.yaml Exercises proxy-only and offline workflows.
tests/​lifecycle/​journeys/​enterprise/​E02-executables-approvals.yaml Exercises executable approval and denial.
tests/​lifecycle/​journeys/​consumer/​J15-adopt-migrate.yaml Exercises discovery and existing-file adoption.
tests/​lifecycle/​journeys/​consumer/​J14-diagnose-inspect.yaml Exercises diagnostics, inspection, and cache commands.
tests/​lifecycle/​journeys/​consumer/​J13-run-scripts.yaml Exercises script preview and execution.
tests/​lifecycle/​journeys/​consumer/​J12-drift-recovery.yaml Exercises drift detection and recovery.
tests/​lifecycle/​journeys/​consumer/​J11-deploy-bundle.yaml Exercises bundle deployment and legacy unpacking.
tests/​lifecycle/​journeys/​consumer/​J10-global-setup.yaml Exercises user-scope installation and cleanup.
tests/​lifecycle/​journeys/​consumer/​J09-switch-harness.yaml Exercises target changes and stale-file cleanup.
tests/​lifecycle/​journeys/​consumer/​J08-uninstall-cleanup.yaml Exercises uninstall, prune, and dependency cleanup.
tests/​lifecycle/​journeys/​consumer/​J06-mcp-server.yaml Exercises MCP configuration and frozen replay.
tests/​lifecycle/​journeys/​consumer/​J05-marketplace-plugin.yaml Exercises marketplace plugin installation and recovery.
tests/​lifecycle/​journeys/​consumer/​J04-skill-from-bundle.yaml Exercises skill selection and removal.
tests/​lifecycle/​journeys/​consumer/​J03-ci-gate.yaml Exercises frozen and audit CI checks.
tests/​lifecycle/​journeys/​consumer/​J02-team-onboarding.yaml Exercises onboarding from a committed lockfile.
tests/​lifecycle/​journeys/​__init__.py Establishes the journey package.
tests/​lifecycle/​driver.py Adds engine/binary selection and scope routing.
tests/​lifecycle/​conftest.py Wires fixtures, receipts, and output checks.
tests/​lifecycle/​__init__.py Establishes the lifecycle test package.
tests/​integration/​test_apm_lifecycle_runner_contract.py Tests output enforcement and its negative control.
tests/​integration/​conftest.py Removes the relocated gate-evidence session hook.
tests/​fixtures/​gate_mutants/​skip_approval_check.py Updates the launcher documentation path.
scripts/​test_body_hash.py Adds normalized per-test AST hashing.
pyproject.toml Registers the promise marker.
docs/​src/​content/​docs/​reference/​cli/​targets.md Clarifies planned subcommand names.
docs/​src/​content/​docs/​reference/​cli/​marketplace.md Documents offline browsing and package-set flags.
docs/​src/​content/​docs/​reference/​cli/​config.md Expands abbreviated MCP command references.
docs/​src/​content/​docs/​reference/​cli/​audit.md Corrects the target configuration reference.
docs/​src/​content/​docs/​producer/​publish-to-a-marketplace.mdx Clarifies marketplace scaffolding behavior.
docs/​src/​content/​docs/​getting-started/​coming-from.md Corrects existing-file adoption output.
docs/​src/​content/​docs/​enterprise/​enforce-in-ci.mdx Corrects the warning-mode status symbol.
docs/​src/​content/​docs/​enterprise/​apm-policy.mdx Updates the policy audit transcript.
docs/​src/​content/​docs/​consumer/​run-in-ci.mdx Updates pinned CLI versions in CI examples.
CHANGELOG.md Adds lifecycle and test-quality entries.
apm.lock.yaml Refreshes deployed instruction hashes.
.github/​workflows/​gate-machine-nightly.yml Runs nightly exploration against a built binary.
.github/​workflows/​ci.yml Adds quality checks and lifecycle smoke collection.
.github/​instructions/​tests.instructions.md Documents test-corpus quality ratchets.
.apm/​instructions/​tests.instructions.md Updates the source test instructions.

Review effort: Balanced

Comment thread tests/lifecycle/driver.py Resolved
Comment thread tests/utils/apm_lifecycle_runner.py Resolved
Comment thread tests/utils/click_tree.py Resolved
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… command in uninstall docs

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…tup; group options before a subcommand

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4107)

The steward approved definition rule U-BIN: bin/ deploys only for a
marketplace plugin at user scope with the Claude target. One absence row per
path shape (project install, user-scope install, dry-run, bundle install,
unpack) now earns its receipt with I1-I9. The other 36 absence rows are U-BIN
definition cells and are removed. The five marketplace-install rows stay
strict on #4225.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… deny by identity (#4107)

At -g the approval gate parks p-exec's hook and MCP server until approved
(positive control: both deploy after apm approve), and apm deny -g by the
installed identity retires both. Org-sourced controls at -g are definition
cells (#3703); deny by install spec stays strict on #4189.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…n bin/ deploy widens (#4107)

Lifted from #4227 @ 2ce5a26 (tests/lifecycle/generator/bin_pin.py and its
mutation cases) per the T lead's ownership correction.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…he mcp-deny repeat (#4113)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ed on approve <package>) (#4113)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ch_failure=block cache blocks and the pin agrees (#4108)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…any command, not every non-ASCII byte (#4113)

Main's cell matched any non-ASCII install output, which excused real
violations and broke the oracle's own unit tests; it now needs a path
character the test's own cwd does not explain. deps list and export-patch
echo the same path.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 5ac8608 into main Nov 20, 2026
1 check passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-redesigned-doodle branch November 20, 2026 14:17
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Take main for the driver, the Click resolver and the docs-surface test; keep
T2 witnesses in promise_obligations.json.

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

Labels

full-integration Run the full integration suite (ci-integration.yml) on this PR before merge

Projects

None yet

2 participants