MAD Designer iconMAD

Designer (Phase 6c) Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Make the MAD Designer workspace a working WPF report-layout studio (palette, minimap, zoomable canvas, inspector, undo) by extending mad serve with a report-layout model the client can read and mutate.

Architecture: Extend the Phase 4 serve protocol with a layout-model read plus granular mutations over the existing RptqDocumentSection/RptqDocumentElement objects (the same pattern as the 6b query-model). The WPF side mirrors the Mac’s MADMacDesignerViewController/MADMacDesignerCanvasView: a DesignerViewModel owns the snapshot and every mutation (with a client-side undo/redo stack), a DesignerCanvas draws bands/elements, and the three-pane DesignerView hosts palette/sidebar/inspector.

Tech Stack: Objective-C (engine, CLI/Source/MADCLIServe.m), C# / .NET 10 / WPF / MVVM (no framework), xunit (Mad.Designer.Windows.Tests).

Spec: docs/superpowers/specs/2026-11-19-designer-design.md (this plan argues from it; read both). Behavioural blueprint: Mac/Source/MADMacDesignerViewController.m, Mac/Source/MADMacDesignerCanvasView.m, Mac/Tests/MADMacSmokeTest.m step 5. Protocol record: docs/project/MAD_WINDOWS.md §6d/§6e.

Global Constraints

Review Focus

The five input classes most likely to bite a real user, which the happy-path acceptance doesn’t exercise:

  1. Inserting into a section that has no rows yet. A fresh document’s sections may have zero RptqDocumentSectionRows; addDocumentObject:withDropPoint: reads hasRows.firstObject. The engine must auto-create the first row (the Mac’s ensureSelectedSection). → pinned by Task 2’s AddElement_AutoCreatesFirstRow.
  2. The +44pt section-height offset. The engine stores height = interfaceHeight + 44 (setInterfaceHeight:); the protocol must read layoutHeight and write setInterfaceHeight: or the value drifts +44pt every round-trip. → pinned by Task 2’s SetSectionHeight_RoundTripsWithoutDrift.
  3. Non-overlapping placement. Three click-to-add inserts must not stack at (0,0); the client computes the next free origin. → pinned by Task 3’s NextAvailableOrigin_DoesNotOverlapExisting.
  4. Cross-section move with undo. Moving Detail → Page Header must re-parent the element and undo must return it (section and origin). → pinned by Task 11’s UndoRestoresCrossSectionMove.
  5. Deleting a bound element. Removing a data-field/aggregate element must detach it from its row without corrupting the query model (the inverse of 6b’s table-removal cleanup). → pinned by Task 2’s RemoveBoundElement_LeavesEmptyLayout.

Task 1: Layout model parser (pure C#)

Files:

Interfaces:

Task 2: Engine layout protocol + EngineService + round-trip test

Files:

Interfaces:

Task 3: DesignerViewModel (snapshot, selection, placement)

Files:

Interfaces:

Task 4: DesignerCanvas rendering (bands + elements)

Files:

Interfaces:

Task 5: Three-pane DesignerView shell + DocumentViewModel wiring + docs

Files:

Interfaces:


Task 6: Palette top bar (click-to-add)

Files:

Interfaces:

Task 7: Left sidebar (minimap, sections outline, query-fields browser)

Files:

Interfaces:

Task 8: Right inspector (document/section + element cards)

Files:

Interfaces:

Task 9: Client-side undo/redo

Files:

Interfaces:

Task 10: Canvas interactions (move, resize, marquee, guides, snap, zoom, rulers, inline edit, delete/duplicate)

Files:

Interfaces:

Task 11: Acceptance tests + final docs + summary

Files:

Interfaces: