feat(layout): implement deterministic 2xK grid engine with single decision table

- Change N=1->2 split policy from down to right to establish 2 full-height columns
- Share single decision table across GUI and headless modes
- Add _full_height_pane guard to prevent half-height column splits
- Quadruple-wire default max_columns=2 and max_rows=2 across layout.py, lib.sh, and .mam.env.example
- Update unit and integration tests to enforce deterministic 2x2 grid trajectory
This commit is contained in:
2026-08-26 15:10:06 +09:00
parent 5ed9ec79d7
commit 80d2f7f068
6 changed files with 338 additions and 220 deletions
+8 -3
View File
@@ -28,11 +28,16 @@ def test_bug2_headless_layout_does_not_overflow():
assert not d_wide.is_overflow
assert d_wide.direction == "right"
# 4. Tall pane (split down)
# 4. Tall-but-narrow pane: N=1 is always right; 80//2 < min_cols 60 → overflow
payload_tall = {"result": {"panes": [{"pane_id": "p1", "rect": {"width": 80, "height": 60}}]}}
d_tall = compute_2xk_layout(payload_tall, min_cols=60, min_rows=20)
assert not d_tall.is_overflow
assert d_tall.direction == "down"
assert d_tall.is_overflow
assert d_tall.direction == "overflow"
payload_tall_wide = {"result": {"panes": [{"pane_id": "p1", "rect": {"width": 160, "height": 60}}]}}
d_tall_wide = compute_2xk_layout(payload_tall_wide, min_cols=60, min_rows=20)
assert not d_tall_wide.is_overflow
assert d_tall_wide.direction == "right"
def test_bug3_reconcile_skills_dir_passed_and_fallback():