pkt.2 — coverage gap (green-but-dead): link_in_index preserves the existing index byte-for-byte and in order on the SUCCESS path by construction, but nothing asserted it. Byte-equality was checked only on the REFUSAL path (test_step8_promotion_loadbearing.py Test A); other tests check mere line MEMBERSHIP. A writer that kept every link but reordered/rewrote the existing body would pass the whole suite — the exact ingest-spec §6 / Step-8 promotion invariant we rely on (promoted verdict links survive re-ingest byte-for-byte). New test uses deliberately non-sorted existing links; proven load-bearing (a temporary `sorted()` reorder mutation flips it RED, then reverted). Test-only, no production change. pkt.4 — shared_root.py docstring overclaimed "Every MAF-side consumer resolves through this ONE seam". Verified: both runtime consumers (persona, simulation) do route through shared_root(); the 15 test modules hardcode the in-repo fixture path deliberately (a test needing the real fixture must not be redirected by a production env var). Scoped the claim to "runtime consumer" rather than churning 15 test files to make a false claim true. Full suite 415 passed, ruff + mypy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVHLJuwBzp7MXkrUXJYARS
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
"""Resolver for the location of the shared framework-neutral core (S3, R1-forberedelse).
|
|
|
|
``shared/`` is today an in-repo directory, but is slated for extraction into its own commons repo
|
|
(R1/S4). Every MAF-side runtime consumer (``persona``, ``simulation``) resolves its location through
|
|
this ONE seam so the extraction is a re-point (env var), not a code change. Test fixtures pointing at
|
|
the real in-repo bundle hardcode the path deliberately — they must not be redirected by a production
|
|
env var. Pure stdlib — the shared core itself stays framework-free.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
ENV_VAR = "PORTFOLIO_SHARED_ROOT"
|
|
|
|
_DEFAULT = Path(__file__).resolve().parents[2] / "shared"
|
|
|
|
|
|
def shared_root() -> Path:
|
|
"""Resolve the shared-core root at CALL time: ``PORTFOLIO_SHARED_ROOT`` if set (non-empty),
|
|
else the in-repo default. The call-time read is what keeps the override testable and the S4
|
|
extraction re-pointable without touching consumers."""
|
|
override = os.environ.get(ENV_VAR)
|
|
return Path(override) if override else _DEFAULT
|