Skip to content

test(lifecycle): W3c engine cells: kill mid-commit recovery, decide-mode cache stats - #4916

Merged
Daniel Meppiel (danielmeppiel) merged 14 commits into
mainfrom
danielmeppiel-perf-engine-parity-w3c
Nov 23, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 14 commits into
mainfrom
danielmeppiel-perf-engine-parity-w3c

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

W3c cells for the lane C engine train (#4893), stacked on #4849 (frozen at 905d3d0). They use the same kit and the same red-first KnownFailure(#4770) signature.

  • R1, kill mid-commit: test_kill_mid_commit_then_install_equals_the_full_world[after-first-package-published | after-first-file-linked | inside-services-render].
    • A sitecustomize hook, chained after the world's network guard, SIGKILLs the applying engine at a named apm_cli.install.diff_apply hook (_publish / _write / _render_services).
    • The next plain apm install must equal a full install: tree, lockfile text, receipts and file modes, with no .apm-resolution-staging left.
  • R2, decide-mode caches: test_declined_fast_path_writes_nothing[*] now also stats every cache path (size, mtime_ns), with roots included. The new test_decide_mode_hit_leaves_caches_untouched[noop | warm-locked] does the same for hits under read-only caches.
  • L5 (W3c B2): the escaped-U+202E hook cell accepts either declining guard (non-ASCII deployed content or no matching package record); it still requires FULL with parity.

Retargets to main once #4849 lands.

Issue and approved scope

Issue: Refs #4770

Human scope-approval comment: Lane C build plan (perf org), VP ruling for the W3c cells; test-only, no product code.

Does this PR complete the issue, or what remains? No. It adds gate cells; the engine lands in #4893.

Type of change

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

Testing

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

Local at main, engine driver, through host_guard: pytest tests/lifecycle/scenarios/test_engine_parity.py -k "kill_mid_commit or decide_mode_hit or writes_nothing or write_fault" -n 0 -> 47 deselected, 18 xfailed. Every cell is known-red on the missing-decision signature, and there are no unexpected failures. Evidence at the #4893 head will be posted as a comment.

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.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

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

…cache stats

R1: kill the applying engine (SIGKILL via a sitecustomize hook chained after the
network guard) after the first package publish, after the first file link and
inside the services render; the next plain install must equal a full install in
tree, lock, receipts and modes, with no staging left.
R2: decide-mode declines and hits stat every cache path (size, mtime_ns), roots
included, so a write, utime, eviction or created root is visible.

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

An unguarded SIGKILL lookup breaks Windows test collection, and writable-cache tests fail to verify the claimed read-only-cache behavior.

2 open issues
What changed in this PR

This test-only PR extends the lifecycle parity suite from #4849 with recovery and cache-immutability checks for the locked-install engine in #4893.

Changes:

  • Adds three SIGKILL injection points and checks that a subsequent install recovers to full-install state.
  • Adds cache metadata checks for declined decisions and no-op/warm-locked hits.
  • Allows either supported decline reason for the escaped-Unicode hook case while retaining full-run parity checks.
File Description
tests/​lifecycle/​scenarios/​test_engine_parity.py Adds recovery cells, cache-stat assertions, shared fault-hook setup, and broader Unicode decline expectations.

Review effort: Balanced

…commit_package, _write, _render)

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

Copy link
Copy Markdown
Collaborator Author

Evidence at #4893 head fb32632. One serial host_guard run with the engine driver, in an evidence worktree at fb32632 with this PR's test files (head 765012e) overlaid:

pytest tests/lifecycle/scenarios/test_engine_parity.py -k "kill_mid_commit or decide_mode_hit or writes_nothing or write_fault or escaped_hidden" -n 0 -> 3 failed, 16 passed

  • R2 passes: 12 decide declines and 2 decide hits leave every cache path's size and mtime_ns unchanged.
  • R1 fails at all 3 crash points (red-first, as required). Tree, lock text, receipts and modes equal a full install. The only difference is in HOME: ~/.apm/install-snapshots/deploy-<rand>/N files left by the SIGKILLed journal and never reclaimed by the next install.

At main (this branch), the touched set is 18 xfailed, all on the missing-decision signature.

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

An unguarded signal.SIGKILL reference breaks Windows test collection, while the new scenarios fail to exercise genuinely read-only caches or recovery after partial service-configuration writes.

3 open issues

Review effort: Balanced

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Evidence at the final #4893 head a8e519d (_publish landed). One serial host_guard run with the engine driver, in an evidence worktree at a8e519d with this PR's test files (head 765012e) overlaid; the kit there is byte-identical:

pytest tests/lifecycle/scenarios/test_engine_parity.py -n 0 -> 64 passed, 1 xfailed in 405.48s

  • All 65 cells. The only xfail is test_fresh_install_on_a_warm_cache_applies_the_diff, KnownFailure(#4770), gated on the S4 fresh_apply seam, which is not on this train.
  • R1 passes at all 3 crash points (_publish, _write, _render). After SIGKILL and a plain install, tree, lock text, receipts and modes equal a full install, with no install-snapshots or .apm-resolution-staging left.
  • R2 passes: decide-mode declines (12) and hits (2) leave every cache path's size and mtime_ns unchanged.

At fb32632, R1 was red (leaked install snapshots). The fix is in a8e519d.

…s for decide hits

- New crash point after the first durable service write (run_services + write
  seam hooks); the fixture deletes the MCP configs so services must rewrite them.
- Decide-mode hits run with every cache write bit dropped and compare mode bits.
- SIGKILL lookup tolerates Windows collection.

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 block approval of the lifecycle parity test changes.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
… relaxed escape reason)

Identical to #4916 head 78eabdf, so the two PRs merge cleanly in either order.

Co-authored-by: Copilot App <[email protected]>
…e full pipeline

HeldOutput.release raises a broken-pipe OSError on a warm-locked apply: the
command exits non-zero, no second pipeline runs, at most one decision line,
and the tree equals a full install.

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

Copy link
Copy Markdown
Collaborator Author

Evidence at #4893 head 2f7ae30 (no-clobber publish; non-directory or symlink package paths decline). One serial host_guard run with the engine driver; this PR's test files (head 703f3ca) are overlaid:

pytest tests/lifecycle/scenarios/test_engine_parity.py -n 0 -> 66 passed, 1 xfailed in 414.15s (all cells, incl. the new output-failure cell; the xfail is the S4 fresh hit, gated on fresh_apply).

New cell test_output_failure_after_commit_never_runs_the_full_pipeline:

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.

🔵 Needs a closer look

Human assessment is needed because the decision-mode test can pass despite unintended apply execution, leaving potential project-file changes undetected.

No open issues 🎉

Review effort: Balanced

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
- The decline invariant digests raw bytes, raw symlink targets, directories and
  full lstat modes (no <ROOT> normalization).
- The escaped-unicode hook cell requires the approve step itself to succeed.

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 identified for the test-only lifecycle parity coverage changes.

No open issues 🎉

Review effort: Balanced

The W3c cells follow the same family split: kill-mid-commit, decide-mode hits and
the output-failure cell join test_engine_parity_invariants.py; their measured
per-cell durations join the seed.

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 reported for the test-only lifecycle parity regression coverage.

No open issues 🎉

Review effort: Balanced

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
… judges its targets

The install judges its effective targets (auto-detect included) against the
org compilation-target policy, while audit judges only declared targets; the
engine now runs that same check (run_dependency_policy_checks with the
effective target decision) and declines on any finding. The lost-race cell
races the platform's no-replace primitive (rename on Windows). Adopts #4916's
split engine parity modules and measured CI durations byte-identical.

Co-authored-by: Copilot App <[email protected]>
…ing deployed file after a no-op hit

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 block the test-only install-engine parity changes.

No open issues 🎉

Review effort: Balanced

Union: the #4849 oracle (receipt_history, receipt directory and mode, HOME mode
parity, s/m/h policy age, main merges) plus the W3c cells; one new seed entry.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
e634b5c)

The oracle compares receipt history only between same-history twins
(receipt_history=False by default), so an incremental install's prior-write
history no longer fails W4's incremental == fresh deploy cell.

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 block the test-only expansion of recovery and cache-safety coverage.

No open issues 🎉

Review effort: Balanced

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
Base automatically changed from danielmeppiel-perf-engine-parity to main November 23, 2026 10:45

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 this test-only expansion of lifecycle recovery and cache-immutability coverage.

No open issues 🎉

Review effort: Balanced

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
Parity kit and CI durations stay byte-identical to #4916 5a473a7, which
already contains this main.

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

# Conflicts:
#	.github/ci-durations/linux-x86_64.json

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 post-commit-failure comparison omits receipt history, allowing loss of historical hashes to pass undetected; both sides should enable receipt_history=True.

1 open issue

Review effort: Balanced

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.

2 participants