Skip to content

test(lifecycle): train L -- signed known cells (#4584) and bundle allow-list policy (#4677) - #4769

Merged
Daniel Meppiel (danielmeppiel) merged 46 commits into
mainfrom
ql/lifecycle-train-l
Nov 22, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 46 commits into
mainfrom
ql/lifecycle-train-l

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Lifecycle train L: two cars that #4711 left conflicting, folded on main 4efc3c5 with one lifecycle regen.

Supersedes #4584
Supersedes #4677

Cars:

Integration fixes, train-only:

Regen: python -m tests.lifecycle.generator, python -m tests.lifecycle.witnesses --write, python -m tests.quality.known_cell_issues --write. The result is 1084 required and 7 known failing; every cited issue is open. Obligation status and witness changes against main: none.

Issue and approved scope

Issue: Refs #4565

Human scope-approval comment: the cars carry their own approvals (#4571 via #4584, #4646 via #4677). This train is an integration vehicle assigned by the Q&L lead.

Does this PR complete the issue, or what remains? It lands both cars. It closes #4571 and #4646 via the cars' own Fixes lines in their commits; the epic #4565 continues.

Fixes #4571
Fixes #4646

Type of change

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

Testing

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

Validation evidence (local, host_guard -n 2): the lint chain is clean (ruff 0.15.12 check and format, AQ ratchet, taxonomy --changed, generator --check). The cars' unit and quality tests run locally and in CI; Integration is dispatched on this branch.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md. (Carried by feat(policy): judge local bundles against dependencies.allow by their recorded packages #4677.)
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour beyond what the cars already carry.

Co-authored-by trailers (car authorship): danielmeppiel (W3b, #4584); danielmeppiel (P1 ENG 627e10f5, #4677).

…n cells

The 21 cells citing closed #4053, #4178, #4224 and #4174 still failed on
main, but for new reasons: the fixes had landed and the oracles were stale.

- #4053 (10 LSP gate cells): --frozen now refuses with 'records an
  executables decision the gate no longer makes'; FROZEN_REFUSAL accepts
  it and the cells are required.
- #4178 (9 approve cells): approve routes the org policy through the trust
  reader once; block classes refuse and write nothing, warn classes report
  'Org policy not applied' once. Expectations follow; cells required.
- J|E01|4|O8: sarif audit now names the failed check (#4224) but no format
  prints a runnable remedy: re-keyed to #4570.
- J|E04|4|O8: the advice is diagnostic (#4174); O8 cannot model it
  (residual #4571), so step 4 drops O8 and pins host, credential, advice.

KnownFailure (tests/lifecycle/known.py) replaces raw strict xfails: it
names the tracking issue and the failure signature, and a makereport hook
fails a known cell that failed without it. The gate
tests/quality/test_known_cells_cite_open_issues.py requires every known
cell to cite an issue recorded OPEN in known_cell_issue_states.json.

Refs #4565, #4549

Co-authored-by: Copilot App <[email protected]>
- KnownFailure gains kind (bug | deferred-design) and raises; the
  signature plugin is registered by tests/conftest.py for every suite.
- The #4543 @registry shorthand cells (a deferred design whose tracker
  stays open) become KnownFailure(kind='deferred-design') with their
  failure signature; reason text and strictness are unchanged.
- The gate now discovers every strict xfail in tests/ by AST, so a raw
  strict xfail anywhere must cite an issue recorded OPEN.
- test_journeys.py names its promise ids literally (tm006 --changed).

Refs #4565, #4549

Co-authored-by: Copilot App <[email protected]>
…cells

- Scenario Known cells of test_failure_phase cited closed #4164, but still
  fire with their original signature: product residual filed as #4594 and
  the cells re-keyed to it.
- Table-level known cells need an open issue and a failure signature:
  machine KNOWN_CELLS_BY_ID and KNOWN_T4 map to KnownFailure; scenario
  credits take a Known; Known, known_defect and KnownCell reject '#0' and
  an empty match.
- The gate's static scan covers Known, known_defect and KnownCell and
  resolves module-level tracking constants.

Refs #4565, #4549

Co-authored-by: Copilot App <[email protected]>
…s its signature

Review follow-up. An oracle failure can list a known violation next to an
unrelated one; a substring search over the whole message kept the row
xfailed and hid the new one. For a lifecycle oracle failure (header, one
line per violation, then 'args=' evidence) every violation line must now
match the KnownFailure signature; other failures keep a message search.
The #3703 signature names all three of its symptoms, and the gate test
adds a mixed known-plus-new case that must fail.

Refs #4565, #4549

Co-authored-by: Copilot App <[email protected]>
Resolve: main's new strict known cell X|install|pkg-registry|UPDATE=on
(#4572) becomes a KnownFailure with its KnownCell signature; the issue
snapshot records #4572 OPEN.

Co-authored-by: Copilot App <[email protected]>
…3-red-triage

# Conflicts:
#	tests/lifecycle/machines/test_m_source.py
…riage

# Conflicts:
#	.github/workflows/ci.yml
#	.github/workflows/main-architecture-ratchets.yml
Union resolution: main's source rule cells keep the KnownFailure-typed
KNOWN_CELLS_BY_ID; both FIRST_PARTY_MCP_CELL and KnownFailure imports;
snapshot drops #4324 (no longer cited on main).

Co-authored-by: Copilot App <[email protected]>
… diagnostic

O8 ran every printed "Run 'apm ...'" advice and required the failing
command to pass afterwards. That cannot model diagnostic advice, whose
job is to show why a step failed, so E04 step 4 sat on a strict cell
keyed to a closed issue and J13 step 4 passed vacuously (`apm list`,
then a rerun of a different command that already worked).

- O8a (REMEDIATION-TRUTH) is today's O8, renamed in the index, the E01
  known cell and the runner.
- O8b (DIAGNOSTIC-TRUTH): in a copy of the project and the step's own
  environment, the advice writes nothing, exits 0 or with the failing
  exit, prints every line it promises that the step did not, and the
  failing command keeps its exit.
- Journey files mark advice as `remediate` (O8a) or `diagnose` (O8b with
  promises); check_journey_file refuses a mismatch with the index.
- E04 step 4 (#4584's hunk carried verbatim: host, credential and advice
  key lines, the e04 strict cell keyed to closed #4174 dropped) and J13
  step 4 are O8b: J|E04|4|O8b and J|J13|4|O8b are required.

Fixes #4571
Refs #4565

Co-authored-by: Copilot App <[email protected]>
… quality module

The static O8a/O8b schema test asserted no CLI outcome inside the e2e
journey module (AQ003). It is a schema check, so it lives with the
other journey-index checks (unit).

Refs #4571

Co-authored-by: Copilot App <[email protected]>
…filtered diff

Review on #4653:
- The diagnostic probe is a clone of the whole world (project, HOME,
  APM_HOME, caches) under the failing step's environment, so advice
  that writes outside the project cannot leak into later steps and is
  seen by the read-only check.
- "Writes nothing" compares every durable root with the unfiltered
  artifact diff (bookkeeping such as .apm-local and directory entries
  included), not the journey's filtered file delta.

Refs #4571

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	tests/lifecycle/journeys/enterprise/E01-org-policy-rollout.yaml
#	tests/lifecycle/journeys/enterprise/E04-private-hosts.yaml
#	tests/lifecycle/journeys/index.yaml
#	tests/quality/generated_obligations.json
#4224 is closed; #4570 tracks the missing runnable next step of a failed
dependency-allowlist audit.

Refs #4571

Co-authored-by: Copilot App <[email protected]>
…4571)

The obligation-status ratchet (#4586, now on main) requires a named rule for
each required id that disappears; the 9 journey O8 ids are witnessed by
their O8a/O8b successors.

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	tests/lifecycle/scenarios/test_failure_phase.py
#	tests/quality/generated_obligations.json
… recorded packages (#4646)

dependencies.allow matches only the packages a local bundle's embedded
lockfile records, with the remote-dependency matcher; it never matches
the author-chosen _local/<name>. Under an allow list a bundle that
records no package is refused before any write. dependencies.deny still
matches the bundle name and its packages.

Co-authored-by: Copilot App <[email protected]>
… allow (#4646)

apm-spec-waiver: local bundle install applies the existing dependencies.allow matcher (req-pl-005, req-pl-018) to the packages its embedded lockfile records; the spec does not define local bundle admission, so no new contract.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Train L cancelled (rule 15e: singles). #4584 lands as a single; #4677 lands alone via P1.

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Reopened: the lead withdrew the cancel (it crossed this push). #4769 lands as the unit for #4584 + #4677.

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

The xfail signature check only covers the test call phase, allowing unrelated fixture failures to remain expected failures; setup and teardown exceptions need validation and regression coverage.

1 open issue
What changed in this PR

This PR integrates lifecycle test hardening with local-bundle allow-list enforcement, advancing the lifecycle coverage work in #4565 and addressing #4571 and #4646.

Changes:

  • Adds tracked failure signatures and an offline issue-state gate for known failures; updates stale expectations and generated obligations.
  • Splits journey advice checks into remediation (O8a) and diagnostic (O8b) checks.
  • Applies dependencies.allow to a bundle’s recorded packages, not its name, with tests, documentation, and an upgrade note.
File Description
tests/​unit/​test_reference_registry_shorthand.py Signs deferred shorthand failures.
tests/​unit/​test_apm_yml_registries.py Signs the registry-scope failure.
tests/​unit/​registry/​test_compat_matrix.py Signs shorthand compatibility failures.
tests/​unit/​install/​test_bundle_policy_subjects.py Tests bundle allow-list admission rules.
tests/​unit/​core/​test_remediation_w2_bundle_catalog.py Records evidence for the new remedy.
tests/​quality/​test_known_cells_cite_open_issues.py Adds tracking, snapshot, and signature checks.
tests/​quality/​test_journey_index.py Validates split advice-oracle definitions.
tests/​quality/​test_generated_obligations.py Accepts O8a/O8b obligation identifiers.
tests/​quality/​obligation_removals.json Records migration of old O8 obligations.
tests/​quality/​lifecycle_obligations.json Refreshes tracking and evidence references.
tests/​quality/​known_cell_issues.py Discovers trackers and refreshes issue states.
tests/​quality/​known_cell_issue_states.json Records cited issues’ open states.
tests/​quality/​generated_obligations.json Regenerates required and known-failing coverage.
tests/​lifecycle/​world/​test_world.py Supports signed failures and allow-list policy.
tests/​lifecycle/​world/​services.py Adds an allow-list policy fixture.
tests/​lifecycle/​security/​test_policy_outcomes.py Updates approval expectations and failure typing.
tests/​lifecycle/​security/​test_origin_and_credentials.py Uses signed failure definitions.
tests/​lifecycle/​security/​test_integrity.py Uses signed integrity-failure definitions.
tests/​lifecycle/​security/​test_gate_removal.py Applies signed gate-failure marks.
tests/​lifecycle/​security/​test_egress.py Applies signed egress-failure marks.
tests/​lifecycle/​security/​gate_slices/​native.py Signs known user-scope policy failures.
tests/​lifecycle/​security/​gate_slices/​mcp.py Types known failures as signed objects.
tests/​lifecycle/​security/​gate_slices/​lsp.py Removes stale LSP expected failures.
tests/​lifecycle/​security/​gate_slices/​hook.py Types known failures as signed objects.
tests/​lifecycle/​security/​gate_slices/​bin.py Signs known binary policy failures.
tests/​lifecycle/​security/​gate_slices/​__init__.py Updates the shared gate-row failure type.
tests/​lifecycle/​security/​gate_paths/​__init__.py Recognizes current frozen-lock refusal wording.
tests/​lifecycle/​security/​egress_slices/​__init__.py Updates the shared egress-row failure type.
tests/​lifecycle/​scenarios/​test_policy_pairs.py Shares signed failure data with credits.
tests/​lifecycle/​scenarios/​test_ownership_siblings.py Shares signatures and rekeys the MCP defect.
tests/​lifecycle/​scenarios/​_kit.py Validates tracking and requires signed credits.
tests/​lifecycle/​machines/​test_m_source.py Types the source-machine known-failure map.
tests/​lifecycle/​machines/​test_m_scope_lock.py Consolidates the typed T4 failure map.
tests/​lifecycle/​machines/​_kit.py Validates machine trackers and signatures.
tests/​lifecycle/​machines/​_gate_kit.py Validates gate-machine trackers and signatures.
tests/​lifecycle/​known.py Defines signed failures and report validation.
tests/​lifecycle/​journeys/​test_journeys.py Implements diagnostic advice checks and snapshots.
tests/​lifecycle/​journeys/​index.yaml Splits remediation and diagnostic oracle assignments.
tests/​lifecycle/​journeys/​enterprise/​E04-private-hosts.yaml Checks diagnostic advice for private-host failures.
tests/​lifecycle/​journeys/​enterprise/​E01-org-policy-rollout.yaml Rekeys the missing-remediation known failure.
tests/​lifecycle/​journeys/​consumer/​J13-run-scripts.yaml Treats script-list advice as diagnostic.
tests/​lifecycle/​generator/​witnesses.py Reads tracking from signed machine failures.
tests/​lifecycle/​generator/​rules.py Refreshes the policy evidence line reference.
tests/​integration/​test_org_dependency_allow_local_bundle_lifecycle.py Exercises bundle admission through the real CLI.
tests/​integration/​test_gitlab_sparse_transport_mutations.py Includes the plugin in isolated test copies.
tests/​conftest.py Registers the known-failure signature plugin.
src/​apm_cli/​policy/​policy_checks.py Enforces bundle package allow-list rules.
src/​apm_cli/​policy/​models.py Separates bundle names from recorded packages.
src/​apm_cli/​policy/​install_preflight.py Accepts structured bundle policy subjects.
src/​apm_cli/​install/​bundle_admission.py Supplies structured subjects to policy preflight.
src/​apm_cli/​core/​remediation.py Adds advice for bundles recording no packages.
packages/​apm-guide/​.apm/​skills/​apm-usage/​governance.md Documents bundle allow-list behavior.
docs/​src/​content/​docs/​reference/​policy-schema.md Specifies matching and enforcement semantics.
docs/​src/​content/​docs/​reference/​cli/​install.md Explains bundle allow-list refusal behavior.
docs/​src/​content/​docs/​enterprise/​apm-policy.mdx Explains bundle checks for policy administrators.
changelog.d/​4677.breaking-changes-and-upgrade-notes.md Records the compatibility impact and migration.
.github/​workflows/​merge-train.yml Runs the known-cell quality gate.
.github/​workflows/​main-architecture-ratchets.yml Runs the gate after main changes.
.github/​workflows/​ci.yml Adds the gate to CI checks.

Review effort: Balanced

Comment thread tests/lifecycle/known.py Resolved
pytest xfails a strict known cell whose fixture raises during setup too,
so a broken world could stand in for the tracked defect. The makereport
hook now checks the signature whenever the phase raised, and a pytester
regression proves a setup failure with another cause fails.

Co-authored-by: Copilot App <[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.

🟢 Approval recommended

No active review issues are recorded for the lifecycle test hardening and local-bundle policy changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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

The no-write oracle ignores durable-root existence changes, allowing creation or deletion of an empty directory to pass undetected.

1 open issue

Review effort: Balanced

…ed or removed

ArtifactSnapshot.diff compares entries only, so advice that created an
empty durable root (for example GH_CONFIG_DIR) passed the no-write check.
_raw_changes now reports a root whose existence changed; a smoke test
creates an empty GH_CONFIG_DIR between two durable snapshots.

Co-authored-by: Copilot App <[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.

🟢 Approval recommended

No active review issues are recorded for the lifecycle regression and local-bundle allow-list changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit f4efa6b into main Nov 22, 2026
89 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the ql/lifecycle-train-l branch November 22, 2026 21:50
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
Merge main f4efa6b and fold #4730 and #4769 (bundle allow-list policy from #4677) into the [0.38.0] block.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
Takes main's shared Known constants in test_ownership_siblings. Converts test_user_scope's #4744 known to a Known, since credits() now carries Known values (#4727). Refreshes known_cell_issue_states.json.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…nto train 6; regenerate

Train L landed the same fixes W3b's and W4's train-6 cars carried, so main's versions win: the lsp _XFAIL removal, the approve routing oracle (_APPROVE_UNRESOLVED), E04's diagnose step, E01's O8a and the FROZEN_REFUSAL comment. known_cell_issue_states refreshed.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
The known-cell guard (#4727, landed with #4769) reads each strict known cell's tracking from a literal or a module constant. The #3703 G1 bin cells and the #4744 target-change bin cell passed it through a loop variable or an attribute, so the guard saw an empty cite. Both issues are open and both cells still fail as tracked, so they keep their trackers, now named by module constants. known_cell_issue_states refreshed.

Co-authored-by: Copilot App <[email protected]>
Jason 'Jay' Jack (jasonjack-jay) pushed a commit to jasonjack-jay/Agent-Package-Manager that referenced this pull request Nov 23, 2026
…RED FIX)

Train L (microsoft#4769) removed the last known cell citing microsoft#4428, so
known_cell_issue_states.json still recorded it and
test_snapshot_records_exactly_the_cited_issues failed on main
(run 45074420503). Regenerated with
python -m tests.quality.known_cell_issues --write.

Co-authored-by: Copilot App <[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