Skip to content

test(lifecycle): split journey oracle O8 into O8a remediation and O8b diagnostic - #4653

Closed
Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
mainfrom
ql-w1-4571-o8-split
Closed

Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
mainfrom
ql-w1-4571-o8-split

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

Splits journey oracle O8 into O8a remediation and O8b diagnostic (#4571). Test-side only; APM output and behaviour are unchanged.

Root cause: O8 ran every printed Run 'apm ...' advice and required the failing command to pass afterwards. Diagnostic advice exists to show why a step failed, not to fix it, so O8 could not model it:

  • E04 step 4 sat on a strict cell keyed to [BUG] Inaccessible-repository failure does not name the credential source tried #4174 (already closed).

  • J13 step 4 passed vacuously: it ran apm list, then reran apm run review, which already worked in step 3, instead of the failing apm run missing.

  • O8a (REMEDIATION-TRUTH) is today's O8, renamed in tests/lifecycle/journeys/index.yaml, the runner, and E01's known cell.

  • O8b (DIAGNOSTIC-TRUTH) works on a copy of the project in the step's own environment. The advice must write nothing and exit 0 or with the failing exit. It must print every line it promises that the step did not already print (strictly more information). The failing command must keep its exit.

  • Journey files mark each advice as remediate (O8a) or diagnose: {advice, promises} (O8b). check_journey_file rejects advice whose kind disagrees with the index, and test_advice_kind_follows_the_index pins that check.

  • E04 step 4 carries test(lifecycle): re-ground 21 stale known cells; sign and gate every known cell #4584's hunk verbatim: key lines for the host, credential and advice, and the e04 strict cell keyed to [BUG] Inaccessible-repository failure does not name the credential source tried #4174 (already closed) is dropped. Its advice apm install --verbose lifecycle.ghe.com/lifecycle/p-missing must print source=GITHUB_APM_PAT_LIFECYCLE and Trying git ls-remote for lifecycle.ghe.com; the advice text promises "each probe and credential".

  • J13 step 4 (audit finding): apm list must print the command column (cat review.prompt.md); the advice text promises "each script and its command".

  • The other remediation advice (J03, J04, J12, J14, E02, E06) actually fixes its step and stays O8a.

  • Also: O8b runs the advice under the failing step's env; O8 never applied it. The test_journeys.py promise marker now lists its ids literally so the tm006 gate can read them (same hunk as test(lifecycle): re-ground 21 stale known cells; sign and gate every known cell #4584). The journey-space id pattern accepts O8a/O8b.

Obligations (python -m tests.lifecycle.witnesses): 1064 required / 27 known failing -> 1065 / 26. J|E04|4|O8b and J|J13|4|O8b are required, and the 9 remediation ids are renamed J|*|O8 -> J|*|O8a.

H7 coupling: this PR couples with #4584 on E04-private-hosts.yaml (the same step-4 hunk), the test_journeys.py promise marker, and tests/quality/generated_obligations.json. Whichever lands second regenerates the JSON with python -m tests.lifecycle.witnesses --write and drops the duplicate hunk.

Issue and approved scope

Issue: Fixes #4571 (Refs #4565, the epic)

Human scope-approval comment: the apm-scope:v1 approve record on #4571 (review contact Daniel Meppiel (@danielmeppiel)). Ordering ruling from the Q&L lead: build on main, carry #4584's E04 hunk, and #4571 lands first.

Does this PR complete the issue, or what remains? It completes #4571. O8b exists in index.yaml and test_journeys.py, J|E04|4|O8b is required and passes, the generated snapshot is regenerated, and the index carries no comment citing #4571.

Type of change

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

Testing

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

All runs through the host guard, on a worktree with its own venv, engine driver, APM_E2E_TESTS=1:

  • pytest tests/lifecycle/journeys/test_journeys.py::test_journey[E04] [J13] [E01]: 3 passed.
  • pytest tests/lifecycle/journeys/test_journeys.py -k "advice_kind or agree_with_the_index": 7 passed.
  • pytest tests/quality/test_journey_index.py tests/quality/test_generated_obligations.py tests/quality/test_promise_obligations.py tests/lifecycle/generator: passed (96).
  • python -m tests.lifecycle.witnesses: up to date, 1065 required / 26 known. python -m tests.lifecycle.generator --check: up to date.
  • Lint contract: uvx [email protected] check and format --check, pylint R0801, lint-auth-signals.sh, check_complexity_ratchet.py --base-ref origin/main, python -m tests.quality.taxonomy --changed (tm006 ok): all pass.
  • I did not run the other journeys locally (host load); CI and the nightly journeys cover them. Only the O8 -> O8a rename touches them.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md:
    user-visible effect first, 25 words or fewer, ending with (#PR);
    breaking changes only under upgrade notes; no Highlights; see
    .github/instructions/changelog.instructions.md.
  • 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.

… 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]>

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 probe shares durable paths with the continuing journey, while its filtered project-only diff misses state writes and directory creation, allowing mutations to pass the read-only assertion and affect later steps.

2 open issues
What changed in this PR

Splits lifecycle advice validation into remediation (O8a) and diagnostics (O8b), addressing #4571 without changing APM product behavior.

Changes:

  • Adds diagnostic checks for promised information, exit behavior, and filesystem changes.
  • Reclassifies E04 and J13 as diagnostic journeys while retaining remediation checks elsewhere.
  • Updates catalog validation, promise declarations, and generated obligation IDs.
File Description
tests/​quality/​test_journey_index.py Pins the oracle catalog to include O8a and O8b.
tests/​quality/​test_generated_obligations.py Accepts suffixed oracle IDs in journey obligations.
tests/​quality/​generated_obligations.json Refreshes required and known-failing obligation mappings.
tests/​lifecycle/​journeys/​test_journeys.py Implements O8b, validates advice kinds, and makes promise IDs literal.
tests/​lifecycle/​journeys/​index.yaml Defines both advice oracles and updates journey assignments.
tests/​lifecycle/​journeys/​enterprise/​E04-private-hosts.yaml Checks diagnostic credential/probe output and removes the stale known cell.
tests/​lifecycle/​journeys/​enterprise/​E01-org-policy-rollout.yaml Renames the known cell’s oracle to O8a.
tests/​lifecycle/​journeys/​consumer/​J13-run-scripts.yaml Replaces the unrelated successful rerun with diagnostic script-list checks.

Review effort: Balanced

… 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]>
#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]>

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 durability check misses writes to cache and configuration roots outside HOME, allowing O8b to pass despite persistent mutations; those roots need coverage and a negative regression test.

1 open issue
2 resolved since last review

Review effort: Balanced

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Superseded by #4584, which re-grounds these cells and Fixes #4571. #4584 now lands inside lifecycle train L #4769. Closing so the O8 split doesn't land twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TEST] Journey oracle O8 cannot model diagnostic advice (split remediation vs diagnostic)

2 participants