feat(mma): Finalize Phase 1 with AST-based outline and improved tiered selection
This commit is contained in:
@@ -107,3 +107,30 @@ def test_build_files_section_with_dicts(tmp_path):
|
||||
result = build_files_section(tmp_path, files_config)
|
||||
assert "content1" in result
|
||||
assert "file1.txt" in result
|
||||
|
||||
def test_tiered_context_by_tier_field():
|
||||
file_items = [
|
||||
{"path": Path("tier1_file.txt"), "entry": "tier1_file.txt", "content": "Full Tier 1 Content\nLine 2", "tier": 1},
|
||||
{"path": Path("tier3_file.txt"), "entry": "tier3_file.txt", "content": "Full Tier 3 Content\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8\nLine 9\nLine 10", "tier": 3},
|
||||
{"path": Path("other.txt"), "entry": "other.txt", "content": "Other Content\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8\nLine 9\nLine 10", "tier": None}
|
||||
]
|
||||
|
||||
# Test Tier 1 Context
|
||||
result_t1 = build_tier1_context(file_items, Path("."), [], [])
|
||||
assert "Full Tier 1 Content" in result_t1
|
||||
assert "Line 2" in result_t1 # In full
|
||||
|
||||
# tier3_file.txt should be summarized
|
||||
assert "tier3_file.txt" in result_t1
|
||||
assert "preview:" in result_t1
|
||||
assert "Line 9" not in result_t1 # Only first 8 lines in preview
|
||||
|
||||
# Test Tier 3 Context
|
||||
result_t3 = build_tier3_context(file_items, Path("."), [], [], focus_files=[])
|
||||
assert "Full Tier 3 Content" in result_t3
|
||||
assert "Line 10" in result_t3 # In full
|
||||
|
||||
# tier1_file.txt should be summarized
|
||||
assert "tier1_file.txt" in result_t3
|
||||
assert "preview:" in result_t3
|
||||
assert "Full Tier 1 Content" in result_t3 # It's short, so it's in preview
|
||||
|
||||
Reference in New Issue
Block a user