feat(IMP-09): PR 1 — col-axis solver + per-zone geometry mapper + retry gate
Stage 3 round 4 lock implementation: extend build_layout_css beyond
the horizontal-2-only dynamic path. Every layout_css return now
carries length-locked col-axis keys (widths_px, width_ratios,
dynamic_cols) matching the parsed css_areas grid (R rows, C cols),
so 2-D layouts (T / 2x2 in PR 2) and the unified
_compute_per_zone_geometry mapper can plug in without further
contract churn.
PR 1 scope:
- _parse_css_areas + _parse_fr_string + _compute_per_zone_geometry
(unified — 1-D and 2-D from the same code path)
- compute_zone_layout_cols (vertical-2 weight-only solver)
- _build_fr_default / _build_rows_dynamic / _build_cols_dynamic
(populate widths_px/heights_px on every return path)
- build_layout_css override branch keeps the warn-and-fallthrough
legacy for unsupported presets (PR 2 promotes to strict raise)
- retry gate in _attempt_zone_ratio_retry skips when dynamic_cols=True
or dynamic_rows=False, with explicit retry_skipped_reason
- Step 8 artifact gains zone_widths_px_planned /
zone_col_ratios_planned (top-level) + zone_width_px_planned /
zone_col_ratio_planned (per-zone)
- debug_zones width injection via _compute_per_zone_geometry
(replaces the legacy row-only zip)
Tests: tests/phase_z2/ — 47 new cases (parse / fr-string / cols solver /
per-zone geometry / build_layout_css contract / retry gate +
6 build_layout_css YAML fixtures + 3 retry_gate fixtures).
Verification: python -m pytest -q tests = 89 passed (was 42).
horizontal-2 grid CSS strings (areas/cols/rows) byte-identical to
legacy; only additive col-axis keys are introduced.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
case_id: horizontal2_dynamic_rows
|
||||
description: |
|
||||
horizontal-2 layout with dynamic_rows=True must pass the IMP-09 retry
|
||||
gate. The base trace should record retry_attempted=True (legacy
|
||||
plan/rerender path continues). retry_skipped_reason MUST NOT contain
|
||||
either of the IMP-09 gate skip strings.
|
||||
input_layout_css:
|
||||
areas: '"top" "bottom"'
|
||||
cols: 1fr
|
||||
rows: 333px 238px
|
||||
heights_px: [333, 238]
|
||||
widths_px: [1180]
|
||||
ratios: [0.569, 0.407]
|
||||
width_ratios: [1.0]
|
||||
dynamic_rows: true
|
||||
dynamic_cols: false
|
||||
router_decision:
|
||||
router_active: true
|
||||
proposed_actions_summary: [zone_ratio_retry]
|
||||
expected_gate:
|
||||
retry_attempted: true
|
||||
retry_skipped_reason_excludes:
|
||||
- "dynamic_cols"
|
||||
- "fr_default_from_preset"
|
||||
23
tests/phase_z2/fixtures/retry_gate/single_fr_default.yaml
Normal file
23
tests/phase_z2/fixtures/retry_gate/single_fr_default.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
case_id: single_fr_default
|
||||
description: |
|
||||
Any layout that fell through to fr_default_from_preset (single,
|
||||
T-shape, 2x2 in PR 1) has neither dynamic_rows nor dynamic_cols.
|
||||
Row-axis retry is a no-op and must be skipped by the IMP-09 gate
|
||||
with a fr_default_from_preset skip reason.
|
||||
input_layout_css:
|
||||
areas: '"top top" "bottom-left bottom-right"'
|
||||
cols: 1fr 1fr
|
||||
rows: 1fr 1fr
|
||||
heights_px: [285, 286]
|
||||
widths_px: [583, 583]
|
||||
ratios: [0.487, 0.489]
|
||||
width_ratios: [0.494, 0.494]
|
||||
dynamic_rows: false
|
||||
dynamic_cols: false
|
||||
router_decision:
|
||||
router_active: true
|
||||
proposed_actions_summary: [zone_ratio_retry]
|
||||
expected_gate:
|
||||
retry_attempted: false
|
||||
retry_skipped_reason_contains:
|
||||
- "fr_default_from_preset"
|
||||
@@ -0,0 +1,24 @@
|
||||
case_id: vertical2_dynamic_cols
|
||||
description: |
|
||||
vertical-2 layout with dynamic_cols=True must be skipped by the
|
||||
IMP-09 retry gate before plan/rerender, because the existing
|
||||
apply_retry_to_layout_css mutates only row-axis fields and would
|
||||
produce a misleading trace if it ran on a column-dynamic layout.
|
||||
input_layout_css:
|
||||
areas: '"left right"'
|
||||
cols: 583px 583px
|
||||
rows: 1fr
|
||||
heights_px: [585]
|
||||
widths_px: [583, 583]
|
||||
ratios: [1.0]
|
||||
width_ratios: [0.494, 0.494]
|
||||
dynamic_rows: false
|
||||
dynamic_cols: true
|
||||
router_decision:
|
||||
router_active: true
|
||||
proposed_actions_summary: [zone_ratio_retry]
|
||||
expected_gate:
|
||||
retry_attempted: false
|
||||
retry_skipped_reason_contains:
|
||||
- "dynamic_cols"
|
||||
- "IMP-09"
|
||||
Reference in New Issue
Block a user