Stabilize core correctness and sync project plan state
This commit is contained in:
@@ -27,6 +27,7 @@ def test_context_respects_budget(tmp_data_dir, sample_markdown):
|
||||
|
||||
pack = build_context("What is AtoCore?", budget=500)
|
||||
assert pack.total_chars <= 500
|
||||
assert len(pack.formatted_context) <= 500
|
||||
|
||||
|
||||
def test_context_with_project_hint(tmp_data_dir, sample_markdown):
|
||||
@@ -82,6 +83,18 @@ def test_project_state_included_in_context(tmp_data_dir, sample_markdown):
|
||||
assert pack.project_state_chars > 0
|
||||
|
||||
|
||||
def test_trusted_state_precedence_is_restated_in_retrieved_context(tmp_data_dir, sample_markdown):
|
||||
"""When trusted state and retrieval coexist, the context should restate precedence explicitly."""
|
||||
init_db()
|
||||
init_project_state_schema()
|
||||
ingest_file(sample_markdown)
|
||||
|
||||
set_state("atocore", "status", "phase", "Phase 2")
|
||||
pack = build_context("What is AtoCore?", project_hint="atocore")
|
||||
|
||||
assert "If retrieved context conflicts with Trusted Project State above" in pack.formatted_context
|
||||
|
||||
|
||||
def test_project_state_takes_priority_budget(tmp_data_dir, sample_markdown):
|
||||
"""Test that project state is included even with tight budget."""
|
||||
init_db()
|
||||
@@ -95,6 +108,32 @@ def test_project_state_takes_priority_budget(tmp_data_dir, sample_markdown):
|
||||
assert "Phase 1 in progress" in pack.formatted_context
|
||||
|
||||
|
||||
def test_project_state_respects_total_budget(tmp_data_dir, sample_markdown):
|
||||
"""Trusted state should still fit within the total context budget."""
|
||||
init_db()
|
||||
init_project_state_schema()
|
||||
ingest_file(sample_markdown)
|
||||
|
||||
set_state("atocore", "status", "notes", "x" * 400)
|
||||
set_state("atocore", "decision", "details", "y" * 400)
|
||||
|
||||
pack = build_context("status?", project_hint="atocore", budget=120)
|
||||
assert pack.total_chars <= 120
|
||||
assert pack.budget_remaining >= 0
|
||||
assert len(pack.formatted_context) <= 120
|
||||
|
||||
|
||||
def test_project_hint_matches_state_case_insensitively(tmp_data_dir, sample_markdown):
|
||||
"""Project state lookup should not depend on exact casing."""
|
||||
init_db()
|
||||
init_project_state_schema()
|
||||
ingest_file(sample_markdown)
|
||||
|
||||
set_state("AtoCore", "status", "phase", "Phase 2")
|
||||
pack = build_context("status?", project_hint="atocore")
|
||||
assert "Phase 2" in pack.formatted_context
|
||||
|
||||
|
||||
def test_no_project_state_without_hint(tmp_data_dir, sample_markdown):
|
||||
"""Test that project state is not included without project hint."""
|
||||
init_db()
|
||||
|
||||
Reference in New Issue
Block a user