feat(#93): IMP-55 u1~u12 frontend manual section swap detection (manual_section_assignment bool axis + drag-only marker gate + dual-axis persistence + backend manual-true gate)
Multi-MDX Regression (IMP-91) / multi-mdx-regression (push) Failing after 9s
Multi-MDX Regression (IMP-91) / multi-mdx-regression (push) Failing after 9s
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8262,8 +8262,20 @@ if __name__ == "__main__":
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
overrides_geoms = _accepted
|
||||
# zone_sections — CLI empty → fill from file (dict[str, list[str]]).
|
||||
if not overrides_section_assignments:
|
||||
# zone_sections — CLI empty AND persisted manual_section_assignment is
|
||||
# exactly True → fill from file (dict[str, list[str]]). IMP-55 (#93) u9
|
||||
# marker gate (fail-closed) : ``manual_section_assignment`` absent /
|
||||
# False / non-bool (string/int/list/dict) all skip the fallback so a
|
||||
# stale ``zone_sections`` axis left on disk from a prior drag cannot
|
||||
# smuggle ``--override-section-assignment`` into the next run after the
|
||||
# user reset intent via layout apply/cancel (u5 / u12 write
|
||||
# ``manual_section_assignment: false`` explicitly). CLI
|
||||
# ``--override-section-assignment`` payloads remain authoritative
|
||||
# (u11 truth-table) — this gate only affects the file→fallback path.
|
||||
if (
|
||||
not overrides_section_assignments
|
||||
and _persisted.get("manual_section_assignment") is True
|
||||
):
|
||||
_file_sections = _persisted.get("zone_sections")
|
||||
if isinstance(_file_sections, dict):
|
||||
_accepted_sec: dict[str, list[str]] = {}
|
||||
|
||||
+19
-12
@@ -5,16 +5,19 @@ auto-restores user choices without re-clicking. Source of truth = MDX-keyed
|
||||
file (stem of the MDX path), NOT ``data/runs/<run_id>/`` which mints a fresh
|
||||
run_id per ``/api/run`` invocation.
|
||||
|
||||
Schema (6 axes; stable order; IMP-51 #79 u1 added ``image_overrides``;
|
||||
IMP-45 #74 u1 added ``slide_css``):
|
||||
Schema (7 axes; stable order; IMP-51 #79 u1 added ``image_overrides``;
|
||||
IMP-45 #74 u1 added ``slide_css``; IMP-55 #93 u1 added
|
||||
``manual_section_assignment`` as a bool intent marker so the backend can
|
||||
distinguish a user drag-drop from frontend auto-carry zone_sections):
|
||||
|
||||
{
|
||||
"layout": <string|null>,
|
||||
"zone_geometries": {<zone_id>: {"x": float, "y": float, "w": float, "h": float}},
|
||||
"zone_sections": {<zone_id>: [<section_id>, ...]},
|
||||
"frames": {<unit_id>: <template_id>},
|
||||
"image_overrides": {<image_id>: {"x": float, "y": float, "w": float, "h": float}},
|
||||
"slide_css": <string|null>
|
||||
"layout": <string|null>,
|
||||
"zone_geometries": {<zone_id>: {"x": float, "y": float, "w": float, "h": float}},
|
||||
"zone_sections": {<zone_id>: [<section_id>, ...]},
|
||||
"frames": {<unit_id>: <template_id>},
|
||||
"image_overrides": {<image_id>: {"x": float, "y": float, "w": float, "h": float}},
|
||||
"slide_css": <string|null>,
|
||||
"manual_section_assignment": <bool>
|
||||
}
|
||||
|
||||
``image_id`` is the stable identifier emitted by the user-content image
|
||||
@@ -55,10 +58,13 @@ from typing import Any, Optional
|
||||
_PKG_ROOT = Path(__file__).resolve().parent.parent
|
||||
DEFAULT_OVERRIDES_ROOT = _PKG_ROOT / "data" / "user_overrides"
|
||||
|
||||
# The six in-scope axes (IMP-51 #79 u1 added ``image_overrides``; IMP-45
|
||||
# #74 u1 added ``slide_css``). Any other top-level key in the file is
|
||||
# preserved but ignored by callers — keeps the file forward-compatible
|
||||
# with future axes (e.g., zone_sizes) without a schema bump here.
|
||||
# The seven in-scope axes (IMP-51 #79 u1 added ``image_overrides``; IMP-45
|
||||
# #74 u1 added ``slide_css``; IMP-55 #93 u1 added
|
||||
# ``manual_section_assignment`` — bool intent marker that gates whether
|
||||
# persisted ``zone_sections`` are consumed by the backend pipeline). Any
|
||||
# other top-level key in the file is preserved but ignored by callers —
|
||||
# keeps the file forward-compatible with future axes (e.g., zone_sizes)
|
||||
# without a schema bump here.
|
||||
KNOWN_AXES: tuple[str, ...] = (
|
||||
"layout",
|
||||
"zone_geometries",
|
||||
@@ -66,6 +72,7 @@ KNOWN_AXES: tuple[str, ...] = (
|
||||
"frames",
|
||||
"image_overrides",
|
||||
"slide_css",
|
||||
"manual_section_assignment",
|
||||
)
|
||||
|
||||
# Key validation — MDX stem must be safe for filesystem use. Allow
|
||||
|
||||
Reference in New Issue
Block a user