mirror of
https://github.com/razzant/ouroboros.git
synced 2026-10-02 19:58:46 +00:00
Module side: 4 of 10 D03 owners are byte-identical to the reference and 4 more
are pure upstream drift (fit/budget/compaction/capability_evidence - nothing to
do, upstream bytes stand); the one split lands again from tip bytes:
ouroboros/context_runtime_facts.py (241 lines, 4 fact builders, 0 handle
rewrites - the leaf is projection-only by design) with the triple proof green
on every symbol (ast/tokens/bytes), and the facade shrinks 1590 -> 1380 with
the oracle's in-place re-export block and noqa discipline. The drift-probe
caught the reference leaf byte-falsified as a copy source: upstream b14ba397
rewrote _delegation_capability_fact (configured_route dropped, profile
evidence added) - copying the oracle leaf verbatim would have reverted that
feature; recorded in docs/v7next/LEDGER_CORRECTIONS.md (entries 7-11).
Test side: the 2080-line tests/test_context.py giant completes its S7a split
from TIP bytes (the giant drifted upstream, so oracle files could not be
carried blind): runtime_section (502) / memory (the D15-carried file
re-derived from tip and proven identical - not stale) / drive_state (233,
==oracle) / advisory_review (300, ==oracle) / _context_shared (49, ==oracle),
remainder 612. Lossless: 73==73 test functions, zero lost, zero added, and
the 15 memory tests that ran TWICE since the D15 carry are deduplicated. Two
upstream test rewrites (actor-scoped backlog digest, profile-evidence
delegation fact) travel to the oracle's destination as identity
continuations; 8 unrowed upstream recent-chat tests stay in the remainder
pending F5 rows. Oracle adaptations of test_context_fit_integration /
test_loop_compaction (loop -> loop_model_call) are foreign-domain spellings
whose leaf does not exist on this tree - reported, not applied.
size-ratchet manifest regenerated with the official tool: test_context.py
leaves GIANT_PATHS, context.py enters the band from the 1501-1600 zone with a
FLAGGED rationale (not self-approved). 74+110+228 tests green in isolation at
the lane base; ratchet lane 5 passed; ruff F clean; HEAD held through every
pytest run.
(cherry picked from commit 2021008bdb35436818b9ef3146ca69cb3a317b23)
49 lines
2.2 KiB
Python
49 lines
2.2 KiB
Python
"""The health environment builder shared by the context suites.
|
|
|
|
Split out of ``tests/test_context.py`` when that module was divided by theme; the
|
|
builder is verbatim, so every sibling suite keeps the exact drive layout and state it
|
|
was written against.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
|
|
def _make_health_env(tmp_path, events_lines=None):
|
|
class FakeEnv:
|
|
def drive_path(self, p):
|
|
return tmp_path / p
|
|
|
|
def repo_path(self, p):
|
|
return tmp_path / "repo" / p
|
|
|
|
@property
|
|
def repo_dir(self):
|
|
return tmp_path / "repo"
|
|
|
|
@property
|
|
def drive_root(self):
|
|
return tmp_path
|
|
|
|
(tmp_path / "state").mkdir(parents=True, exist_ok=True)
|
|
(tmp_path / "logs").mkdir(parents=True, exist_ok=True)
|
|
(tmp_path / "memory").mkdir(parents=True, exist_ok=True)
|
|
(tmp_path / "repo" / "docs").mkdir(parents=True, exist_ok=True)
|
|
(tmp_path / "repo" / "prompts").mkdir(parents=True, exist_ok=True)
|
|
(tmp_path / "archive" / "rescue").mkdir(parents=True, exist_ok=True)
|
|
(tmp_path / "repo" / "VERSION").write_text("1.2.3", encoding="utf-8")
|
|
(tmp_path / "repo" / "pyproject.toml").write_text('version = "1.2.3"', encoding="utf-8")
|
|
(tmp_path / "repo" / "web").mkdir(parents=True, exist_ok=True)
|
|
(tmp_path / "repo" / "web" / "package.json").write_text('{"version": "1.2.3"}', encoding="utf-8")
|
|
(tmp_path / "repo" / "README.md").write_text('version-1.2.3', encoding="utf-8")
|
|
(tmp_path / "repo" / "docs" / "ARCHITECTURE.md").write_text('# Ouroboros v1.2.3', encoding="utf-8")
|
|
(tmp_path / "repo" / "docs" / "DEVELOPMENT.md").write_text('# Dev', encoding="utf-8")
|
|
(tmp_path / "repo" / "prompts" / "CONSCIOUSNESS.md").write_text('Prompt text', encoding="utf-8")
|
|
(tmp_path / "state" / "state.json").write_text('{"spent_usd": 0, "budget_drift_alert": false}', encoding="utf-8")
|
|
(tmp_path / "memory" / "identity.md").write_text('x' * 300, encoding="utf-8")
|
|
(tmp_path / "memory" / "scratchpad.md").write_text('x' * 300, encoding="utf-8")
|
|
event_lines = events_lines or []
|
|
(tmp_path / "logs" / "events.jsonl").write_text("\n".join(event_lines) + ("\n" if event_lines else ""), encoding="utf-8")
|
|
return FakeEnv()
|