Publish documentation / publish (push) Successful in 1m27s
Add PostgreSQL-backed memory, editable evidence with source review and activation, and human-approved archive repairs across the harness, API, and UI. Include migrations, deployment support, regression coverage, and validation documentation. Refresh permissions from validated session roles so existing administrator logins can access newly deployed archive management features.
55 lines
2.1 KiB
Python
55 lines
2.1 KiB
Python
import hashlib
|
|
|
|
import pytest
|
|
|
|
from tht.pi_skill_projection import (
|
|
FRAGMENT_ORDER,
|
|
PROJECTION_PATH,
|
|
projection_is_current,
|
|
render_projection,
|
|
)
|
|
|
|
BASELINE_SHA256 = "314d5e62eecda59dc16f00946d1f814829a326e7b117e102fd03c61f1f00a1a1"
|
|
|
|
|
|
def test_modular_pi_skill_renders_the_byte_identical_approved_projection():
|
|
rendered = render_projection()
|
|
|
|
assert FRAGMENT_ORDER == (
|
|
("{{EVIDENCE_RUNTIME_SEARCH}}", "evidence/runtime-search.md"),
|
|
("{{DISAMBIGUATION_OPEN_AMBIGUITY}}", "disambiguation/open-ambiguity.md"),
|
|
("{{DISAMBIGUATION_INSTRUCTIONS}}", "disambiguation/phase-1.md"),
|
|
("{{MEMORY_INSTRUCTIONS}}", "memory/phase-2.md"),
|
|
("{{DISAMBIGUATION_REWRITING_INSTRUCTIONS}}", "disambiguation/phase-3.md"),
|
|
("{{MEMORY_SOLVED_SEARCH_F4}}", "memory/solved-search-f4.md"),
|
|
("{{DISAMBIGUATION_SCHEMA_GROUNDING}}", "disambiguation/schema-grounding.md"),
|
|
("{{EVIDENCE_FORMULA_PROPOSALS}}", "evidence/formula-proposals.md"),
|
|
("{{MEMORY_SOLVED_SEARCH_F6}}", "memory/solved-search-f6.md"),
|
|
("{{MEMORY_SOLVED_SEARCH_F7}}", "memory/solved-search-f7.md"),
|
|
("{{MEMORY_PROMOTION_F8}}", "memory/phase-8-promotion.md"),
|
|
("{{MEMORY_SOLVED_FINALIZATION}}", "memory/solved-finalization.md"),
|
|
)
|
|
assert rendered == render_projection()
|
|
assert hashlib.sha256(rendered).hexdigest() == BASELINE_SHA256
|
|
assert PROJECTION_PATH.read_bytes() == rendered
|
|
|
|
|
|
def test_projection_check_detects_stale_output(tmp_path):
|
|
stale = tmp_path / "SKILL.md"
|
|
stale.write_bytes(b"stale\n")
|
|
|
|
assert projection_is_current(stale) is False
|
|
|
|
|
|
def test_projection_rejects_a_missing_or_repeated_static_placeholder():
|
|
with pytest.raises(ValueError, match="exactly once"):
|
|
render_projection(template=b"{{MEMORY_INSTRUCTIONS}}\n")
|
|
with pytest.raises(ValueError, match="exactly once"):
|
|
render_projection(
|
|
template=(
|
|
b"{{DISAMBIGUATION_INSTRUCTIONS}}\n"
|
|
b"{{MEMORY_INSTRUCTIONS}}\n"
|
|
b"{{MEMORY_INSTRUCTIONS}}\n"
|
|
)
|
|
)
|