Skip to content

Commit 1af9ebe

Browse files
author
Yuwei Yan
committed
Keep CI green without local-only planner and table fixtures
Planner tests construct lightweight instances with __new__, so plan review defaults need to be resolved defensively at call time. Table preview tests now retain coverage when the full experiment metadata is not present in GitHub Actions by using a small inline representative fixture. Constraint: CI branch may not include external experiment metadata artifacts Rejected: Commit the large external metadata fixture | unit tests only need representative table content Confidence: high Scope-risk: narrow Reversibility: clean Tested: .venv/bin/python -m pytest -q
1 parent 68e6ed9 commit 1af9ebe

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

src/agents/planner_agent/planner_agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,10 +1363,12 @@ async def create_plan(
13631363
len(paper_plan.sections), paper_plan.get_total_sentences(),
13641364
)
13651365
effective_review_enabled = (
1366-
self.enable_plan_review if review_enabled is None else bool(review_enabled)
1366+
bool(getattr(self, "enable_plan_review", False))
1367+
if review_enabled is None
1368+
else bool(review_enabled)
13671369
)
13681370
effective_review_max_iterations = (
1369-
self.plan_review_max_iterations
1371+
int(getattr(self, "plan_review_max_iterations", 2))
13701372
if review_max_iterations is None
13711373
else max(0, int(review_max_iterations))
13721374
)

tests/test_table_visual_preview.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,37 @@
88
import pytest
99

1010

11+
def _fallback_meta_tables() -> list:
12+
"""
13+
Return a small inline BLIP-2-style table fixture when external experiment
14+
metadata is absent from CI.
15+
"""
16+
return [
17+
{
18+
"id": "tab:zero_shot_overview",
19+
"caption": "Zero-shot evaluation overview.",
20+
"section": "Experiments",
21+
"file_path": "tables/tab_1.md",
22+
"content": "\n".join(
23+
[
24+
"| Model | Params | VQAv2 | NoCaps | Flickr TR@1 |",
25+
"| --- | ---: | ---: | ---: | ---: |",
26+
"| Flamingo | 10.2B | 56.3 | - | - |",
27+
"| BLIP-2 | 188M | 65.0 | 121.6 | 97.6 |",
28+
],
29+
),
30+
},
31+
]
32+
33+
1134
def _load_meta_tables() -> list:
1235
"""
1336
Load the metadata tables from the BLIP-2 sample meta file.
1437
- **Description**:
15-
- Reads the sample metadata JSON used by the user scenario.
38+
- Reads the sample metadata JSON used by the user scenario when it is
39+
present in the workspace.
40+
- Falls back to an inline representative table so unit tests do not
41+
depend on external experiment artifacts.
1642
- Returns the list under the "tables" key.
1743
1844
- **Args**:
@@ -40,8 +66,10 @@ def _load_meta_tables() -> list:
4066
/ "meta.json"
4167
)
4268
meta_path = primary_path if primary_path.exists() else fallback_path
69+
if not meta_path.exists():
70+
return _fallback_meta_tables()
4371
payload = json.loads(meta_path.read_text(encoding="utf-8"))
44-
return payload.get("tables", [])
72+
return payload.get("tables", []) or _fallback_meta_tables()
4573

4674

4775
def test_read_table_content_falls_back_to_inline_when_file_missing(tmp_path):

0 commit comments

Comments
 (0)