feat(frozen-bundles): the measurements read a pinned copy, not another repo's build dir
Measured 2026-09-17 17:43: vegnormal-okf rebuilt build/ferdig/r761-2025 while this repository's v1 gate, the stress judge and four corpus tests pointed straight at it. Rows 6-7 went IKKE MAALT and five tests fell, for a change no one here made. The failure mode was never falsehood - the gate says IKKE MAALT and exits non-zero, never green - it was instability: two projects shared a directory neither owns, so what this repository MEASURES could move without a commit here. A copy alone would push that directory one move away, so the copy comes with a pin. frozen_bundles.json (tracked) carries path + sha256 + file count per base; the bundles themselves are NEVER committed here. Three states, separated by construction: match -> resolves; gone -> FrozenBundleMissing (an OSError, so the gate's existing except OSError gives IKKE MAALT + exit 1 unchanged and the corpus tests SKIP, MAJOR-3's ceiling); drift -> FrozenBundleDrift (a ValueError), loud, named, and never a skip. The two classes are deliberately unrelated: a caller that catches "missing" to skip must not swallow "drift". The NAME is hashed alongside the bytes, and the directory name carries the first 12 chars of the digest so a stale copy is visible in ls. Renewal is a decision: new copy + new pin in the SAME commit (README). --bundle-root / PORTFOLIO_VEGNORMAL_ROOT stays as the operator's explicit, UNPINNED live mount. Iron Law: the tests were written and run RED first (collection error, then two arms of my own making). Load-bearing MEASURED, eight mutations all red against the WHOLE suite with a green control of 1984 passed / 5 skipped / 5 xfailed and a strict node-id superset (1977 -> 1994, 0 removed): M1 the pin is never verified (7) - M2 drift collapsed into missing (5) - M3 the name is not hashed (40) - M4 the gate seam reverted to root/name (1) - M5 the corpus helpers skip on drift too (4, one per file) - M6a the slash spelling back in src (1) - M6b the quoted path segment back in a test (1) - M7 the directory name drops the short digest (1, and 45 skipped, which proves absence is a SKIP and not a false green) - M8 the explicit override ignored (3, two of them in test_stress_judge_loadbearing.py, independent witnesses older than this work). M2 FALSIFIED THE TEST FIRST: the four parametrised arms did not go red, they went to SKIP (5 -> 9 skipped) and stayed green - pytest.skip inside a pytest.raises is not a failure. The arm now catches pytest.skip.Exception explicitly and turns it into an AssertionError. grep -rnE 'vegnormal-okf/build|["'"'"']vegnormal-okf["'"'"']' src tests contexts -> 0 (3 + 4 hits before; the three remaining prose mentions document history and are allowed). Gate re-run against the frozen copy: identical to the live mount (rows 0/3 - 0/3 - 3/8 - no report - 3/8 - IKKE MAALT - 1/20, exit 1). Order 20260917T223645Z-1296211942-from-.claude. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
9825b2677c
commit
50c9763706
12 changed files with 654 additions and 60 deletions
|
|
@ -39,13 +39,12 @@ keys on. Rule U itself is UNCHANGED, and its known-positive is still red.
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from portfolio_optimiser import okf
|
||||
from portfolio_optimiser import frozen_bundles, okf
|
||||
from portfolio_optimiser.ir import CostBaseline, CostBaselineLine
|
||||
from portfolio_optimiser.mandate import load_mandate
|
||||
from portfolio_optimiser.stress import read_bundle_declarations
|
||||
|
|
@ -53,10 +52,9 @@ from portfolio_optimiser.stress import read_bundle_declarations
|
|||
_REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
_CONTEXT_ROOT = _REPO_ROOT / "contexts"
|
||||
|
||||
#: Where the vegnormal bases are mounted. A SYMBOLIC name in ``bundle.txt`` is resolved against
|
||||
#: this, never an absolute path in the set: this repository is published, and an absolute path
|
||||
#: would pin a set to one machine's home directory and ride out in the handover archive.
|
||||
_DEFAULT_BUNDLE_ROOT = Path.home() / "repos" / "vegnormal-okf" / "build" / "ferdig"
|
||||
#: A SYMBOLIC name in ``bundle.txt`` is resolved against the frozen store, never an absolute path
|
||||
#: in the set: this repository is published, and an absolute path would pin a set to one machine's
|
||||
#: home directory and ride out in the handover archive.
|
||||
|
||||
#: The concept types the four bases declare. ``index.md`` carries none of them — it is navigation,
|
||||
#: not content — which is why the file count and the concept count differ.
|
||||
|
|
@ -107,8 +105,16 @@ def own_frontmatter(path: Path) -> dict[str, str]:
|
|||
return out
|
||||
|
||||
|
||||
def _bundle_root() -> Path:
|
||||
return Path(os.environ.get("PORTFOLIO_VEGNORMAL_ROOT", str(_DEFAULT_BUNDLE_ROOT)))
|
||||
def _bundle_dir(name: str) -> Path:
|
||||
"""The FROZEN copy this repository pins, resolved at call time.
|
||||
|
||||
Absence SKIPS (MAJOR-3's ceiling: no corpus is mounted in the handover archive), drift is
|
||||
allowed to propagate and FAIL — a measurement of the wrong corpus is not a missing one.
|
||||
"""
|
||||
try:
|
||||
return frozen_bundles.bundle_dir(name)
|
||||
except frozen_bundles.FrozenBundleMissing as exc:
|
||||
pytest.skip(str(exc))
|
||||
|
||||
|
||||
#: The ONE reader, imported from production rather than copied here (P17b). It used to be a
|
||||
|
|
@ -167,13 +173,7 @@ _SET_IDS = [p.name for p in _SETS]
|
|||
|
||||
|
||||
def _require_base(declared: dict[str, str]) -> Path:
|
||||
root = _bundle_root()
|
||||
base = root / declared["name"]
|
||||
if not base.is_dir():
|
||||
pytest.skip(
|
||||
f"knowledge base {declared['name']!r} not mounted under {root} (PORTFOLIO_VEGNORMAL_ROOT)"
|
||||
)
|
||||
return base
|
||||
return _bundle_dir(declared["name"])
|
||||
|
||||
|
||||
def _base_by_approach(set_dir: Path) -> dict[str, Path]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue