Builds the L11 lived-spine half on top of Shape B+ T-resume: prove the continuous/resumed life is the SAME identity, with a content-derived, hash-chained lineage and a falsifiable behavioral proof. - core/engine_identity.py (L11-1): EngineIdentity = sha256 of the ratified PERSONALITY substrate (identity/safety/ethics/register/anchor-lens pack files) + code revision. Content-derived, NOT entropy — same substrate => same identity (cross-engine portable). The "who am I" hash; bumped by a ratified identity change, NOT by lived learning (that is experience, carried by Shape B+). - engine_state + chat/runtime (L11-2): every checkpoint manifest stamps engine_identity + parent_engine_identity (git-like lineage). Stable substrate => identity == parent (one continuous life); a ratified change => the bump. - chat/runtime + config (L11-3): on reboot, recompute identity and compare to the stamped one. Mismatch (substrate changed while down) surfaces a warning + identity_continuity_break flag; strict_identity_continuity (opt-in) refuses (IdentityContinuityError). Default warns — reboot is recovery, not control flow (ADR-0157); the operator must not be bricked by a benign ratified pack swap. - tests (L11-4): the proof. Continuity is SUFFICIENT (byte-identical resume + no break under a fixed identity), identity is LOAD-BEARING (distinct packs => distinct hashes), and the CONTRAPOSITIVE holds (resuming under a different identity raises the break). Same identity <=> continuous; different => break. Test hygiene (required by L11's always-on identity stamping): conftest isolates the default engine_state dir per test; the refusal-calibration cold-start probe uses no_load_state=True. Both prevent cross-test identity-lineage pollution. 19 dedicated tests; curated smoke green (no spurious break warnings).
64 lines
2.7 KiB
Python
64 lines
2.7 KiB
Python
"""Project-root conftest — quarantine registry for known-failing tests.
|
|
|
|
The QUARANTINE set lists test IDs that are pre-existing failures
|
|
predating the substrate-liveness audit work (verified via bisect
|
|
against c1a1b7a, the commit immediately before the first W-* PR
|
|
of 2026-05-24). The CI gate at .github/workflows/full-pytest.yml
|
|
runs ``pytest -m "not quarantine"`` so these failures do not block
|
|
PRs, but the suite is a ratchet: a quarantined test removed from
|
|
this set must pass on its own merits.
|
|
|
|
See docs/test-debt-quarantine.md for cluster diagnoses, removal
|
|
policy, and the per-test rationale.
|
|
|
|
To remove a test from quarantine:
|
|
1. Land a PR that makes the test pass.
|
|
2. Delete its entry from QUARANTINE in the same PR.
|
|
3. The full-pytest CI gate will now require it to keep passing.
|
|
|
|
Adding a test to QUARANTINE is strongly discouraged. If a new
|
|
failure surfaces, the right default is to fix it in the PR that
|
|
caused it — not to quarantine. The set should only shrink.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
import engine_state
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _isolate_engine_state_default(tmp_path_factory, monkeypatch):
|
|
"""Isolate the default engine-state checkpoint dir per test.
|
|
|
|
A bare ``ChatRuntime()`` (no ``engine_state_path``) falls back to
|
|
``engine_state._DEFAULT_DIR`` — the shared repo ``engine_state/`` directory.
|
|
Tests must not share that mutable dir: one test's checkpoint (recognizers,
|
|
candidates, the stamped engine-identity, and — under resume mode — the lived
|
|
session_state) leaks into another test's fresh-state assumptions (and, since
|
|
L11, raises spurious identity-continuity-break warnings when a later test
|
|
boots under a different identity over the same dir). Point the default at a
|
|
fresh per-test temp dir. Tests passing an explicit ``engine_state_path`` are
|
|
unaffected; within one test, repeated ``ChatRuntime()`` share this dir.
|
|
"""
|
|
isolated = tmp_path_factory.mktemp("engine_state_default")
|
|
monkeypatch.setattr(engine_state, "_DEFAULT_DIR", isolated)
|
|
|
|
|
|
QUARANTINE: frozenset[str] = frozenset()
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items):
|
|
"""Stamp the quarantine marker on any test whose nodeid is listed
|
|
in QUARANTINE. Tests not in the set are unaffected.
|
|
|
|
The CI gate runs ``pytest -m "not quarantine"`` so quarantined
|
|
tests are silently skipped in CI. Local ``pytest`` runs include
|
|
them by default (still useful for debugging individual fixes).
|
|
"""
|
|
_ = config # pluggy hook signature requires the name `config`; not used here
|
|
quarantine_marker = pytest.mark.quarantine
|
|
for item in items:
|
|
if item.nodeid in QUARANTINE:
|
|
item.add_marker(quarantine_marker)
|