grantforge-api / backend /tests /test_gsd_unified.py
GrantForge Bot
Deploy sha-565ad85979610064f6d1c18ab3b6404357d61073 — source build (no GHCR)
ce8f04a
Raw
History Blame Contribute Delete
1.42 kB
"""GSD unified package — constitution + prompts live under backend/gsd."""
from pathlib import Path
def test_constitution_file_is_full():
path = Path(__file__).resolve().parents[1] / "gsd" / "docs" / "CONSTITUTION.md"
text = path.read_text(encoding="utf-8")
assert "PREAMBUŁA" in text or "PREAMBU" in text
assert "Prawda regulaminowa" in text or "prawda regulaminowa" in text.lower()
assert len(text) > 2000
def test_prompts_export():
from gsd.prompts.global_rules_prompts import (
get_agent_prompt,
get_constitution_only,
ANTI_HALLUCINATION_GUARD,
)
assert "PRAWDA REGULAMINOWA" in get_constitution_only() or "regulamin" in get_constitution_only().lower()
gen = get_agent_prompt("generator")
assert len(gen) > 500
assert ANTI_HALLUCINATION_GUARD
def test_orchestrator_loads_file_constitution():
from gsd.gsd_orchestrator import GrantforgeGSDOrchestrator
from gsd.gsd_state import create_gsd_state
orch = GrantforgeGSDOrchestrator(create_gsd_state(project_id="unit-test"))
assert orch.constitution
assert len(orch.constitution) > 1000
def test_helpers_enriched_with_gsd_guard():
from agents.helpers import ANTI_HALLUCINATION_PROMPT
# Either GSD guard merged or original anti-hallucination still present
assert "ANTI-HALLUCINATION" in ANTI_HALLUCINATION_PROMPT or "halucyn" in ANTI_HALLUCINATION_PROMPT.lower()