Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

Improve Canvas app authoring and validation workflows (#603)

Maliheasadifa5501763559
diff --git a/plugins/canvas-apps/agents/canvas-app-planner.md b/plugins/canvas-apps/agents/canvas-app-planner.md
index 8d09e7ead..daedb9d3c 100644
--- a/plugins/canvas-apps/agents/canvas-app-planner.md
+++ b/plugins/canvas-apps/agents/canvas-app-planner.md
@@ -1,33 +1,17 @@
---
name: canvas-app-planner
description: >-
- Produces implementation plans for approved Canvas App creation and complex edits.
- Discovers controls, APIs, and data sources, then writes a compact dispatch index,
- shared conventions, and one screen-specific brief per target file. In CREATE mode it
- also writes App.pa.yaml. Called by the orchestrator, not directly by users.
+ Produces implementation plans for approved Canvas App creation and complex edits.
+ Consumes orchestrator-supplied Canvas discovery, then writes a compact dispatch
+ index, shared conventions, and one screen-specific brief per target file. In CREATE
+ mode it also writes App.pa.yaml. Called by the orchestrator, not directly by users.
color: cyan
user-invocable: false
tools:
- - Read
- - Write
- - Edit
- - view
- - create
- - edit
- - mcp__canvas-authoring__compile_canvas
- - mcp__canvas-authoring__list_controls
- - mcp__canvas-authoring__describe_control
- - mcp__canvas-authoring__list_apis
- - mcp__canvas-authoring__describe_api
- - mcp__canvas-authoring__list_data_sources
- - mcp__canvas-authoring__get_data_source_schema
- - canvas-authoring/compile_canvas
- - canvas-authoring/list_controls
- - canvas-authoring/describe_control
- - canvas-authoring/list_apis
- - canvas-authoring/describe_api
- - canvas-authoring/list_data_sources
- - canvas-authoring/get_data_source_schema
+ - Read
+ - Write
+ - Edit
+ - apply_patch
---
# Canvas App Plan Writer
@@ -40,7 +24,9 @@ Your invocation includes:
- Working directory: an absolute path supplied by the orchestrator
- Plan index: `[working directory]/canvas-app-plan.md`
- Shared plan: `[working directory]/canvas-app-shared.md`
+- Plugin root: the immutable `${PLUGIN_ROOT}` path supplied by the orchestrator
- User requirements and approved plan
+- Discovery packet produced by the orchestrator in the MCP-owning top-level context
- CREATE context: target users and device
- EDIT context: current app state and synced files
@@ -50,6 +36,21 @@ exactly, record an explicit approximation and reason; never silently rename butt
"drag-style", call buttons "handles", or put copy in the app that promises an interaction
the controls do not provide.
+
+Before discovery, read the supplied plugin root's `references/QAChecks.md`. Stop with
+`Status: Provenance Blocked` unless the QA guide defines
+`QACHK-SHARED-SOURCE-DERIVATION`. Never substitute a plugin root derived from the
+working directory.
+
+Consume discovery and compose every artifact before attempting the first write. Use
+`apply_patch` for disk-backed planning artifacts and `App.pa.yaml`. If `apply_patch` is
+unavailable or the call is denied, return `Status: Writing Blocked`, the exact write
+failure, and the complete intended contents of the plan index, shared plan, every screen
+brief, and CREATE-mode `App.pa.yaml` as labeled inline payloads. The orchestrator writes
+those payloads verbatim. Do not return a successful-looking handoff or claim that no write
+tool exists without attempting `apply_patch`.
+
+
Plan in functional-first order: shared state and stable identity, complete executable
workflows, observable evidence, responsive/accessibility behavior, then visual polish.
When a control or screen budget is tight, remove decorative complexity before omitting,
@@ -75,32 +76,40 @@ If any approved screen uses `GroupContainer` with `Variant: GridLayout`, also re
`${PLUGIN_ROOT}/references/GridLayoutGuide.md`. Do not load it for apps that use only AutoLayout or
ManualLayout.
-## 2. Discover Resources
+
+## 2. Consume Discovered Resources
+
+Do not call MCP tools. Delegated agents do not reliably inherit the live MCP connection
+owned by the invoking skill. Use the supplied discovery packet as the only discovery
+authority. If a required result is absent, return `Status: Discovery Packet Blocked` and
+name the missing control, API, data source, or detail. The orchestrator must complete the
+packet in its MCP-owning context and re-invoke you; do not return `Status: Tooling
+Blocked` for missing MCP access.
### CREATE
-1. Call `list_controls`, `list_apis`, and `list_data_sources`.
-2. Call `describe_control` for every control type in the approved plan.
-3. Call `describe_api` and `get_data_source_schema` only for connectors and data sources
+1. Require list results for controls, APIs, and data sources.
+2. Require a `describe_control` result for every control type in the approved plan.
+3. Require API descriptions and data source schemas only for connectors and data sources
the approved plan uses.
### EDIT
1. Read all `.pa.yaml` files in the working directory.
2. Extract existing screens, controls, formulas, palette, layout, variables, and bindings.
-3. Use list tools only when the edit introduces resources not already present.
-4. Call `describe_control` for every control type that will receive a property, enum, or
+3. Require list results only when the edit introduces resources not already present.
+4. Require `describe_control` for every control type that will receive a property, enum, or
variant it does not already carry in the target YAML — not only for newly introduced
types. An existing `ModernText` gaining its first `Wrap` still needs its definition
recorded, because the builder cannot look it up.
-5. Call API and schema detail tools only for resources involved in the edit.
+5. Require API and schema details only for resources involved in the edit.
### Component refresh checkpoint
-Immediately before auditing properties, re-run `describe_control` for
-every Canvas or Code Component used by the plan to ensure any imported or updated components made in Studio are available.
-Especially if a successful compile applied local component-definition changes, since the previous lookup.
-Treat earlier component responses as stale; builders cannot refresh them.
+Require the packet to contain a fresh `describe_control` result for every Canvas or Code
+Component used by the plan. The orchestrator obtains these immediately before delegation
+so imported or updated Studio components are current. Builders cannot refresh them.
+
## 3. Audit Control Properties
@@ -121,13 +130,13 @@ Before writing plans:
`Gallery` needs `Vertical`, `Horizontal` or `VariableHeight`. Omitting it fails the
compile with a message that names no control.
6. Audit state-changing formulas before placing them in a brief:
- - Compute a toggle's next value once before `Patch` or `UpdateIf`, then reuse that value
- for both the write and its confirmation text. Do not inspect the mutated `ThisItem`
- afterward to decide what action occurred.
- - Derive validation visibility and submit availability from the current input values.
- If validation must wait for a submit attempt, combine one attempt flag with the
- current invalid expression; do not maintain or clear separate validity flags in each
- input's `OnChange`.
+ - Compute a toggle's next value once before `Patch` or `UpdateIf`, then reuse that value
+ for both the write and its confirmation text. Do not inspect the mutated `ThisItem`
+ afterward to decide what action occurred.
+ - Derive validation visibility and submit availability from the current input values.
+ If validation must wait for a submit attempt, combine one attempt flag with the
+ current invalid expression; do not maintain or clear separate validity flags in each
+ input's `OnChange`.
7. Define data-field semantics once and reuse them. If a task has `ScheduledDate`,
`DueDate` and `CompletedDate`, state which field drives calendar placement, which date
the task list displays, and which field the monthly report groups by. Seed data,
@@ -145,7 +154,13 @@ Before writing plans:
10. Classify the approved requirements with the capability inventory in
`${PLUGIN_ROOT}/references/BehaviorGuide.md`. Use it to find missing behaviors, not to invent
unrequested features.
-11. Build one Action Contract row for each requested or approved action. Do not infer
+11. Write `## Required Record Fields` when the app has a repeated record card, row, or
+ immediately reachable detail. Add one stable field key for the canonical identity and
+ every field the requirements say users must see, including named title, person, time
+ range, description, status, and similar values. Name the owner screen, record surface,
+ source field, and presentation requirement. Do not accept a time-only or identity-only
+ surface when additional fields are requested.
+12. Build one Action Contract row for each requested or approved action. Do not infer
universal CRUD for supporting entities, but treat role-scoped management of primary
records as requiring reachable list/detail, correction/update, and remove/cancel
flows. A named role that must "manage all" primary records therefore requires separate
@@ -154,12 +169,23 @@ Before writing plans:
behaviors into separate rows when requested or implied by that role-scoped lifecycle.
When review has approved and rejected outcomes, require both Approve and Reject/Decline
contracts on the same eligible record surface. A lone decision is an incomplete plan;
- phone density may change their arrangement but may not remove either contract.
-12. For every Action Contract, name its eligible precondition, source of truth, immutable
+ phone density may change their arrangement but may not remove either contract. Treat
+ Receive/Issue, Increase/Decrease, Credit/Debit, Allocate/Release, Check-in/Check-out,
+ Enable/Disable, and other opposing transitions as separate contracts even when they use
+ one shared form.
+13. For every Action Contract, name its eligible precondition, source of truth, immutable
record identity, exact event, source transition, postcondition, observer formula, and
visible evidence. Verify the observer reads the same source and field the event writes.
- A control label and an `OnSelect` formula are not a complete contract.
-13. For every mutation, name the target source, exact data operation, refresh or collection
+ A control label and an `OnSelect` formula are not a complete contract. For opposing
+ transitions, require an explicit pointer-selectable operation, disabled invalid states,
+ an enabled valid state, and no implicit or stale direction. In a shared-operation flow,
+ selectors are selection-only and one reachable guarded event owns the mutation and
+ consumes the same resettable operation state. Separate direct-action controls remain
+ valid when each owns its mutation and complete selected-ID and input eligibility gates.
+ Apply the exact selector, empty-state, numeric-input, reset, and guard contracts from
+ `${PLUGIN_ROOT}/references/BehaviorGuide.md` and copy the resulting compile-ready formulas and
+ properties into the owning screen brief.
+14. For every mutation, name the target source, exact data operation, refresh or collection
update, and a mandatory in-viewport mutation receipt bound to the returned record, changed
stable ID, or deletion snapshot. Record the mutation's **write set** and **proof set** in
its Action Contract. The write set lists every field or status the handler changes. The
@@ -169,10 +195,19 @@ Before writing plans:
state, and one labeled binding per proof-set field. The changed list, detail, dashboard,
or metric must also read the updated source, but navigation, a notification, or a record
somewhere in a longer list cannot replace the receipt.
-14. Verify every Action Contract has a reachable entry point and owner screen. Include
+ Fill the additive `## Mutation Lifecycle Evidence` table from `PlanTemplates.md`.
+ Name the canonical source and requested destination, trace the same stable ID through
+ the operation, receipt, canonical observer, and destination observer, and specify
+ success-path synchronization when those surfaces read different sources. For a
+ multi-record destination, specify selection/filter/highlight/open focus by that ID.
+ Fill the `## Mutation Field Ledger` with every Changed field and every user-visible
+ or lifecycle-significant Preserved field. Changed rows must match the write and proof
+ sets one-for-one; Preserved rows name canonical pre-state, exact omission/carry-forward,
+ and post-state evidence.
+15. Verify every Action Contract has a reachable entry point and owner screen. Include
supporting setup actions when they are necessary to exercise an explicitly requested
lifecycle, comparison, relationship, or ranking with local/mock data.
-15. For create and edit contracts, specify every required input, requiredness, finite-choice
+16. For create and edit contracts, specify every required input, requiredness, finite-choice
source, concrete option values, default/placeholder, stable record ID, and post-save
destination. For short static choices, prefer visible radio or button choices, then a
dropdown that commits by click or tap; do not plan a searchable combobox unless the set
@@ -181,13 +216,39 @@ Before writing plans:
Edit entry point, selected-record state, prepopulation formulas, stable-ID update, cancel
behavior, mutation write set, and receipt proof set shown after save. Reject the contract
if any submitted visible field appears in the write set but not the proof set.
-16. Write a `## Functional Test Matrix` with at least one deterministic Given/When/Then
+ Add a conditional `## Continuation Contracts` section only when create intentionally feeds a
+ later edit, delete, relationship, approval, or state transition. Bind the reachable
+ later action directly to the returned create ID and specify clearing of continuation
+ ID/mode after successful downstream completion and cancellation. Omit the section for
+ create-only flows; do not invent continuation for ordinary navigation.
+17. Write a `## Functional Test Matrix` with at least one deterministic Given/When/Then
success scenario per Action Contract and one scenario for each required boundary or
negative path. Use concrete seeded IDs and values for local/mock data. Each `Then`
names the source postcondition and the exact observer/evidence surface that proves it.
In EDIT mode, add regression scenarios for existing behaviors whose source, fields,
- controls, or observer formulas are touched.
-17. For every selector or filter, couple the concrete option source, readable option
+ controls, or observer formulas are touched. Give each direction of an opposing pair a
+ separate scenario using a concrete old value and amount. For arithmetic pairs, require
+ `increase = old + amount` and `decrease = old - amount`, and require the receipt to
+ show operation, old value, amount, expected new value, and actual persisted new value.
+ When both directions act on the same record type, also require one same-record
+ compound scenario that applies one direction then the opposite on the identical record
+ (e.g. `Qty 10 -> Receive 3 -> 13 -> Issue 2 -> 11`) and proves the second operation
+ reads the already-mutated value from the canonical source, not the original.
+ When a continuation contract exists, add one scenario for returned-ID-bound downstream
+ completion and one for cancellation. Both clear continuation ID/mode; cancellation
+ leaves the canonical source unchanged.
+18. When Action Contracts contain an opposing directional pair, write the
+ `## Directional Mutation Evidence` table from `PlanTemplates.md`. Declare exact
+ compile-ready planned bindings for selected ID, resettable operation state, invalid
+ amount and submit gates, both directional formulas, the canonical observer, and all
+ five receipt values. When both directions act on the same record type, also fill the
+ `## Compound Sequence Evidence` table with the same-record sequence and the second
+ operation's canonical old-value binding. For a shared-operation flow, declare every
+ selection-only event, the common guarded mutation event, and their common operation
+ state. Copy these planned formulas into the owning screen brief; final acceptance
+ compares the implemented YAML to this contract. Require a literal guard for each
+ direction; an `else`, default `Switch` arm, or unguarded fallback does not prove it.
+19. For every selector or filter, couple the concrete option source, readable option
formula, pointer-committed selected value, consumer predicate, active-selection
indicator, and clear behavior. Apply the short-choice rule to filters as well as form
inputs. Seed at least two matching records and one non-matching record for every
@@ -198,10 +259,10 @@ properties by analogy. Text styling in particular is spelled differently across
the modern React controls use `Color` and `Size`, `Badge` uses `FontColor` and `FontSize`,
and `ModernCard` uses `TitleColor`/`TitleSize` with a single `BorderRadius`.
-Use `list_controls` only to discover the name passed to `describe_control`. For every
-planned control type, copy the `Control:` value and all other required creation keywords
-from the `describe_control` response verbatim into the control definition and screen
-brief. Never strip an `@version` suffix or infer `ComponentName`,
+Within the supplied packet, use the `list_controls` result only to identify the name
+whose `describe_control` result is authoritative. For every planned control type, copy
+the `Control:` value and all other required creation keywords from that response
+verbatim into the control definition and screen brief. Never strip an `@version` suffix or infer `ComponentName`,
`ComponentLibraryUniqueName`, `Variant`, or `Layout` from the list result.
## 4. Size the Screens
@@ -228,11 +289,18 @@ observed defect in finished apps, and no compile diagnostic reports it.
For every screen brief, state explicitly:
- Which horizontal rows wrap (`LayoutWrap: =true`) and which stack below a width
- breakpoint (`LayoutDirection: =If(Parent.Width < 640, ...)`). Use the approved app's
- breakpoint consistently; when none is specified, use 640 for phone and 1024 for tablet.
-- That responsive layout properties derive directly from `App.Width`, `Parent.Width` or
- `Self.Width`. Do not initialize layout variables such as `varIsMobile` or `varColumns`
- in `OnVisible`; they can be unset in Studio and become stale after resize.
+ breakpoint. Logical canvas sources such as `App.Width`, a root container's `Width`, and
+ root-level `Parent.Width` can remain at design width when an embedded or scale-to-fit
+ host is physically narrower. Because display settings are not available in `.pa.yaml`,
+ never rely on those sources alone to activate the narrow branch. Make required field and
+ action groups safe even when the wide/default branch remains active: wrap, stack
+ unconditionally, use deliberate scrolling, or fit the entire wide branch within a
+ statically proven bound. Layout Budget Evidence is arithmetic documentation, not proof
+ that the runtime host changes a logical width value. Use the approved app's
+ breakpoints consistently; when none are specified, use 640 for phone and 1024 for tablet.
+- That responsive layout properties derive from the declared screen-level width source.
+ Do not initialize layout variables such as `varIsMobile` or `varColumns` in `OnVisible`;
+ they can be unset in Studio and become stale after resize.
- That the root container scrolls (`LayoutOverflowY: =LayoutOverflow.Scroll`).
- That the sole responsive root uses exact `Width: =Parent.Width`,
`Height: =Parent.Height`, `LayoutMinWidth: =0`, and `LayoutMinHeight: =0`.
@@ -245,18 +313,26 @@ For every screen brief, state explicitly:
- That vertical containers holding text use `LayoutAlignItems: =LayoutAlignItems.Stretch`.
With `Start`, `Center` or `End`, a heading or a concatenated total is sized to its
intrinsic width and silently clipped — the text is correct and simply not shown.
-- A `TemplateSize` for every gallery that fits its row template **at each width branch**,
- counting a `ModernCard`'s image band. A dense desktop branch is the usual place card
- titles disappear.
+- A `TemplateSize` for every gallery that fits its row template **at each width branch**.
+ Use the same deliberate breakpoint source as the row layout or budget every reachable
+ cross-branch pair. Record numeric row-height arithmetic including every required field,
+ badge, and action; a field that clips outside the template fails.
- For every GridLayout: the exact `LayoutGridColumns`, `LayoutGridRows`,
`LayoutGridColumnMinWidth`, `LayoutGridRowMinHeight` and `Height` formulas, plus every
explicit child row/column position. The row count and height must reuse the same column
expression.
-- For every fixed-height section and every horizontal row with four or more substantive
- children, include a per-breakpoint layout budget: child groups, minimum widths/heights,
- gaps, padding and the resulting section size. Presence of a breakpoint is not enough.
+- Numeric branch evidence for every horizontal AutoLayout container and fixed-height
+ vertical section. Record available size versus padding, gaps, and child fixed/minimum
+ sizes; require wrap, stack, deliberate scrolling, or a larger threshold when they do
+ not fit. Protect required inputs, primary actions, and complete mutation receipts.
+ Apply the exact arithmetic, `FillPortions`, nested-width, overflow, and fixed-height
+ rules from `${PLUGIN_ROOT}/references/LayoutGuide.md` and `${PLUGIN_ROOT}/references/QAChecks.md`.
- Group each visible label with its corresponding input in one field container before
the row stacks.
+- Give every required classic or modern TextInput, NumberInput, Radio, DropDown, or
+ ComboBox a persistent human-readable visible label in the same field region and record
+ the exact binding in Data Entry Label Evidence. Apply the control-specific label contract
+ from `${PLUGIN_ROOT}/references/LayoutGuide.md`.
- For galleries with record actions, define the phone row as an action-first composition:
render the canonical identity's full text, status, and required lifecycle actions by
stacking them or placing the actions in an immediately visible overflow/detail entry.
@@ -264,10 +340,14 @@ For every screen brief, state explicitly:
keep both on the same eligible row or in the same immediately reachable detail. Do not
preserve a desktop column layout that moves Edit, approve, reject, or remove beyond the
canvas width, and do not drop an action to make the row fit.
-- For bounded local galleries of about ten rows or fewer, size the gallery to all rows
- and rely on the root scroll; do not plan a hidden nested scroll region. Dynamic gallery
- height is valid, but derive it from `CountRows(<the same source/filter used by Items>)`,
- never from rendered-item state such as `Self.AllItemsCount`.
+- Give every list-driven Gallery a conservative viewport-bounded numeric `Height`,
+ explicit positive `TemplateSize`, numeric `TemplatePadding`, nonempty `Items` source,
+ and concrete row controls. Do not self-size `Height` from `CountRows(...)` and
+ `Self.TemplateHeight`/`Self.TemplatePadding`; exported apps have rendered zero rows with
+ that shape despite populated collections. A required selected ID must also have either
+ a non-gallery event that assigns it or a row-selection event inside this render-safe
+ Gallery contract.
+
## 6. Assign the Control Name Space
@@ -285,7 +365,7 @@ can prevent one.
once in the shared plan as a **pattern**, and state explicitly that each screen
instantiates it under its own prefix. Never hand builders a literal block of shared
control names to copy verbatim.
-5. A pattern still has to pin its **values**. Control *names* vary by prefix; everything a
+5. A pattern still has to pin its **values**. Control _names_ vary by prefix; everything a
user perceives as "the same nav bar on every screen" must not. Give the pattern exact,
copyable values for: the wordmark or brand string, the breakpoint and
`LayoutDirection` formula, `LayoutAlignItems`, each item's `LayoutMinWidth`, and the
@@ -303,12 +383,10 @@ Write `[working directory]/App.pa.yaml`.
- Set `StartScreen: =Screen1`.
- Do not use `Navigate` in `OnStart`.
-Then call `compile_canvas` and fix every `[Control 'App', ...]` diagnostic before you
-write any plan artifact. You are the only agent that knows the collection schemas, and
-this is the cheapest point in the whole workflow to catch a bad field name. Ignore
-diagnostics from screen files — they are not written yet.
-
-Report the resulting `App.pa.yaml` compile status in your handoff.
+The orchestrator calls `compile_canvas` after you return and fixes every `[Control 'App',
+...]` diagnostic before dispatch. You know the collection schemas, so make `App.pa.yaml`
+complete and internally consistent, but do not claim compilation evidence from delegated
+context.
### EDIT
@@ -338,7 +416,7 @@ Follow `${PLUGIN_ROOT}/references/PlanTemplates.md`.
Write only orchestration information:
- Mode and requirements
-- Requirement coverage and complete Action Contracts
+- Requirement coverage, Required Record Fields, and complete Action Contracts
- Functional Test Matrix
- Working directory
- Compact discovery summary
@@ -349,7 +427,7 @@ Write only orchestration information:
The dispatch table columns are:
| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
-|--------|--------|-------------|----------|-------------|--------------|
+| ------ | ------ | ----------- | -------- | ----------- | ------------ |
Use `Create` or `Modify` exactly. In CREATE mode, the first row must target
`[working directory]/Screen1.pa.yaml`, use key `Screen1`, and point to
@@ -365,9 +443,11 @@ Write only information shared by multiple screens:
- Cross-screen navigation/state contracts
- Critical YAML conventions
+
Do not put control definitions, full schemas, API output, or per-screen specifications in
the shared plan.
+
### One screen brief per dispatch row
Name it from the target file:
@@ -388,6 +468,8 @@ Each brief contains only what that builder needs:
- Every Action Contract and Functional Test Matrix scenario owned or exercised by the
screen, including preconditions, source/ID, transition, observer, evidence, and boundary
behavior
+- Every Required Record Fields row owned by the screen, with its exact bound control,
+ formula, record-surface hierarchy, normal-state visibility, and layout budget
Two things a builder cannot recover on its own, and both cost a full round trip:
@@ -429,14 +511,14 @@ Return:
```markdown
Planning complete.
-| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
-|--------|--------|-------------|----------|-------------|--------------|
-| [Create / Modify] | [Screen] | `[working directory]/[file].pa.yaml` | [key] | [prefix] | `[working directory]/[file-base].screen-plan.md` |
+| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
+| ----------------- | -------- | --------------------- | -------- | ----------- | --------------------------------- |
+| [Create / Modify] | [Screen] | `[working directory]/[file].pa.yaml` | [key] | [prefix] | `[working directory]/[file-base].screen-plan.md` |
Plan index: `[working directory]/canvas-app-plan.md`
Shared plan: `[working directory]/canvas-app-shared.md`
App file: [`[working directory]/App.pa.yaml` for CREATE, "unchanged" for EDIT]
-App compile: [Clean / diagnostics remaining, with detail]
+App compile: Pending orchestrator validation
Functional scenarios: [N total; all assigned to screen briefs / defects]
```
@@ -444,8 +526,8 @@ Functional scenarios: [N total; all assigned to screen briefs / defects]
- Do not write screen `.pa.yaml` files.
- Do not edit existing `.pa.yaml` files in EDIT mode.
-- Call `compile_canvas` only to validate CREATE-mode `App.pa.yaml`. Do not use it to
- chase screen-file diagnostics; the orchestrator owns full-app validation.
+- Do not call `compile_canvas`; the orchestrator owns all compilation through the live
+ top-level MCP connection.
- Do not edit `[working directory]/_EditorState.pa.yaml`; record ordering work in `## Editor State Changes` for the top-level orchestrator.
- Do not embed all discovery output in the index or shared plan.
- Every screen brief must be self-sufficient when read with the shared plan.
diff --git a/plugins/canvas-apps/agents/canvas-screen-builder.md b/plugins/canvas-apps/agents/canvas-screen-builder.md
index 93a5111eb..882b0c3f4 100644
--- a/plugins/canvas-apps/agents/canvas-screen-builder.md
+++ b/plugins/canvas-apps/agents/canvas-screen-builder.md
@@ -1,24 +1,33 @@
---
name: canvas-screen-builder
description: >-
- Implements or modifies one Canvas App screen from a shared plan and a screen-specific
- brief. Writes exactly one .pa.yaml file and performs self-QA without compiling. Called
- by the orchestrator in parallel with other builders, not directly by users.
+ Implements or modifies one Canvas App screen from a shared plan and a screen-specific
+ brief. Writes exactly one .pa.yaml file and performs self-QA without compiling. Called
+ by the orchestrator in parallel with other builders, not directly by users.
color: green
user-invocable: false
tools:
- - Read
- - Write
- - Edit
- - view
- - create
- - edit
+ - Read
+ - Write
+ - Edit
+ - apply_patch
---
# Canvas Screen Builder
You own exactly one screen file.
+
+Read the supplied plugin root's `references/QAChecks.md`. Stop with
+`Status: Provenance Blocked` unless the QA guide defines
+`QACHK-SHARED-SOURCE-DERIVATION`. Never substitute a plugin root derived from the target
+file or working directory.
+
+Use `apply_patch` for the assigned disk-backed screen file. Attempt the write once. If the
+tool is unavailable or the call is denied, return `Status: Tooling Blocked` with the exact
+tool failure; do not return `Status: Blocked`, which is reserved for missing brief context.
+
+
Your invocation includes:
- Action: `Create` or `Modify`
@@ -28,6 +37,7 @@ Your invocation includes:
- Control name prefix
- Shared plan: `[working directory]/canvas-app-shared.md`
- Screen brief: an absolute `[working directory]/*.screen-plan.md` path
+- Plugin root: the immutable `${PLUGIN_ROOT}` path supplied by the orchestrator
## 1. Read Only Assigned Context
@@ -37,6 +47,7 @@ Read:
2. The assigned screen brief
3. For `Modify`, the exact target `.pa.yaml`
4. `${PLUGIN_ROOT}/references/BehaviorGuide.md` when the brief contains Required Actions
+5. `${PLUGIN_ROOT}/references/LayoutGuide.md`
Do not read `[working directory]/canvas-app-plan.md`, other screen briefs, or other screen YAML files.
Do not call discovery tools. The assigned documents contain all required context.
@@ -64,7 +75,7 @@ Example:
```yaml
Screens:
- Screen1:
+ Screen1:
```
`[working directory]/Screen1.pa.yaml` always exists in a new app. When your target file already exists,
@@ -88,6 +99,20 @@ Do not fix unrelated pre-existing issues.
### Both
+- Treat stable record identity as part of every lifecycle action. Edit and delete must
+ operate on the selected record's stable ID or selected record object, never on display
+ text, gallery position, or a newly constructed partial record. The `LookUp`/`Filter` that
+ locates a `Patch`/`Remove`/`UpdateIf` target must compare the key field against the raw
+ selected/context value — `LookUp(colInventory, ID = cmbItem.Selected.ID)` — with no
+ concatenation, prefix, suffix, casing, or reshaping of either side unless the plan's schema
+ documents that transformed key. Appending a literal like `& " ID"` is a **phantom LookUp
+ key**: it matches no row, so the `Patch` silently mutates nothing even though it compiles.
+- Keep one mutable source of truth per domain entity. Search, filters, ordering, alerts,
+ KPIs, dashboards, and reports must derive from that same source rather than a copied
+ counter, seed-only collection, or screen-local duplicate.
+- Give every required primary action a concrete initial-task path. Its control must remain
+ visible, enabled when preconditions hold, at least 44px in each interactive dimension,
+ inside its parent bounds, and unobscured by overlays or sibling panels.
- Every control you **add** carries your assigned control name prefix. Control names are
unique across the whole app, and you cannot see the other screens — the prefix is the
only thing preventing a collision. This applies to repeated UI blocks such as nav bars
@@ -115,6 +140,33 @@ Do not fix unrelated pre-existing issues.
- Treat every Required Action as one closed transition loop: reachable eligible entry,
event, operation against the named source and stable ID, declared postcondition, observer
reading that same source, and visible evidence. Do not write one field and render another.
+- Implement opposing transitions as separate Required Actions and scenarios even when they
+ share a form. Use the brief's explicit pointer-selectable operation, nullable selected
+ ID, invalid and valid gates, reset behavior, directional formulas, canonical observer,
+ and five-value receipt. In a shared-operation flow, selectors are selection-only and one
+ reachable guarded event owns the mutation and consumes the same operation state. For
+ separate direct actions, preserve independently gated mutation handlers instead.
+ Read inputs from live control state, use one literal guard per direction, capture the
+ canonical old value before mutation, and keep invalid states visible and recoverable.
+ Implement the exact selector, empty-state, input, reset, arithmetic, and same-record
+ sequence contracts from the brief and `${PLUGIN_ROOT}/references/BehaviorGuide.md`.
+- For every gallery row, calculate the template height rather than eyeballing it. A direct
+ row child's `Parent.Width` is gallery/template-scoped and can differ from the outer
+ container width used by the Gallery's `TemplateSize`. Use one deliberate breakpoint
+ source for row `LayoutDirection` and `TemplateSize`, or use the brief's numeric budget
+ for every reachable branch combination. Include every required field, badge, and action.
+- Do not rely on `App.Width`, root `Parent.Width`, or a named root's `Width` to activate a
+ narrow branch: embedded and scale-to-fit hosts may remain at logical design width while
+ rendering into a narrower physical viewport. Display settings are unavailable in
+ `.pa.yaml`, so required field/action groups must wrap, stack, deliberately scroll, or
+ fit safely even when the wide/default branch remains active. Self-reported layout
+ evidence cannot prove host viewport sensitivity.
+- Implement the brief's numeric budgets for every horizontal AutoLayout branch and
+ fixed-height vertical section. When content does not fit, wrap, stack, deliberately
+ scroll, simplify, or raise the threshold. Protect required inputs, primary actions, and
+ complete mutation receipts. Apply the exact sizing, `FillPortions`, nested-width,
+ overflow, and fixed-height rules from `${PLUGIN_ROOT}/references/LayoutGuide.md` and
+ `${PLUGIN_ROOT}/references/QAChecks.md`.
- Implement every row in `Functional Test Scenarios`. Use its Given state to verify
visibility and enablement, mentally execute the exact When interaction, then trace the
resulting source values through the named observer and evidence. Implement boundary and
@@ -124,6 +176,10 @@ Do not fix unrelated pre-existing issues.
item text, and give required fields a valid default when the business rule permits one.
Do not substitute an autocomplete combobox or any control that requires typed filtering
or keyboard-only commitment.
+- Pair every required classic or modern TextInput, NumberInput, Radio, DropDown, and
+ ComboBox with the persistent visible label and shared field region specified by the
+ brief. Apply the exact control-specific contract from `${PLUGIN_ROOT}/references/LayoutGuide.md`;
+ `AccessibleLabel` and `HintText` do not replace the visible field name.
- A manageable primary-record row needs a visible Edit action. Its handler stores the
stable record ID and prepopulates every editable input; Save updates that ID, preserves
unchanged fields, exits edit mode, and reveals the changed values. Cancel clears edit
@@ -131,6 +187,12 @@ Do not fix unrelated pre-existing issues.
- Every primary-record row or its immediately reachable detail renders the canonical
human-readable identity as full visible text. An avatar, initials, icon, record ID,
accessible label, or tooltip may supplement the identity but cannot replace that text.
+- Implement every row in `Required Record Fields`. Keep the named control inside the
+ specified card, row, or detail; bind its exact formula to the current record; and make it
+ visible, non-zero-sized, and readable in the normal desktop and phone layouts. A
+ time-only card or another one-field summary fails when the brief requires title, person,
+ description, status, or other values. A combined control passes only when its formula
+ references every field assigned to it and its complete text fits or wraps.
- When the brief contains paired Approve and Reject/Decline actions, implement both for
every eligible pending record on the same row or in the same immediately reachable
detail. Do not omit one action to reduce control count or fit a phone row; stack the
@@ -143,16 +205,34 @@ Do not fix unrelated pre-existing issues.
field is missing from the receipt. Keep it visible until dismissal or the next mutation.
Navigation, `Notify()`, or a selected, highlighted, filtered, or sorted list row may
supplement this receipt but cannot replace it.
+- Implement the brief's mutation lifecycle row exactly. Keep the mutation receipt, canonical
+ observer, requested-destination observer, synchronization, and focus bound to the same
+ stable ID. When the destination reads a cache, projection, related collection, or
+ external query, run its declared refresh/requery/update only after success and before
+ revealing destination evidence. Focus multi-record destinations by ID, never by display
+ text or list position.
+- Implement every mutation field-ledger row. A Changed field must occur in the handler write set
+ and receipt proof set with one labeled binding. Preserve each Preserved field by omitting
+ it from a partial update or carrying forward its canonical pre-state value, and keep its
+ post-state observer; never substitute a default, stale selection, display value, or
+ parallel collection.
+- Implement conditional stable-ID continuation only when the brief declares it for create feeding a later
+ edit, delete, relationship, approval, or transition. Bind the reachable downstream
+ action and mutation target to the returned create ID. Clear continuation identity and
+ mode after successful downstream completion or cancellation; retain it on failure only
+ when retry is intended. Do not synthesize continuation for create-only flows.
- At phone width, stack a manageable record row or provide an immediately visible
overflow/detail entry so full identity text, status, and required Edit/review/remove
actions remain reachable. Do not implement required actions only in right-side desktop
columns.
-- For bounded dynamic galleries, derive height from
- `CountRows(<the same source/filter used by Items>)`. Never use `Self.AllItemsCount` or
- another rendered-item count to determine the gallery's own height.
+- Give a list-driven Gallery a conservative viewport-bounded numeric `Height`, explicit
+ positive `TemplateSize`, numeric `TemplatePadding`, `Items`, and concrete row controls.
+ Do not self-size `Height` from `CountRows(...)` and `Self.TemplateHeight` or
+ `Self.TemplatePadding`; this exported shape can render zero rows. If row selection is
+ the only path that sets a required selected ID, this render-safe contract is mandatory.
- The sole responsive root uses exact `Width: =Parent.Width`,
- `Height: =Parent.Height`, `LayoutMinWidth: =0`, and `LayoutMinHeight: =0`; put
- breakpoint sizing on descendants.
+`Height: =Parent.Height`, `LayoutMinWidth: =0`, and `LayoutMinHeight: =0`; put
+breakpoint sizing on descendants.
- Prefix every property value with `=`. A value without it fails the whole file at parse
time and suppresses every other diagnostic in the screen.
- Quote any value containing a colon followed by a space — `Text: '="Votes: " & n'`, not
@@ -167,17 +247,27 @@ Do not fix unrelated pre-existing issues.
file you keep re-reading is the dominant cost in this workflow and does not improve the
result.
- Before the first `create` or whole-file `edit`, inspect the composed YAML text itself:
- - Every control creation keyword exactly matches the screen brief. Do not alter a
- `Control:` value or omit a required `ComponentName`, `ComponentLibraryUniqueName`,
- `Variant`, or `Layout`.
- - Every enum qualifier exactly matches the brief's `Enum name:`. In particular, Badge
- formulas use `='BadgeCanvas.Appearance'.Filled` and
- `='BadgeCanvas.ThemeColor'.Warning`, never `BadgeAppearance.Filled` or
- `BadgeColor.Warning`.
- - Every property used appears in that control's definition and every property value
- starts with `=`.
- These are pre-save checks, not only self-QA checks: invalid whole-screen YAML may make
- the document server reject the write before the file exists to inspect.
+ - Every control creation keyword exactly matches the screen brief. Do not alter a
+ `Control:` value or omit a required `ComponentName`, `ComponentLibraryUniqueName`,
+ `Variant`, or `Layout`.
+ - Every enum qualifier exactly matches the brief's `Enum name:`. In particular, Badge
+ formulas use `='BadgeCanvas.Appearance'.Filled` and
+ `='BadgeCanvas.ThemeColor'.Warning`, never `BadgeAppearance.Filled` or
+ `BadgeColor.Warning`.
+ - Every property used appears in that control's definition and every property value
+ starts with `=`.
+ - A `ModernDropdown` default is an explicit record compatible with `Items`, never
+ `First(Self.Items)`.
+ - A Gallery uses a bounded numeric `Height`, not collection-count/Self.Template
+ self-sizing, and explicitly sets `TemplateSize` and `TemplatePadding`.
+ - Gallery row `LayoutDirection` and `TemplateSize` share a breakpoint source, or every
+ reachable cross-branch pair has a numeric height budget that fits all required fields.
+ - Nested coordinated breakpoints use one screen-level width source, or every reachable
+ parent/child branch combination has explicit numeric width and height evidence.
+ - A chart `ItemColorSet` uses a color-table literal such as `[RGBA(...), RGBA(...)]`,
+ not `Table(Color, ...)`.
+ These are pre-save checks, not only self-QA checks: invalid whole-screen YAML may make
+ the document server reject the write before the file exists to inspect.
- If a whole-file write returns `failedToSave` or `ServerException`, do not submit the
identical content again. Re-run the pre-save checks against the composed text, correct
every creation-keyword mismatch, enum qualifier, unsupported property, missing formula
@@ -202,13 +292,15 @@ Do not fix unrelated pre-existing issues.
sampled: a check you skipped is a defect you shipped, and most of them have no compile
diagnostic behind them, so nothing downstream will catch it.
4. For Modify, scope checks to changed or added content.
-5. Record an outcome for every check by number — `PASS`, `FIXED(n)` or `N/A` — as
- `${PLUGIN_ROOT}/references/QAChecks.md` § "Reporting" describes. You report the line; do not
- summarize it as a total.
+5. Record complete check coverage and list only repairs and non-applicable checks, using
+ `${PLUGIN_ROOT}/references/QAChecks.md` § "Reporting". Do not emit 44 unsupported `PASS` claims.
6. For each Required Action, record a compact transition trace:
`Action: precondition -> control.event -> source[ID] write/read -> postcondition ->
- observer -> evidence`. Mark `PASS` only when every link is present in the generated
- formulas. Mark `BLOCKED: [missing link]` otherwise and repair it before returning.
+observer -> evidence`. Mark `PASS` only when every link is present in the generated
+ formulas. For a shared-operation flow, include the selector event and distinct guarded
+ mutation event in each directional trace, and confirm both name the same operation
+ state. Mark `BLOCKED: [missing link]` otherwise and repair it before
+ returning.
Do not call `compile_canvas`; the orchestrator owns compilation. It compiles as soon as
the first builder returns, so return promptly rather than polishing indefinitely.
@@ -219,19 +311,27 @@ the first builder returns, so return promptly rather than polishing indefinitely
Screen: [logical name]
Action: [Create / Modify]
File: [absolute target file]
-QA: 1 [outcome] · 2 [outcome] · …
-Fixes: [fix summary, or "clean"]
+QA coverage: 1-44 COMPLETE
+QA repairs: [defined QACHK identifier followed by FIXED(n), for example QACHK-MISSING-FORMULA-PREFIX FIXED(7), or "none"]
+QA N/A: [QACHK identifiers, or "none"]
+QA layout evidence: [numeric `QACHK-NO-HEIGHT-TRAP`, `QACHK-GALLERY-ROW-FITS-CONTENT`,
+`QACHK-HORIZONTAL-BUDGET`, and `QACHK-PRIMARY-ACTION-REACHABILITY` calculations, or
+`N/A` only where the check is genuinely inapplicable]
Functional:
+
- [Action]: PASS — [precondition] -> [control.event] -> [source and stable ID operation] -> [postcondition] -> [observer and visible evidence]
-Status: Done
+ Status: Done
```
-The `QA:` line must list every check in `${PLUGIN_ROOT}/references/QAChecks.md`. A return without it is
-incomplete, and the orchestrator will send the screen back.
+The QA coverage, repairs, N/A, and layout-evidence lines are required. Coverage means the persisted YAML
+was inspected; it is not evidence that a functional transition works. Do not append the
+legacy numbered `QA:` checklist or claim complete coverage when the supplied guide does
+not define all 44 checks.
The `Functional:` section must contain exactly one trace per Required Action. A trace that
omits the source/ID, postcondition, or observer/evidence is incomplete even when Check 33,
-34, or 35 says `PASS`.
+34, 35, 42, 43, or 44 says `PASS`. Never return `Status: Done` when lifecycle identity,
+shared-source derivation, or initial-task-path reachability is unresolved.
## Constraints
@@ -241,9 +341,9 @@ omits the source/ID, postcondition, or observer/evidence is incomplete even when
- Never use a property absent from that control's definition.
- Never normalize a `Control:` value supplied by the brief.
- Never invent an enum type name, and never write an enum member that starts with a digit
- unquoted — `DecimalPrecision.'1'`, not `DecimalPrecision.1`.
+unquoted — `DecimalPrecision.'1'`, not `DecimalPrecision.1`.
- Never leave a `ModernCard` slot unset. For text-only cards set `Image: =Blank()` and,
- when supported by the control definition, `HeaderImage: =Blank()`.
+when supported by the control definition, `HeaderImage: =Blank()`.
- Every multiword ModernButton or link that is a direct child of a vertical AutoLayout
container sets `Width: =Parent.Width`; `LayoutMinWidth` and stretch alignment alone do
not make the rendered control fill the row.
diff --git a/plugins/canvas-apps/references/BehaviorGuide.md b/plugins/canvas-apps/references/BehaviorGuide.md
index a7627fb54..2c65f5746 100644
--- a/plugins/canvas-apps/references/BehaviorGuide.md
+++ b/plugins/canvas-apps/references/BehaviorGuide.md
@@ -44,7 +44,7 @@ For every requested behavior, the plan must identify:
Keep a single source of truth for each concept. Do not update one collection while a visible gallery, metric, or selector reads another.
-Every mutation needs an in-viewport result surface bound to the exact affected record or a snapshot captured by the handler. Show the record identity, action, and fields needed to verify the requested outcome. A list, detail screen, or metric must also read the changed source, but list position is secondary evidence: a success notification, navigation alone, or a changed row somewhere in a long list does not satisfy the contract. Do not depend on programmatically scrolling a Gallery to an arbitrary record; Canvas galleries do not provide a reliable general reveal contract.
+Every user-requested or plan-declared mutation needs an in-viewport result surface bound to the exact affected record or a snapshot captured by the handler. Internal setup and initialization mutations do not require user-facing receipts. Show the record identity, action, and fields needed to verify the requested outcome. A list, detail screen, or metric must also read the changed source, but list position is secondary evidence: a success notification, navigation alone, or a changed row somewhere in a long list does not satisfy the contract. Do not depend on programmatically scrolling a Gallery to an arbitrary record; Canvas galleries do not provide a reliable general reveal contract.
## Closed-loop state transitions
@@ -54,18 +54,149 @@ Every action must form one traceable loop:
- Name the precondition and eligibility predicate. The control's `Visible` and `DisplayMode` formulas must permit that state.
- Mutate the same source and field that the observer reads. A status button that patches `ReviewState` while the badge renders `Status` is broken even when both formulas compile.
-- Identify records by an immutable stable ID. Capture `ThisItem.ID` or the selected ID before mutation and look up the target from the source; do not infer identity from a display name.
+- Identify records by an immutable stable ID. Capture `ThisItem.ID` or the selected ID before mutation and look up the target from the source; do not infer identity from a display name. The `LookUp`/`Filter` that locates the target must compare the key field against the raw selected/context value with no concatenation, prefix, suffix, casing, or reshaping (`= Selected.ID & " ID"`, `"ITEM-" & Selected.ID`, `Left(...)`, `Trim(...)`) unless the documented schema stores the key that way. A reshaped key is a **phantom LookUp key**: it matches nothing, so `LookUp` returns `Blank()` and the `Patch` silently mutates no row even though the formula compiles.
+- When an action depends on a prior record selection, use one nullable selected-record ID
+ as the selection source of truth. Initialize or reset it to `Blank()`, assign it from the
+ row's selection event, and use that same ID for the selected-record display, eligibility
+ gate, mutation `LookUp`, receipt, and compound sequence evidence. This is the default
+ pattern for proving an incomplete state. A direct row action may instead use that row's
+ stable `ThisItem` identity without introducing separate selection state.
+ `Control.Selected` / `.Selected.*` on a Gallery, Dropdown, List box, or Combo box is not
+ an empty-selection contract: a control with nonempty `Items` can expose an
+ automatic/default selection before the user chooses one. Use it as incomplete-state
+ evidence only when the control's empty-selection semantics are explicitly configured and
+ evidenced.
+- Feed mutations from live input, not dead state. Any variable that is meant to carry a user-entered or user-selected value (`varAmount`, `varOldQuantity`, a staging variable) must be written from its input control at the moment of input — an `OnChange` that runs `Set(varStaging, Control.Value)`/`Set(varStaging, Control.Selected)`, or an inline `Control.Value`/`Control.Selected` read inside the handler. A staging variable initialized only in `App.OnStart` or `Screen.OnVisible` and never re-written from an input is **dead**: it stays at its seed (`0`, `Blank()`), so the mutation silently computes against the seed while still compiling and still passing sign/direction checks. Prefer reading the input directly at mutation time (`Value(txtAmount.Text)`, `cmbItem.Selected.ID`).
+ An amount staged by `OnChange` is live, but not automatically valid: the input's
+ `Default`, `Min`, and current `Value` must still make invalid states representable, and
+ the submission gate must reject the staged/current blank or non-positive value.
- Use the mutation result or a fresh lookup by ID for the receipt. Do not read a potentially stale gallery `ThisItem` after `Patch` and assume it contains the new value.
- Make success contingent on the operation. Reset inputs, exit edit mode, navigate, and reveal success evidence only on the success path.
- Bind every downstream list, filter, metric, export, and decision surface to the same updated source or refresh the external source before observing it.
- Define a deterministic Given/When/Then scenario for the success path and each required negative or boundary path. If the generated formulas cannot satisfy that scenario by inspection, the action is incomplete.
+## Directional mutation contracts
+
+Opposing transitions are independent behaviors, even when one form implements both.
+Receive/Issue, Increase/Decrease, Credit/Debit, Allocate/Release, Check-in/Check-out, and
+Enable/Disable each require separate Action Contract rows and separate concrete
+Given/When/Then scenarios.
+
+- A shared form is valid only when the operation selector and amount or value input are
+ visible, pointer-selectable, and included in the mutation formula and receipt.
+- Disable submission whenever the operation or required amount/value is hidden, clipped,
+ blank, invalid, unset, or unreachable. Never fall through to a default direction or use
+ stale operation state from an earlier interaction.
+- Make blank and non-positive amount states representable so the invalid paths can actually
+ be exercised. For `ModernNumberInput`, define compatible `Default`, `Min`, and
+ `ValidationState` formulas: do not set `Min: =1` when acceptance must enter or reset to
+ `0`. Gate on the current `Value`; both `Control.Value <= 0` and
+ `Not(Control.Value > 0)` are valid non-positive checks. Show visible validation, and use
+ `Reset(Control)` only when its `Default` restores the chosen
+ invalid state. `Default: =Blank()` and `Default: =0` are both valid when `Min` permits
+ that value and the gate rejects it.
+- Reset shared operation state to `Blank()` on entry to the action screen and/or after a
+ successful Apply. `App.OnStart` runs for the app session, not for each visit or
+ adjustment, so an OnStart-only blank assignment permits a stale direction to carry into
+ the next action. Blank-operation acceptance names the actual operation variable and its
+ reset event; an amount input's `Default: =Blank()` is not operation-state evidence. If
+ Apply clears the current operation, capture it first and bind the receipt to that
+ completed-operation state rather than to the newly blank current state.
+- A classic Dropdown with nonempty `Items` needs `AllowEmptySelection: =true` when its
+ blank default/reset is used to prove that no operation is selected. For a Combo box,
+ use `DefaultSelectedItems: =[]` and verify its empty selection; do not assign
+ `AllowEmptySelection` to it. Do not prescribe unsupported empty-selection properties for
+ a List box. Prefer an explicit operation variable whenever control semantics are absent
+ or uncertain.
+- Independent direct actions need no shared operation variable or reset: the identity of
+ each action control commits its direction. Each handler still needs its own selected-ID
+ and valid-amount gates and its own complete mutation/receipt path.
+- For arithmetic pairs, capture the old value before mutation and encode the direction
+ explicitly: increase is `newValue = oldValue + amount`; decrease is
+ `newValue = oldValue - amount`. State pairs must likewise assign explicit opposing
+ target states rather than toggle implicit state. Read both operands from live state at
+ mutation time — the old value from the canonical source and the amount from the input
+ control (`Value(txtAmount.Text)` or an `OnChange`-populated staging variable), never from a
+ staging variable left at its `App.OnStart` seed.
+- Prove each guarded direction with its own literal comparison, such as
+ `varOperation = "Receive"` and `varOperation = "Issue"`. A default or `else` arm is not
+ directional proof because an unknown or blank value can fall through to it.
+- The receipt shows the chosen operation, old value/state, amount when applicable,
+ expected new value/state, and actual persisted new value/state. The destination observer
+ must agree with that receipt.
+
+## Canonical mutation and evidence contracts
+
+Apply these contracts to every create, edit, delete, relationship change, approval, and
+state transition. The lifecycle, field-ledger, and continuation contracts below generalize
+the directional rules above to all mutations. The plan and acceptance artifact use additive
+ledgers so existing Action Contract columns remain compatible.
+
+### Mutation lifecycle evidence
+
+- Capture a **mutation receipt** from the operation result (`Patch` result,
+ `Form.LastSubmit`, connector response), a fresh canonical-source lookup by returned
+ stable ID, or a pre-delete snapshot. The receipt names the action and stable ID.
+- Name the **canonical source** that owns the post-state and the **requested destination**
+ where the user expects to use or inspect it after the mutation, such as a list, detail,
+ relationship view, review queue, or status board. The receipt, canonical observer, and
+ destination observer must all refer to the same stable ID.
+- When canonical source and destination read the same live source, state that no
+ synchronization step is needed. When they differ because the destination uses a cache,
+ projection, related collection, or external query, name the successful-path
+ refresh/requery/update that synchronizes it before evidence is shown.
+- When the requested destination can contain multiple records, name the focus mechanism
+ that selects, filters, highlights, or opens the returned stable ID. Focus supplements
+ the receipt; it does not replace it and must not match by display text or list position.
+- Keep success-only synchronization, focus, navigation, and evidence after the mutation
+ succeeds. A failed or cancelled operation must not expose a success receipt or move the
+ user to a destination that implies success.
+
+### Changed/preserved field ledger
+
+- For each mutation, maintain a field ledger that classifies relevant fields as
+ **Changed** or **Preserved**. Include every field/status written by the handler and every
+ user-visible or lifecycle-significant field that the operation must retain. For delete,
+ record existence as Changed and bind its proof to the deletion snapshot plus canonical
+ absence observer.
+- A Changed row names the input or transition expression, canonical write target, and
+ receipt proof binding. Every changed field must appear in both the Action Contract write
+ set and proof set; every write-set field must have exactly one readable proof binding.
+- A Preserved row names its canonical pre-state source and preservation mechanism: omit it
+ from a partial update, or carry forward that exact canonical value. Do not repopulate a
+ preserved field from a control default, stale selection, display text, or parallel
+ collection. Name the post-state observer that demonstrates preservation.
+- The ledger is a contract, not a second mutation schema. It expands the existing
+ write-set/proof-set parity rule without changing the meaning of either set.
+
+### Conditional stable-ID continuation
+
+- Include continuation state only when a successful create is intentionally used by a
+ later edit, delete, relationship, approval, or state-transition action. Do not add a
+ continuation contract for create-only flows or ordinary navigation.
+- Capture the created record's returned stable ID and bind the named continuation action
+ directly to that ID. The later mutation, its receipt, canonical observer, and requested
+ destination must retain the same identity; never recover it from a display name, current
+ list position, or implicit default selection.
+- Clear continuation identity and mode after the downstream action completes successfully
+ or the user cancels it. A failed downstream mutation may retain the ID for retry, but
+ must not claim completion or clear the context as if it succeeded.
+
+These contracts can be traced statically through final YAML, but static traceability does
+not prove that controls rendered, events fired, external writes succeeded, synchronization
+completed, or focus moved at runtime. Keep acceptance labeled
+`Runtime evaluation: NOT RUN` until those paths are actually executed in the running app.
+
## Mutation receipt contract
- Reserve a compact result card, banner, or detail region in the action screen's initial viewport. Hide it until a mutation succeeds.
- In the mutation handler or form success event, capture the returned record, stable ID, or a deletion snapshot before resetting inputs or navigating. Bind the result surface to that captured state.
- Define a **write set** for each mutation: every field and status value the handler creates or changes. Define a **proof set** in the Action Contract: the identity plus the write-set values that must be visible after success. For create and edit, the proof set must include every user-entered or user-selected field written by the handler; do not reduce it to fields already convenient to display in a list. For approve, reject, or another transition, include the identity and resulting status. For delete, include the removed identity and action from the captured snapshot.
- Render every proof-set field as labeled, readable content bound to the captured state. A field is not proven by the input before submission, by an agent's remembered value, by hidden state, or by an unlabeled/truncated list cell.
+- Keep a directional receipt's operation, old value, amount, expected value, and actual
+ value together in one sufficiently sized visible region. Budget the container's height
+ from all five labeled rows, gaps, and padding; a visible heading above clipped receipt
+ fields is not evidence.
- Keep the result visible until the user dismisses it or begins another mutation. A transient `Notify()` may supplement this surface but cannot replace it.
- Also refresh or update the shared source so lists, filters, metrics, and later screens reflect the mutation. The receipt proves the immediate outcome; it does not replace source-of-truth consistency.
- Treat write-set/proof-set parity as a generation invariant. If the handler writes a user-supplied field that the receipt does not render, the mutation is incomplete even when persistence and navigation work.
@@ -89,6 +220,20 @@ Every action must form one traceable loop:
- A required action below the fold needs an obvious, working scroll affordance and must not be trapped inside nested fixed-height containers.
- Repeat the same destination set and ordering across screens so an evaluator or user does not need to rediscover navigation after each action.
+## Record presentation contract
+
+- For every repeated card, row, or immediately reachable detail, enumerate the fields the
+ requirements expect users to see. Render each field through a visible control bound to
+ the current record and keep that control inside the record surface.
+- The canonical identity is mandatory, but it is not sufficient when the request also
+ names people, time ranges, descriptions, statuses, or other details. A time-only card,
+ icon, tooltip, accessible label, hidden control, or clipped text does not prove those
+ fields are present.
+- A combined text control may render several fields only when its formula references every
+ required source field and the complete value fits or wraps in the normal layout.
+- After create or edit, update or refresh the source used by the record surface so the
+ required field bindings immediately show the new values without a manual refresh.
+
## Role-scoped record management and review
A request for a named role to manage all records of the app's primary entity is an operational lifecycle requirement, not a request for a read-only list. It does not imply CRUD for supporting entities.
diff --git a/plugins/canvas-apps/references/ControlGuide.md b/plugins/canvas-apps/references/ControlGuide.md
index 048f031cb..569388048 100644
--- a/plugins/canvas-apps/references/ControlGuide.md
+++ b/plugins/canvas-apps/references/ControlGuide.md
@@ -153,6 +153,40 @@ ItemDisplayText: =ThisItem.Value
A dropdown whose options all appear empty is almost always this mistake. When `Items` is
already a single-column table you can omit `ItemDisplayText` entirely.
+Required data-entry controls must satisfy the persistent visible-label contract in
+`${PLUGIN_ROOT}/references/LayoutGuide.md`; `AccessibleLabel` and `HintText` do not replace it.
+
+For Dropdown, ComboBox, and other controls with a `Default` property, `Items` is not an
+output property and cannot be referenced as `Self.Items` from the default formula. Use an
+explicit value or record compatible with `Items`, or derive it directly from the same
+source expression:
+
+```yaml
+Items: '=[{Value:"All"},{Value:"Open"},{Value:"Closed"}]'
+Default: '=First([{Value:"All"},{Value:"Open"},{Value:"Closed"}])'
+```
+
+`TemplateSize` is an input property used in authored YAML to configure each Gallery
+item's size. Give the Gallery a conservative viewport/fixed `Height` and set
+`TemplateSize` and `TemplatePadding` explicitly:
+
+```yaml
+Height: =320
+TemplateSize: =64
+TemplatePadding: =8
+```
+
+Do not self-size a Gallery from `CountRows(...)` and `Self.TemplateHeight`,
+`Self.TemplateWidth`, or `Self.TemplatePadding`. That circular exported shape can render
+zero rows even when `Items` is populated.
+
+For charts, `ItemColorSet` expects a single-column table of color values. Supply the
+colors directly instead of wrapping them in records with custom field names:
+
+```yaml
+ItemColorSet: =[RGBA(0,102,204,1), RGBA(16,124,65,1)]
+```
+
## Properties are per-control — never transfer them by analogy
Three traps produce most `Unknown property` errors.
@@ -401,7 +435,7 @@ replace `Badge.Content`; omitting Content can render placeholder text such as `A
- `LayoutGap` — spacing between items
- `LayoutOverflowY` — vertical overflow (`Scroll` for scrollable containers)
- `FillPortions` — proportional sizing
-- `PaddingTop`/`Bottom`/`Left`/`Right` — container padding
+- `PaddingTop`/`PaddingBottom`/`PaddingLeft`/`PaddingRight` — container padding
## Troubleshooting
diff --git a/plugins/canvas-apps/references/CreateWorkflow.md b/plugins/canvas-apps/references/CreateWorkflow.md
index e40055006..f0a83a059 100644
--- a/plugins/canvas-apps/references/CreateWorkflow.md
+++ b/plugins/canvas-apps/references/CreateWorkflow.md
@@ -58,10 +58,24 @@ Use this format:
List every requested behavior in Functional Scope before decorative or optional screens. Do not present the plan as ready when a named action has only a control and no source transition or visible success state.
-Wait for user approval. Revise and re-present if requested.
+When the request explicitly identifies itself as a noninteractive automation run and says
+that a reasonable plan is pre-approved, construct the complete plan internally and continue
+directly to the planner. Do not pause, ask for confirmation, or end the turn after planning.
+
+Otherwise, wait for user approval. Revise and re-present if requested.
## 4. Invoke the Planner
+
+Before delegation, use the top-level skill's MCP connection to call `list_controls`,
+`list_apis`, and `list_data_sources`; call `describe_control` for every control type in
+the approved plan; and call `describe_api` and `get_data_source_schema` only for APIs and
+data sources the plan uses. For Canvas or Code Components, make their `describe_control`
+calls last so the packet contains the freshest Studio snapshot. Preserve the exact
+results as the discovery packet. Do not delegate these calls: task agents do not
+reliably inherit the configured MCP connection.
+
+
Invoke the `canvas-app-planner` agent with `Task` and:
```text
@@ -69,13 +83,21 @@ Mode: CREATE
Working directory: `[working directory]`
Plan index: `[working directory]/canvas-app-plan.md`
Shared plan: `[working directory]/canvas-app-shared.md`
+Plugin root: `${PLUGIN_ROOT}`
Requirements: [user requirements]
Approved plan: [full approved plan]
Target users and device: [stated or inferred]
+Discovery packet: [complete results gathered above]
```
-The planner discovers resources, writes `[working directory]/App.pa.yaml`, the plan index, shared plan,
-and one screen brief per dispatch row. It does not redesign the approved plan.
+The planner uses the discovered resources, writes `[working directory]/App.pa.yaml`, the plan index,
+shared plan, and one screen brief per dispatch row. It does not redesign the approved
+plan.
+
+If it returns `Status: Discovery Packet Blocked`, gather the named missing result in this
+top-level context and re-invoke it with the completed packet. If writing is blocked, apply
+its complete inline artifact payloads verbatim as required by the skill before entering
+Planned Build Handoff.
Wait for the planner to finish, then return to **Planned Build Handoff** in the
`canvas-app` skill.
diff --git a/plugins/canvas-apps/references/EditWorkflow.md b/plugins/canvas-apps/references/EditWorkflow.md
index a740144de..d7595cc5b 100644
--- a/plugins/canvas-apps/references/EditWorkflow.md
+++ b/plugins/canvas-apps/references/EditWorkflow.md
@@ -76,6 +76,18 @@ Wait for user approval. Revise and re-present if requested.
## 4. Invoke the Planner
+
+Before delegation, use the top-level skill's MCP connection for discovery introduced by
+the edit. List resources only when the edit introduces resources not already present.
+Call `describe_control` for every type receiving a property, enum, or variant not already
+carried in its target YAML, and call `describe_api` and `get_data_source_schema` only for
+APIs and data sources involved in the edit. Also call `describe_control` for every Canvas
+or Code Component used by the plan, and make those component calls last so the packet
+contains the freshest Studio snapshot. Preserve the exact results as the discovery
+packet. Do not delegate these calls: task agents do not reliably inherit the configured
+MCP connection.
+
+
Invoke the `canvas-app-planner` agent with `Task` and:
```text
@@ -83,14 +95,21 @@ Mode: EDIT
Working directory: `[working directory]`
Plan index: `[working directory]/canvas-app-plan.md`
Shared plan: `[working directory]/canvas-app-shared.md`
+Plugin root: `${PLUGIN_ROOT}`
Edit requirements: [user requirements]
Approved plan: [full approved plan]
Current app state: [palette, variables, layout, screens, controls]
Synced files: [absolute working-directory paths]
+Discovery packet: [complete results gathered above]
```
The planner writes the plan index, shared plan, and one screen brief per dispatch row. It
does not edit any `.pa.yaml` file in EDIT mode.
+If it returns `Status: Discovery Packet Blocked`, gather the named missing result in this
+top-level context and re-invoke it with the completed packet. If writing is blocked, apply
+its complete inline artifact payloads verbatim as required by the skill before entering
+Planned Build Handoff.
+
Wait for the planner to finish, then return to **Planned Build Handoff** in the
`canvas-app` skill.
diff --git a/plugins/canvas-apps/references/LayoutGuide.md b/plugins/canvas-apps/references/LayoutGuide.md
index 1ad175a3c..a46a522e2 100644
--- a/plugins/canvas-apps/references/LayoutGuide.md
+++ b/plugins/canvas-apps/references/LayoutGuide.md
@@ -9,6 +9,7 @@ and are reported by no compile diagnostic.
- Manual layout
- Auto layout
- Keep responsive layout out of state
+- Keep persistent visible labels with inputs
- Grid layout
- Galleries are Classic — their rows do not reflow
- Horizontal rows must reflow at narrow widths
@@ -73,8 +74,8 @@ For flexible, responsive designs:
FillPortions: =1 # Proportional share of the remaining space
```
-1. **Dynamic gallery height:**
- `Height: =With({rowCount: CountRows(<same source/filter used by Items>)}, rowCount * Self.TemplateHeight + ((rowCount + 1) * Self.TemplatePadding))`
+1. **Bounded gallery viewport:** explicit numeric `Height`, positive `TemplateSize`,
+ numeric `TemplatePadding`, `Items`, and row controls
2. **Container scrolling:** `LayoutOverflowY: =LayoutOverflow.Scroll`
3. **AutoLayout child properties:** `AlignInContainer`, `FillPortions`,
`LayoutMinWidth/Height`, `LayoutMaxWidth/Height`
@@ -86,7 +87,8 @@ For flexible, responsive designs:
## Keep responsive layout out of state
Layout must react to the current size, not to a variable captured during navigation.
-Write breakpoints directly in layout properties:
+Write breakpoints directly in layout properties. Use `Parent.Width` this way only when
+`Parent` is a proven nested local layout region whose width follows the rendered space:
```yaml
LayoutDirection: =If(Parent.Width < 640, LayoutDirection.Vertical, LayoutDirection.Horizontal)
@@ -94,9 +96,25 @@ LayoutDirection: =If(Parent.Width < 640, LayoutDirection.Vertical, LayoutDirecti
Do not set `varIsMobile`, `varColumns`, `varPageWidth` or similar values in `OnVisible`
and then read them from `Width`, `Height`, grid, visibility or direction properties.
-Studio can render before `OnVisible` runs, and resizing does not re-run the event. Use
-`App.Width` for app-level breakpoints and `Parent.Width` or `Self.Width` for nested
-layout scopes.
+Studio can render before `OnVisible` runs, and resizing does not re-run the event.
+`App.Width`, a named root's `Width`, and root-level `Parent.Width` can describe the
+logical design canvas while an embedded or scale-to-fit host renders into a narrower
+physical viewport. Display settings are not available in `.pa.yaml`, so static acceptance
+cannot prove those values track the host. Required fields and actions must remain safe if
+the wide/default branch stays active: wrap, stack unconditionally, use deliberate
+scrolling, or fit the complete wide branch within a static numeric bound.
+
+## Keep persistent visible labels with inputs
+
+Every required classic or modern TextInput, NumberInput, Radio, DropDown, and ComboBox
+needs a persistent human-readable visible label in the same reachable field region.
+For static acceptance, a separate label and input must have the same immediate parent;
+put both in a dedicated field group rather than pointing to a label elsewhere on the
+screen. `AccessibleLabel` is for assistive technology, while `HintText` disappears
+during entry; neither tells every user what a populated field means. The current contract
+recognizes a native visible `Label` only on `ModernNumberInput`; all other input types
+need a real sibling label. Prefer separate stacked label/input rows or compact vertical
+field groups over an overlapping horizontal input strip.
## Grid layout
@@ -164,11 +182,12 @@ reflow strategy. Pick one:
LayoutDirection: =LayoutDirection.Horizontal
LayoutWrap: =true
-# 2. Stack: the row becomes a column below a breakpoint.
+# 2. Stack in a proven nested local region: the row becomes a column below a breakpoint.
LayoutDirection: =If(Parent.Width < 640, LayoutDirection.Vertical, LayoutDirection.Horizontal)
```
-Every property is a formula, so a breakpoint can drive sizing and visibility too:
+Within that same proven nested local region, a breakpoint can drive sizing and visibility
+too:
```yaml
Width: =If(Parent.Width < 640, Parent.Width, 320)
@@ -205,18 +224,21 @@ parent grow. Avoid parent `Height` formulas that read descendant `.Height` value
those descendants also size from the parent; use collection counts and constants
directly.
-Small bounded lists should not create a second hidden scroll region. For a local roster
-of roughly ten or fewer rows inside a scrollable root, include every row and its template
-padding in the gallery height, then let the root scroll. Count the gallery's source
-expression, not `Self.AllItemsCount`: rendered-item counts depend on the gallery having a
-non-zero height and can create a zero-height cycle.
+Give list-driven galleries a conservative viewport-bounded height and let the Gallery
+scroll when its source has more rows. Always set explicit positive `TemplateSize`, numeric
+`TemplatePadding`, `Items`, and concrete row controls. Do not derive the Gallery's own
+height from `CountRows(...)` and `Self.TemplateHeight`/`Self.TemplateSize`/
+`Self.TemplatePadding`: exported apps have rendered zero rows with that shape despite
+populated collections.
```yaml
-Height: =With({rowCount: CountRows(<same source/filter used by Items>)}, rowCount * Self.TemplateHeight + ((rowCount + 1) * Self.TemplatePadding))
+Height: =320
+TemplateSize: =64
+TemplatePadding: =8
```
-Use that same source count for empty-state visibility. Do not derive either property from
-`Self.AllItems`, `Self.AllItemsCount`, or another rendered gallery property.
+Drive empty-state visibility from the source/filter count, never `Self.AllItems`,
+`Self.AllItemsCount`, or another rendered gallery property.
## Give labelled controls room for their longest value
diff --git a/plugins/canvas-apps/references/PlanTemplates.md b/plugins/canvas-apps/references/PlanTemplates.md
index ae368892d..a09bc838b 100644
--- a/plugins/canvas-apps/references/PlanTemplates.md
+++ b/plugins/canvas-apps/references/PlanTemplates.md
@@ -20,20 +20,51 @@ The planner writes three artifact types:
# Canvas App Plan
## Mode
+
CREATE
## Requirements
+
[Original requirements]
## Requirement Coverage
-| Requirement | Planned affordance | Fidelity |
-|-------------|--------------------|----------|
+
+| Requirement | Planned affordance | Fidelity |
+| ----------------------------------------------- | ------------------------------------ | ------------------------------- |
| [Concrete noun or interaction from the request] | [Visible control and exact behavior] | Exact / Approximation: [reason] |
+## Required Record Fields
+
+| Field key | Screen | Record surface | Required field | Source field | Presentation requirement |
+| -------------------------------- | -------- | -------------- | -------------- | ------------ | ----------------------------------------- |
+| [screen/surface/field identifier] | [Screen] | [Card/row/detail] | [Visible meaning] | [Record field] | [Full text, combined format, label, etc.] |
+
+[Include one row for every field the requirements say must appear on a repeated record
+card, row, or immediately reachable detail. Include the canonical identity and every
+requested title, person, time range, description, status, or other display value. Use one
+stable unique field key per row. A surface that renders only one secondary value, such as
+time, does not satisfy omitted requested fields. Omit this section only when the app has no
+record list, card, row, or detail surface.]
+
+## State-Driven Surface Visibility
+
+| Surface key | Owner screen | Surface control | State predicate | Visible and hidden states |
+| ----------- | ------------ | --------------- | --------------- | ------------------------- |
+| [stable surface identifier] | [Screen] | [Container/card/panel control] | [Exact `=state predicate`] | [State where the surface appears; state where it is hidden] |
+
+[Include a row only when the plan requires a whole UI surface to appear or disappear
+according to app state. The named control is the surface whose `Visible` property owns the
+disclosure, not a child control. Omit always-visible surfaces, navigation-based disclosure,
+child-only visibility, and visibility not required by the plan. An exact
+`Surface.Visible=state predicate` declaration in an Action Contract's
+`Observer and evidence` cell is the established compact form of the same contract; do not
+duplicate it in this table.]
+
## Action Contracts
-| Requested action | Preconditions | Entry point | Owner screen | Control and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
-|------------------|---------------|-------------|--------------|-------------------|----------------------|------------------------------|--------------------|-------------------|-----------------------|
-| [Concrete requested action] | [Eligible state and enabled/visible rule] | [Visible control the user starts from] | [Screen] | [PrefixedControl.OnSelect / OnChange] | [Named source and immutable identity, or N/A] | [Exact operation and resulting source state] | [Every changed field/status, or N/A] | [Identity plus every value rendered after success, or N/A] | [Formula/control reading the post-state plus in-viewport evidence] |
+
+| Requested action | Preconditions | Entry point | Owner screen | Control and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
+| --------------------------- | ----------------------------------------- | -------------------------------------- | ------------ | ------------------------------------- | --------------------------------------------- | -------------------------------------------- | ------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------------ |
+| [Concrete requested action] | [Eligible state and enabled/visible rule] | [Visible control the user starts from] | [Screen] | [PrefixedControl.OnSelect / OnChange] | [Named source and immutable identity, or N/A] | [Exact operation and resulting source state] | [Every changed field/status, or N/A] | [Identity plus every value rendered after success, or N/A] | [Formula/control reading the post-state plus in-viewport evidence] |
[Include only actions stated by the request or approved plan and apply the relevant
acceptance paths from `${PLUGIN_ROOT}/references/BehaviorGuide.md`. Do not infer universal CRUD for
@@ -45,34 +76,183 @@ choices, defaults, stable identity, prepopulation, cancel behavior, and a determ
post-save mutation receipt bound to the changed ID. For every mutation, enumerate the write
set and proof set. A create/edit proof set must contain every user-entered or user-selected
field in the write set. Name the receipt control, visibility state, and labeled binding for
-each proof-set field. Do not use navigation, a notification, or a row somewhere in a longer
-list as the Observable result.]
+each proof-set field. Opposing transitions have separate rows even when they share a form.
+For an arithmetic pair, each row names old value, amount, explicit `+` or `-` arithmetic,
+and a proof set containing operation, old value, amount, expected new value, and actual
+persisted new value. Do not use navigation, a notification, or a row somewhere in a longer
+list as the Observable result. For a shared-operation flow — directional selector events
+commit operation state and a distinct guarded event consumes that state to mutate — each
+directional row must name its selection-only event, the same operation state, and the same
+distinct mutation event, regardless of control names or labels. Selectors never mutate,
+but may also set receipt/display state; the actual operation state is the one consumed by
+the mutation owner. An event-bearing selector must assign it, the invalid gate must
+blank-check it, and the gated control must own or route to the mutation. A dead gated
+control beside direct-mutation buttons is invalid. Each arithmetic branch is associated
+with its matching operation. Button, dropdown, and radio selectors are all valid when
+they commit explicit direction state. Separate direct actions remain valid when each
+action is independently gated and no dead shared gate is claimed; their control identity
+commits direction, so they require no shared operation variable/reset. Every direct action
+still gates selected ID and amount.]
+
+## Mutation Lifecycle Evidence
+
+| Action | Receipt binding | Canonical source and observer | Requested destination and observer | Stable ID continuity | Synchronization when sources differ | Destination focus |
+| ------ | --------------- | ----------------------------- | ---------------------------------- | -------------------- | ----------------------------------- | ----------------- |
+| [Mutation Action Contract] | [Returned record/ID or deletion snapshot plus receipt control] | [Authoritative source and exact post-state observer] | [Requested list/detail/review/relationship/status surface and exact observer] | [Same immutable ID across operation, receipt, canonical observer, and destination] | [Exact success-path refresh/requery/cache update, or N/A — same live source] | [Exact select/filter/highlight/open-by-ID behavior, or N/A — single-record destination] |
+
+[Include one row per mutation. This lifecycle ledger supplements, rather than replaces, the
+Action Contract. The requested destination is the surface where the requirement expects
+the result to be usable or inspectable. When it reads a different cache, projection,
+related collection, or external query from the canonical source, name the synchronization
+event that runs only after success. A multi-record destination must focus the same stable
+ID; display text and list position are not identity.]
+
+## Mutation Field Ledger
+
+| Action | Field | Classification | Canonical pre-state or input | Write or preservation mechanism | Receipt/proof binding | Post-state observer |
+| ------ | ----- | -------------- | ---------------------------- | ------------------------------- | --------------------- | ------------------- |
+| [Mutation Action Contract] | [Field/status] | Changed / Preserved | [Live input/transition expression, or canonical pre-state lookup] | [Exact write target/expression, omitted partial-update field, or canonical carry-forward] | [Labeled receipt binding for Changed; preservation evidence for Preserved] | [Exact canonical/destination formula reading the same ID and field] |
+
+[Include every field/status written by the handler and every user-visible or
+lifecycle-significant field that must survive it. This field ledger expands the existing
+write-set/proof-set contract: each Changed row appears in both sets and has one readable
+proof binding. Each Preserved row names how the canonical value survives and where the
+post-state proves it; never source preservation from a default, display text, stale
+selection, or parallel collection.]
+
+## Continuation Contracts
+
+[Include this conditional continuation section only when a create intentionally feeds a later edit, delete,
+relationship, approval, or state-transition action. Otherwise omit it.]
+
+| Create action | Returned stable-ID binding | Downstream action and event | Downstream target binding | Successful-completion clear | Cancellation clear |
+| ------------- | -------------------------- | --------------------------- | ------------------------- | ---------------------------- | ------------------ |
+| [Create Action Contract] | [Exact captured returned ID] | [Later mutation and reachable control event] | [Exact lookup/target using that ID] | [Exact successful downstream event clearing ID and mode] | [Exact cancel event clearing ID and mode without mutation] |
+
+[The continuation action, later mutation receipt, observers, and requested destination
+must use the captured returned ID. Never recover the created record from display text,
+list position, or implicit selection. A downstream failure may retain the ID for retry,
+but completion and cancellation are the only clearing paths.]
## Functional Test Matrix
-| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
-|----------|-------|------|------|------------------|---------------------------|
+
+| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
+| ------------------------ | --------------------------------------- | ----------------------------------- | ---------------------------- | --------------------------------------------- | ------------------------------------------------------------- |
| [Action-path identifier] | [Deterministic seed and eligible state] | [Exact visible control interaction] | [Exact source postcondition] | [Observer formula/control and receipt fields] | [Blocked, empty, invalid, clear, or failure behavior, or N/A] |
[Include at least one success scenario for every Action Contract and one row for every
required boundary or negative path. Use concrete seeded IDs and values when the app uses
local/mock data. Every Then clause must be provable from the named source through the
-Evidence surface; do not use appearance, navigation, or notification as proof.]
+Evidence surface; do not use appearance, navigation, or notification as proof. Opposing
+transitions require separate scenarios with the same concrete old value and amount so
+their expected results prove both arithmetic directions. When Continuation Contracts are
+present, include returned-ID-bound downstream completion and cancellation scenarios; both
+must prove continuation state clears, while cancellation leaves the source unchanged.]
+
+## Directional Mutation Evidence
+
+[Include this section when the Action Contracts contain both directions of Receive/Issue,
+Increase/Decrease, Credit/Debit, Allocate/Release, Check-in/Check-out, or Enable/Disable.
+Use one row per pair. Declare exact compile-ready planned
+`Control.Property: =formula` bindings; final acceptance compares the implemented YAML to
+this contract. The selected-record state must be the exact stable-ID target used by both
+mutations. Receipt bindings must be separated with `<br>` and include
+`operation`, `old`, `amount`, `expected`, and `actual`. For a shared-operation flow, both
+mutation columns name the same distinct event binding and identify the operation value and
+branch that reaches the corresponding arithmetic; isolated `+` and `-` excerpts are not
+evidence. The invalid-submit gate must blank-check the exact operation state written by
+every selector and consumed by that event. The operation-state reset binding must name
+that state's `Blank()` assignment on screen entry and/or after successful Apply; never put
+an amount input's `Default` in that column. Use one nullable selected-ID expression
+initialized or reset to `Blank()`, assigned by row selection, and consumed by display,
+gate, mutation, receipt, and compound evidence. `Control.Selected` / `.Selected.*` is not
+an explicit no-selection contract for a nonempty Gallery, Dropdown, List box, or Combo box
+unless its empty-selection semantics are configured and evidenced. Declare compatible
+NumberInput `Default`, `Min`, current `Value` gate, visible validation, and reset behavior;
+final validation cross-checks those planned bindings against implemented YAML. Blank and
+non-positive values must be representable. `Default: =0` is valid with `Min <= 0`, a
+rejecting gate, and Reset that restores zero. An `OnChange`-staged amount is subject to the
+same input validity checks. Accept either `value <= 0` or `Not(value > 0)` for the
+non-positive gate. For a classic operation Dropdown with nonempty `Items`, require
+`AllowEmptySelection: =true`; for a Combo box require `DefaultSelectedItems: =[]`. Do not
+prescribe an unsupported empty-selection property for a List box, and prefer explicit
+operation state when control semantics are uncertain. Every direction must have its own
+literal guard; default/else arms do not prove a direction. If success resets current
+operation state, the receipt operation binding must use a captured completed-operation
+value.
+Preserve quoted or block-scalar formulas and
+normalize embedded newlines to `<br>` in the table. A receipt may render readable label
+text, but static evidence must expose one unambiguous underlying value expression for each
+of `operation`, `old`, `amount`, `expected`, and `actual`. Use either a direct value
+formula or literal label decoration around exactly one dynamic value expression. If a
+binding contains multiple plausible dynamic values and the underlying value cannot be
+uniquely extracted, record a dedicated ambiguous-receipt-expression error rather than
+guessing. A `var*` or `loc*` operand is live only when a reachable event assigns it from
+the input with `Set(...)` or `UpdateContext({...})` before the mutation, or the mutation
+reads the input inline. `App.OnStart`/`Screen.OnVisible`-only and after-mutation assignments
+do not establish liveness.]
+
+| Pair | Selected-record expression | Operation-state reset binding | Invalid-submit gate | Receive/increase mutation | Issue/decrease mutation | Canonical-source observer | Receipt bindings |
+| ---- | -------------------------- | ----------------------------- | ------------------- | ------------------------- | ----------------------- | ------------------------- | ---------------- |
+| [Receive/Issue] | [e.g. `varSelectedId`; planned YAML must blank-reset, row-assign, and consistently consume it] | [e.g. `Adjust.OnVisible: =Set(varOperation, Blank())` or exact successful-Apply reset] | [e.g. `btnApply.DisplayMode: =If(IsBlank(varSelectedId) \|\| IsBlank(varOperation) \|\| IsBlank(numAmount.Value) \|\| numAmount.Value <= 0, DisplayMode.Disabled, DisplayMode.Edit)`] | [exact `Control.Property: =formula`] | [exact `Control.Property: =formula`] | [exact `Control.Property: =formula`] | [e.g. `operation=lblReceiptOperation.Text: =varLastOperation<br>old=lblReceiptOld.Text: =varOldQuantity<br>amount=lblReceiptAmount.Text: =varAmount<br>expected=lblReceiptExpected.Text: =varExpectedQuantity<br>actual=lblReceiptActual.Text: =varLastMutation.Quantity`] |
+
+## Compound Sequence Evidence
+
+[Include this section when both directions of an opposing pair act on the **same record
+type**. One row per pair. It proves the second operation reads the value the first mutation
+already persisted, not the original — the runtime failure a single-operation scenario cannot
+catch. The `Second-op old-value binding` must declare the exact compile-ready planned
+`Control.Property: =formula` that sources the old value for the second operation from the
+canonical source (e.g. a `LookUp` over the patched collection), not a stale selection
+snapshot. Final acceptance compares the implemented YAML to this contract. The validator
+does not machine-check this table; it is a required reviewer/authoring proof.]
+
+| Pair | Same-record ID expression | Sequence (start -> op1 amount -> mid -> op2 amount -> end) | Second-op old-value binding (reads mutated canonical source) |
+| ---- | ------------------------- | --------------------------------------------------------- | ------------------------------------------------------------ |
+| [Receive/Issue] | [e.g. `varSelectedInventoryId`] | [e.g. `Qty 10 -> Receive 3 -> 13 -> Issue 2 -> 11`] | [exact `Control.Property: =formula` reading canonical source, e.g. `btnIssue.OnSelect: =Set(varOldQuantity, LookUp(colInventory, ID = varSelectedInventoryId).Quantity); ...`] |
+
+## Data Entry Label Contracts
+
+| Required input | Persistent visible label | Shared field region |
+| -------------- | ------------------------ | ------------------- |
+| [classic/modern TextInput, NumberInput, Radio, DropDown, or ComboBox] | [exact sibling label binding; native visible Label only for ModernNumberInput] | [immediate parent field row/group containing both] |
+
+[Include every data-entry control consumed by an accepted action. AccessibleLabel and
+HintText do not replace a persistent visible field name. Modern variants and optional
+versions are in scope.]
+
+## Layout Budget Contracts
+
+| Screen / container | Branch / screen-width source | Horizontal total-width arithmetic | Vertical height arithmetic | Protected controls |
+| ------------------ | ---------------------------- | ----------------------------------- | -------------------------- | ------------------ |
+| [screen / container] | [prefer local/root width; if `App.Width` is used, include the narrowest supported local/root rendered width; list every reachable cross-branch pair if scopes differ] | [total available local/root width versus padding + child fixed/min widths + gaps, or N/A] | [Height versus child fixed/min heights + gaps + padding, or N/A] | [amount, Save/Apply, receipt operation/old/amount/expected/actual] |
+
+[Include every nested AutoLayout container participating in a coordinated breakpoint,
+every horizontal AutoLayout branch, and every fixed-height vertical AutoLayout branch.
+Repeat the same container in separate rows for each axis/branch when necessary. Logical
+canvas/root width may remain at design width in a scale-to-fit host, so the wide/default
+field and action composition must fit a static bound, wrap, deliberately scroll, or stack
+without relying on narrow-branch activation.]
## Working Directory
+
[absolute working directory]
## Discovery Summary
+
- Controls: [relevant controls]
- Data sources: [used sources or none]
- Connectors: [used connectors or none]
## Dispatch
-| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
-|--------|--------|-------------|----------|-------------|--------------|
-| Create | [Landing] | `[working directory]/Screen1.pa.yaml` | Screen1 | [Prefix] | `[working directory]/Screen1.screen-plan.md` |
-| Create | [Additional] | `[working directory]/[Name].pa.yaml` | [Name] | [Prefix] | `[working directory]/[Name].screen-plan.md` |
+
+| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
+| ------ | ------------ | ---------------------- | -------- | ----------- | ----------------------------- |
+| Create | [Landing] | `[working directory]/Screen1.pa.yaml` | Screen1 | [Prefix] | `[working directory]/Screen1.screen-plan.md` |
+| Create | [Additional] | `[working directory]/[Name].pa.yaml` | [Name] | [Prefix] | `[working directory]/[Name].screen-plan.md` |
## Editor State Changes
+
[Exact final ScreensOrder and ComponentDefinitionsOrder lists, or "None"]
```
@@ -82,56 +262,139 @@ Evidence surface; do not use appearance, navigation, or notification as proof.]
# Canvas App Plan
## Mode
+
EDIT
## Requirements
+
[Original edit requirements]
## Requirement Coverage
-| Requirement | Planned affordance | Fidelity |
-|-------------|--------------------|----------|
+
+| Requirement | Planned affordance | Fidelity |
+| ----------------------------------------------- | ------------------------------------ | ------------------------------- |
| [Concrete noun or interaction from the request] | [Visible control and exact behavior] | Exact / Approximation: [reason] |
+## Required Record Fields
+
+| Field key | Screen | Record surface | Required field | Source field | Presentation requirement |
+| -------------------------------- | -------- | -------------- | -------------- | ------------ | ----------------------------------------- |
+| [screen/surface/field identifier] | [Screen] | [Card/row/detail] | [Visible meaning] | [Record field] | [Full text, combined format, label, etc.] |
+
+[Include every requested record field affected by the edit and every existing field whose
+surface, source, formula, visibility, or layout is touched. Preserve unaffected required
+fields on a modified surface. Omit this section only when the edit cannot affect a record
+list, card, row, or detail surface.]
+
+## State-Driven Surface Visibility
+
+| Surface key | Owner screen | Surface control | State predicate | Visible and hidden states |
+| ----------- | ------------ | --------------- | --------------- | ------------------------- |
+| [stable surface identifier] | [Screen] | [Container/card/panel control] | [Exact `=state predicate`] | [State where the surface appears; state where it is hidden] |
+
+[Include changed plan-declared whole-surface state gating only. Omit always-visible
+surfaces, navigation-based disclosure, child-only visibility, and visibility that the
+plan does not declare. Preserve an existing exact
+`Surface.Visible=state predicate` Action Contract observer as an equivalent compact
+declaration rather than requiring a duplicate row.]
+
## Action Contracts
-| Requested action | Preconditions | Entry point | Owner screen | Control and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
-|------------------|---------------|-------------|--------------|-------------------|----------------------|------------------------------|--------------------|-------------------|-----------------------|
-| [Concrete requested action] | [Eligible state and enabled/visible rule] | [Visible control the user starts from] | [Screen] | [PrefixedControl.OnSelect / OnChange] | [Named source and immutable identity, or N/A] | [Exact operation and resulting source state] | [Every changed field/status, or N/A] | [Identity plus every value rendered after success, or N/A] | [Formula/control reading the post-state plus in-viewport evidence] |
+
+| Requested action | Preconditions | Entry point | Owner screen | Control and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
+| --------------------------- | ----------------------------------------- | -------------------------------------- | ------------ | ------------------------------------- | --------------------------------------------- | -------------------------------------------- | ------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------------ |
+| [Concrete requested action] | [Eligible state and enabled/visible rule] | [Visible control the user starts from] | [Screen] | [PrefixedControl.OnSelect / OnChange] | [Named source and immutable identity, or N/A] | [Exact operation and resulting source state] | [Every changed field/status, or N/A] | [Identity plus every value rendered after success, or N/A] | [Formula/control reading the post-state plus in-viewport evidence] |
[Include only actions stated by the request or approved plan. Preserve unaffected existing
actions, and do not expand the edit into universal CRUD. Preserve the semantic contracts
for role-scoped primary-record management, paired review decisions, requested periods or
-cycles, and requested export/report output.]
+cycles, and requested export/report output. Preserve or add separate Action Contract rows
+for opposing transitions. A shared form does not merge Receive/Issue, Increase/Decrease,
+Credit/Debit, Allocate/Release, Check-in/Check-out, or Enable/Disable into one contract.]
+
+## Mutation Lifecycle Evidence
+
+| Action | Receipt binding | Canonical source and observer | Requested destination and observer | Stable ID continuity | Synchronization when sources differ | Destination focus |
+| ------ | --------------- | ----------------------------- | ---------------------------------- | -------------------- | ----------------------------------- | ----------------- |
+| [Changed or affected mutation] | [Returned record/ID or deletion snapshot plus receipt control] | [Authoritative source and exact post-state observer] | [Requested destination and exact observer] | [Same immutable ID throughout] | [Exact success-path synchronization, or N/A — same live source] | [Exact focus-by-ID behavior, or N/A] |
+
+[Include every changed mutation and every existing mutation whose source, destination,
+identity, synchronization, focus, or evidence is affected. Apply the mutation lifecycle contract from
+`${PLUGIN_ROOT}/references/BehaviorGuide.md`; preserve unaffected rows.]
+
+## Mutation Field Ledger
+
+| Action | Field | Classification | Canonical pre-state or input | Write or preservation mechanism | Receipt/proof binding | Post-state observer |
+| ------ | ----- | -------------- | ---------------------------- | ------------------------------- | --------------------- | ------------------- |
+| [Changed or affected mutation] | [Field/status] | Changed / Preserved | [Live input/transition expression, or canonical pre-state lookup] | [Exact write or preservation behavior] | [Changed-field receipt or preserved-field evidence] | [Exact observer for the same ID and field] |
+
+[Include changed fields and preserved user-visible or lifecycle-significant fields for
+each affected mutation. Changed rows retain write-set/proof-set parity. Preserved rows
+must identify canonical carry-forward or omission from a partial update and post-state
+evidence; preserve unaffected ledger rows.]
+
+## Continuation Contracts
+
+[Include only when this edit adds, changes, or can break a create-to-later-mutation
+continuation. Otherwise omit it.]
+
+| Create action | Returned stable-ID binding | Downstream action and event | Downstream target binding | Successful-completion clear | Cancellation clear |
+| ------------- | -------------------------- | --------------------------- | ------------------------- | ---------------------------- | ------------------ |
+| [Create Action Contract] | [Exact captured returned ID] | [Later edit/delete/relationship/approval/transition event] | [Exact target lookup using that ID] | [Exact success clear] | [Exact non-mutating cancel clear] |
## Functional Test Matrix
-| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
-|----------|-------|------|------|------------------|---------------------------|
+
+| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
+| ---------------------------- | ------------------------- | --------------------------- | ------------------------------------------ | ------------------------------------- | -------------------------------------------- |
| [Changed or regression path] | [Current or seeded state] | [Exact visible interaction] | [Exact preserved or changed postcondition] | [Observer/control reading the source] | [Required failure/boundary behavior, or N/A] |
[Cover every changed Action Contract and every existing action whose source, fields,
-controls, or observer are touched by this edit. This is the regression contract.]
+controls, or observer are touched by this edit. This is the regression contract. When an
+opposing pair is affected, include one concrete scenario per direction and verify explicit
+before/amount/after semantics. When a Continuation Contract is affected, include
+returned-ID-bound downstream completion and non-mutating cancellation/clear scenarios.]
+
+## Data Entry Label Contracts
+
+| Required input | Persistent visible label | Shared field region |
+| -------------- | ------------------------ | ------------------- |
+| [changed/affected classic or modern data-entry control] | [exact sibling label binding; native visible Label only for ModernNumberInput] | [immediate parent field row/group] |
+
+## Layout Budget Contracts
+
+| Screen / container | Branch / screen-width source | Horizontal total-width arithmetic | Vertical height arithmetic | Protected controls |
+| ------------------ | ---------------------------- | ----------------------------------- | -------------------------- | ------------------ |
+| [changed container] | [local/root source and narrowest supported rendered width, or all cross-branch pairs] | [total available local width versus padding + children + gaps, or N/A] | [available Height versus children + gaps + padding, or N/A] | [amount, Save/Apply, complete receipt, or N/A] |
## Working Directory
+
[absolute working directory]
## Discovery Summary
+
- Existing screens: [names]
- Layout: [ManualLayout / AutoLayout / mixed]
- Data sources: [used sources or none]
## Dispatch
-| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
-|--------|--------|-------------|----------|-------------|--------------|
-| Modify | [Existing] | `[working directory]/[File].pa.yaml` | [existing key] | [Prefix] | `[working directory]/[File].screen-plan.md` |
-| Create | [New] | `[working directory]/[File].pa.yaml` | [new key] | [Prefix] | `[working directory]/[File].screen-plan.md` |
+
+| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
+| ------ | ---------- | --------------------- | -------------- | ----------- | ---------------------------- |
+| Modify | [Existing] | `[working directory]/[File].pa.yaml` | [existing key] | [Prefix] | `[working directory]/[File].screen-plan.md` |
+| Create | [New] | `[working directory]/[File].pa.yaml` | [new key] | [Prefix] | `[working directory]/[File].screen-plan.md` |
## App Changes
+
### Before builders
+
[Shared definitions screens bind to — collections, named formulas, app variables, OnStart
seed data — or "None"]
+
### After builders
+
[Changes referencing screens that do not exist yet, such as StartScreen — or "None"]
## Editor State Changes
+
[Exact final ScreensOrder and ComponentDefinitionsOrder lists, or "None"]
```
@@ -141,6 +404,7 @@ seed data — or "None"]
# Canvas App Shared Plan
## Aesthetic Direction
+
- Palette: [description]
- Primary background: RGBA([...])
- Accent: RGBA([...])
@@ -149,6 +413,7 @@ seed data — or "None"]
- Typography: [scale and weights]
## Visual Contract
+
- Type roles: [exact title, section-heading, body, caption sizes and weights]
- Spacing scale: [approved gap and padding values]
- Surfaces: [page, panel, card, border, and shadow treatment]
@@ -156,24 +421,31 @@ seed data — or "None"]
- Density: [desktop, tablet, and phone composition rules]
## Layout Strategy
-[Shared layout rules and target-device rationale. Record the breakpoint formulas and the
-rule that responsive properties derive from current width rather than `OnVisible`
-variables.]
+
+[Shared layout rules and target-device rationale. Record the breakpoint formulas, the
+narrowest supported local/root rendered width, and the rule that responsive properties
+derive from current width rather than `OnVisible` variables. Do not equate `App.Width`
+with an embedded or letterboxed viewport.]
+
## Named State
+
[Variables, named formulas, collections, and ownership]
## Control Naming
+
[Standard control-type abbreviations followed by the per-screen namespace, such as
`conDiscNavBar` and `btnDetailBack`, plus the rule that repeated UI blocks are
instantiated under each screen's own namespace]
## Cross-Screen Contracts
+
[Navigation targets and shared state expectations. For repeated navigation blocks, list
the exact items in order and prohibit extra screen-specific children. Use ModernButtons
for cross-screen navigation; reserve ModernTabList for panels within one screen.]
## YAML Conventions
+
- Formula prefix
- Multi-line formula syntax
- String and record-literal quoting
@@ -187,12 +459,14 @@ for cross-screen navigation; reserve ModernTabList for panels within one screen.
# Screen Plan: [Logical Screen]
## Assignment
+
- Action: Create
- Target file: `[working directory]/[File].pa.yaml`
- YAML key: [key]
- Control name prefix: [Prefix]
## Specification
+
- Purpose: [description]
- Layout: [root and child structure. For each fixed-height section and horizontal row
with four or more substantive children, include a desktop/narrow/phone budget with
@@ -206,6 +480,13 @@ for cross-screen navigation; reserve ModernTabList for panels within one screen.
Avatar initials do not satisfy identity. When review requires both Approve and
Reject/Decline, keep both decisions on the same eligible row or same immediately reachable
detail; do not drop one to fit the layout.]
+- Breakpoint source: [one screen-level width expression used by coordinated parent Height,
+ nested child LayoutDirection, and related formulas; if sources differ, enumerate every
+ reachable cross-branch combination]
+- Numeric layout budgets: [for each horizontal branch: total available width versus
+ padding + child fixed/`LayoutMinWidth` sum + gaps; for each fixed-height vertical branch:
+ child fixed/minimum heights plus gaps and padding versus Height. Include amount inputs,
+ Save/primary actions, and the complete labeled receipt.]
- Text fit: [single-line or wrapping behavior and longest-value width/height budget for
each text-bearing control]
- Visual hierarchy: [title, section, body, caption, primary action, and focal content
@@ -227,9 +508,32 @@ for cross-screen navigation; reserve ModernTabList for panels within one screen.
- Navigation: [targets and triggers]
- State: [OnVisible initialization]
+## Required Record Fields
+
+| Field key | Record surface | Required field | Source field | Bound control | Exact formula | Placement and visibility |
+| --------------------------------- | -------------- | -------------- | ------------ | ------------- | ------------- | ------------------------ |
+| [key copied from the plan index] | [Card/row/detail] | [Visible meaning] | [Record field] | [Prefixed control] | [Exact binding] | [Hierarchy, sizing, normal-state visibility] |
+
+[Copy every Required Record Fields row owned by this screen. Each row names a concrete
+visible control inside the record surface, its exact formula, and enough layout detail to
+prove that the value is visible in the normal state. A combined control may satisfy
+multiple rows only when its formula references every named source field. Do not replace
+requested text with an icon, tooltip, accessible label, record ID, or time-only summary.]
+
+## State-Driven Surface Visibility
+
+[Copy every plan row owned by this screen. Implement the named surface control's own
+`Visible` property with the exact planned predicate or a provably equivalent Boolean
+form. Do not substitute child visibility or navigation.]
+
+| Surface key | Surface control | State predicate | Visible and hidden states |
+| ----------- | --------------- | --------------- | ------------------------- |
+| [key copied from plan] | [Prefixed surface control] | [Exact `=state predicate`] | [Both states] |
+
## Required Actions
-| Action | Preconditions | Entry point and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
-|--------|---------------|-----------------------|----------------------|------------------------------|--------------------|-------------------|-----------------------|
+
+| Action | Preconditions | Entry point and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
+| ----------------------------------- | ---------------- | ------------------------------------------------------- | --------------------------------------------- | --------------------------------------------- | ------------------------------------ | ------------------------------------------------- | -------------------------------------------------------- |
| [Action copied from the plan index] | [Eligible state] | [Visible entry and PrefixedControl.OnSelect / OnChange] | [Named source and immutable identity, or N/A] | [Exact formula operation and resulting state] | [Every changed field/status, or N/A] | [Identity plus every labeled bound value, or N/A] | [Formula/control reading the source plus visible result] |
[Copy every Action Contract owned by this screen. Include the exact input, binding, event,
@@ -241,25 +545,60 @@ parity from the Action Contract. Expand every success, boundary, rejection, pers
and recalculation path assigned by the plan. Keep paired review decisions as separate rows
but require both controls on the same eligible record surface.]
+## Data Entry Label Contracts
+
+| Required input | Persistent visible label | Shared field region |
+| -------------- | ------------------------ | ------------------- |
+| [input owned by this screen] | [exact sibling label binding; native visible Label only for ModernNumberInput] | [immediate parent field row/group containing both] |
+
+[Copy every plan-index Data Entry Label Contract owned by this screen. Name the exact
+input, label control and binding, and their shared immediate parent so the builder can
+implement the contract without reading the plan index.]
+
+## Mutation Lifecycle Evidence
+
+[Copy every mutation lifecycle row owned or observed by this screen from the plan index, including the
+receipt, canonical observer, requested destination observer, same-ID trace,
+synchronization step when sources differ, and destination focus.]
+
+## Mutation Field Ledger
+
+[Copy every mutation field-ledger row owned by this screen. Keep each Changed field aligned
+with the Required Action write set, proof set, receipt binding, and observer. Implement
+each Preserved row from canonical pre-state and retain its post-state evidence.]
+
+## Continuation Contracts
+
+[Copy this section only when the screen creates a record for a later
+edit/delete/relationship/approval/transition or owns that later action. Bind the
+continuation to the returned stable ID and implement both successful-completion and
+cancellation clearing.]
+
## Functional Test Scenarios
-| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
-|----------|-------|------|------|------------------|---------------------------|
+
+| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
+| ------------------------------------- | ---------------- | ------------------------- | ---------------------- | ------------------------------------------ | ------------------------------------ |
| [Scenario copied from the plan index] | [Concrete state] | [Exact local interaction] | [Source postcondition] | [Local or downstream observer and receipt] | [Required boundary behavior, or N/A] |
[Copy every Functional Test Matrix row exercised by this screen. The builder must be able
to trace each row through concrete formulas without reading another brief.]
+
## Relevant Data Source Schemas
+
[Only the fields this screen reads or writes; omit if none]
## Relevant API Details
+
[Only the operations and parameters this screen calls; omit if none]
## Required Variants
+
[Control type -> exact variant to use, for every control type whose definition includes a
Variants section; omit if none]
## Control Definitions
+
[For each control type used on this screen: the complete list of valid input property
names, plus the full enum name for each enum property this screen sets. Not the whole
describe_control response.
@@ -276,37 +615,70 @@ then fails to compile.]
# Screen Plan: [Logical Screen]
## Assignment
+
- Action: Modify
- Target file: `[working directory]/[File].pa.yaml`
- YAML key: [existing key]
- Control name prefix: [Prefix]
## Current State
+
[Concise summary of relevant existing controls and layout]
## Changes
+
1. [Exact required change]
## Layout and Visual Impact
+
- Responsive bounds: [desktop, tablet, and phone width/height budgets for changed regions]
+- Breakpoint source: [one screen-level width expression for coordinated nested branches,
+ or every reachable cross-branch combination]
+- Numeric layout budgets: [total horizontal width versus padding + children + gaps; vertical
+ Height versus children + gaps + padding; include amount, Save/primary action, and all
+ receipt fields]
- Text fit: [longest-value budget for changed text-bearing controls]
- Visual contract: [shared type, spacing, surface, and action roles that changed controls
must preserve]
- Record presentation: [canonical identity field and full visible text binding; placement
of paired review decisions on each eligible record, or N/A]
+## Required Record Fields
+
+| Field key | Record surface | Required field | Source field | Bound control | Exact formula | Placement and visibility |
+| --------------------------------- | -------------- | -------------- | ------------ | ------------- | ------------- | ------------------------ |
+| [key copied from the plan index] | [Card/row/detail] | [Visible meaning] | [Record field] | [Control] | [Exact binding] | [Hierarchy, sizing, normal-state visibility] |
+
+[Copy every affected Required Record Fields row and every preserved row on a record
+surface whose source, formula, visibility, hierarchy, or layout changes. Do not allow a
+modified card or row to retain only one secondary value while required identity or detail
+fields disappear.]
+
## Controls to Add
+
[Name, type, placement, properties; or "None"]
## Controls to Remove
+
[Names; or "None"]
## Properties to Update
+
[Control -> property -> exact value; or "None"]
+## State-Driven Surface Visibility
+
+[Copy every changed or affected plan row owned by this screen. Preserve whole-surface
+gating on the named control; child visibility and navigation are not substitutes.]
+
+| Surface key | Surface control | State predicate | Visible and hidden states |
+| ----------- | --------------- | --------------- | ------------------------- |
+| [key copied from plan] | [Surface control] | [Exact `=state predicate`] | [Both states] |
+
## Required Actions
-| Action | Preconditions | Entry point and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
-|--------|---------------|-----------------------|----------------------|------------------------------|--------------------|-------------------|-----------------------|
+
+| Action | Preconditions | Entry point and event | Source and stable ID | Transition and postcondition | Mutation write set | Receipt proof set | Observer and evidence |
+| ----------------------------------- | ---------------- | ----------------------------------------------- | --------------------------------------------- | --------------------------------------------- | ------------------------------------ | ------------------------------------------------- | -------------------------------------------------------- |
| [Action copied from the plan index] | [Eligible state] | [Visible entry and Control.OnSelect / OnChange] | [Named source and immutable identity, or N/A] | [Exact formula operation and resulting state] | [Every changed field/status, or N/A] | [Identity plus every labeled bound value, or N/A] | [Formula/control reading the source plus visible result] |
[Copy every affected Action Contract and preserve unaffected behavior. Include the target
@@ -317,25 +689,57 @@ prepopulation, save-by-ID, reset, cancel behavior, and the exact reveal receipt.
control, visibility state, and one labeled binding per proof-set field. Keep changed
success, boundary, rejection, persistence, and recalculation paths separate.]
+## Data Entry Label Contracts
+
+| Required input | Persistent visible label | Shared field region |
+| -------------- | ------------------------ | ------------------- |
+| [changed or affected input] | [exact sibling label binding; native visible Label only for ModernNumberInput] | [immediate parent field row/group containing both] |
+
+[Copy every changed or affected plan-index Data Entry Label Contract owned by this screen.
+Preserve the exact input/label binding and shared immediate parent.]
+
+## Mutation Lifecycle Evidence
+
+[Copy every changed or affected mutation lifecycle row for this screen. Preserve the receipt, canonical
+source, requested destination, same stable ID, synchronization/focus behavior, and exact
+observer formulas.]
+
+## Mutation Field Ledger
+
+[Copy every changed or affected mutation field-ledger row. Changed fields must retain write/proof parity;
+preserved fields must keep canonical pre-state sourcing and post-state evidence.]
+
+## Continuation Contracts
+
+[Include only when this screen participates in an affected create-to-later
+edit/delete/relationship/approval/transition continuation. Preserve the returned-ID target
+and clear continuation identity/mode on downstream completion or cancellation.]
+
## Functional Test Scenarios
-| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
-|----------|-------|------|------|------------------|---------------------------|
+
+| Scenario | Given | When | Then | Evidence surface | Boundary or negative case |
+| ----------------------------------------------------------- | ---------------- | ------------------------- | ---------------------- | ------------------------------------- | ------------------------------------ |
| [Changed or regression scenario copied from the plan index] | [Concrete state] | [Exact local interaction] | [Source postcondition] | [Observer/control reading the source] | [Required boundary behavior, or N/A] |
[Copy every affected scenario, including preservation checks for behavior sharing a
changed source, field, control, or observer.]
+
## Relevant Data Source Schemas
+
[Only the fields this edit reads or writes; omit if none]
## Relevant API Details
+
[Only the operations this edit calls; omit if none]
## Required Variants
+
[Control type -> exact variant, for any control this edit adds whose definition includes a
Variants section; omit if none]
## Changed or Added Control Definitions
+
[For each control type receiving a new property, enum, or variant — including types
already present in the app: valid input property names, plus the full enum name and
compile-ready literal for each enum property this edit sets. Write
diff --git a/plugins/canvas-apps/references/QAChecks.md b/plugins/canvas-apps/references/QAChecks.md
index baa9509d0..e17ca97e8 100644
--- a/plugins/canvas-apps/references/QAChecks.md
+++ b/plugins/canvas-apps/references/QAChecks.md
@@ -33,6 +33,7 @@ are not part of the identifier.
- Check 9 — `QACHK-SCROLL-TRAP` — `FillPortions: =1` inside a scroll container
- Check 10 — `QACHK-WRAP-MISSING` — single-line label without `Wrap: =false`
- Check 11 — `QACHK-NO-HEIGHT-TRAP` — `FillPortions: =0` without an explicit `Height`
+ or fixed-height vertical content exceeds its numeric height budget
- Check 12 — `QACHK-TEXT-PADDING` — `ModernText` / `Label` padding defaults to 5
- Check 13 — `QACHK-FILLPORTIONS-HEIGHT-CONFLICT` — `FillPortions` and `Height` both set
- Check 14 — `QACHK-FILLPORTIONS-WIDTH-CONFLICT` — `FillPortions` and `Width` both set
@@ -55,13 +56,15 @@ are not part of the identifier.
container
- Check 28 — `QACHK-TIMER-LIFECYCLE` — timer has no automatic start/reset edge
- Check 29 — `QACHK-READ-ONLY-ANCESTOR` — interactive control under a read-only ancestor
-- Check 30 — `QACHK-HIDDEN-BOUNDED-LIST` — small bounded gallery hidden in nested scrolling
+- Check 30 — `QACHK-HIDDEN-BOUNDED-LIST` — Gallery viewport is circular,
+ non-deterministic, or hidden in nested scrolling
- Check 31 — `QACHK-SEMANTIC-VALUE-BINDING` — semantic display control missing its visible
value binding
- Check 32 — `QACHK-ACTION-LABEL-FIT` — multiword action label does not fit its control
-- Check 33 — `QACHK-ACTION-CONTRACT` — required action or navigation is missing,
- unreachable, or not wired
-- Check 34 — `QACHK-MUTATION-OUTCOME` — data changes without a visible post-action result
+- Check 33 — `QACHK-ACTION-CONTRACT` — required action, record field, or declared
+ state-driven surface is missing, unreachable, or not wired
+- Check 34 — `QACHK-MUTATION-OUTCOME` — data changes without a visible post-action result,
+ or a dead staging variable feeds the mutation (staging-variable liveness)
- Check 35 — `QACHK-BEHAVIOR-ACCEPTANCE` — advanced behavior omits a required acceptance path
- Check 36 — `QACHK-HORIZONTAL-BUDGET` — row content exceeds its available width
- Check 37 — `QACHK-MANUAL-BOUNDS` — visible ManualLayout controls overlap or leave the parent
@@ -69,10 +72,16 @@ are not part of the identifier.
- Check 39 — `QACHK-VISUAL-CONTRACT` — screen styling diverges from the shared visual system
- Check 40 — `QACHK-EXCESS-WHITESPACE` — layout sizing creates unintended empty regions
- Check 41 — `QACHK-CORE-VISUALIZATION` — core visualization is blank, static, or incomplete
+- Check 42 — `QACHK-PRIMARY-ACTION-REACHABILITY` — required action is clipped, covered,
+ undersized, or unavailable from the initial task path
+- Check 43 — `QACHK-LIFECYCLE-IDENTITY` — edit, delete, or review targets an unstable or
+ incorrect record identity, or a phantom LookUp key locates no row (LookUp key integrity)
+- Check 44 — `QACHK-SHARED-SOURCE-DERIVATION` — filters, ordering, alerts, metrics, or
+ reports read a different source from mutations
Agents that write `.pa.yaml` files MUST run these checks against their own
-output before returning, and fix every issue inline. Report the outcome of
-**every** check by number in the result summary, as described below.
+output before returning, and fix every issue inline. Report complete coverage plus only
+repairs and non-applicable checks, as described below.
---
@@ -80,32 +89,32 @@ output before returning, and fix every issue inline. Report the outcome of
1. Read the `.pa.yaml` file you just wrote
2. Apply the checks in order. Checks 1-5 come first because each one invalidates the
- whole file or the whole compile, and the flood of misleading diagnostics that follows
- hides every other problem
-3. For every issue found: apply the fix directly using `Edit`
-4. Record an outcome for **every** check, by number — not a total
+whole file or the whole compile, and the flood of misleading diagnostics that follows
+hides every other problem
+3. For every issue found: apply the fix directly using `apply_patch`
+4. Record complete coverage, every repair, and every non-applicable check
5. Do NOT re-run `compile_canvas` here — the orchestrator does that
All checks are safe: they tighten existing YAML, never delete semantic content.
### Reporting
-A count of fixes is not evidence that a check ran. Report one line per check, using
-exactly these outcomes:
+A long row of self-asserted `PASS` values is not evidence that a check ran. Use this
+compact, machine-scannable form:
```text
-QA: 1 PASS · 2 PASS · 3 PASS · 4 FIXED(7) · 5 PASS · 6 FIXED(2) · 7 FIXED(30) ·
- 8 PASS · 9 PASS · 10 PASS · 11 PASS · 12 PASS · 13 PASS · 14 PASS · 15 PASS ·
- 16 PASS · 17 PASS · 18 FIXED(4) · 19 PASS · 20 PASS · 21 PASS · 22 FIXED(3) ·
- 23 FIXED(4) · 24 PASS · 25 N/A · 26 N/A · 27 PASS · 28 N/A · 29 PASS ·
- 30 N/A · 31 PASS · 32 PASS · 33 PASS · 34 PASS · 35 PASS · 36 PASS ·
- 37 N/A · 38 PASS · 39 PASS · 40 PASS · 41 PASS
+QA coverage: 1-44 COMPLETE
+QA repairs: QACHK-MISSING-FORMULA-PREFIX FIXED(7) · QACHK-CONTAINER-MIN-SIZE FIXED(2)
+QA N/A: QACHK-GRID-CONTRACT · QACHK-TIMER-LIFECYCLE · QACHK-MANUAL-BOUNDS
```
-- `PASS` — you inspected every control the check applies to and found nothing.
-- `FIXED(n)` — you found and repaired `n` occurrences.
-- `N/A` — the construct the check targets does not appear on this screen (no gallery, no
- `ModernCard`). Use this honestly; it is not a synonym for "did not check".
+- `COMPLETE` means the persisted file was inspected against every check.
+- `FIXED(n)` names each check that caused a repair and its occurrence count.
+- `N/A` names each check whose construct does not appear on the screen. It is not a
+ synonym for "did not check".
+- Do not emit the legacy numbered `QA: 1 PASS` checklist.
+- `1-44 COMPLETE` is invalid if the loaded guide does not define checks 42, 43, and 44.
+Report `Status: Provenance Blocked` instead of fabricating outcomes for missing checks.
`QACHK-CROSS-AXIS-ALIGNMENT`, `QACHK-ACCESSIBLE-LABEL-MISSING` and
`QACHK-LOW-CONTRAST-TEXT` apply frequently, but their outcomes still depend on the file:
@@ -122,6 +131,8 @@ QA: 1 PASS · 2 PASS · 3 PASS · 4 FIXED(7) · 5 PASS · 6 FIXED(2) · 7 FIXED(
by Check 35.
- `QACHK-HORIZONTAL-BUDGET` is `N/A` when the changed scope has no horizontal AutoLayout
container.
+- `QACHK-NO-HEIGHT-TRAP` requires numeric vertical-budget evidence for every fixed-height
+ vertical AutoLayout container; the presence of `Height` alone is not a PASS.
- `QACHK-MANUAL-BOUNDS` is `N/A` when the changed scope has no ManualLayout container.
- `QACHK-TEXT-CONTENT-FIT` is `N/A` only when the changed scope has no visible text.
- `QACHK-VISUAL-CONTRACT` applies to every created screen and every visually changed
@@ -130,9 +141,20 @@ QA: 1 PASS · 2 PASS · 3 PASS · 4 FIXED(7) · 5 PASS · 6 FIXED(2) · 7 FIXED(
spacing, or visibility.
- `QACHK-CORE-VISUALIZATION` is `N/A` only when the screen brief names no hierarchy,
chart, comparison, board, timeline, map, or other core visualization.
+- `QACHK-PRIMARY-ACTION-REACHABILITY` applies to every screen owning a Required Actions
+ entry point.
+- `QACHK-LIFECYCLE-IDENTITY` is `N/A` only when the screen owns no edit, delete/remove,
+ cancel, approve, reject, or other selected-record mutation.
+- `QACHK-SHARED-SOURCE-DERIVATION` is `N/A` only when the screen owns no mutation,
+ search, filter, ordering, alert, KPI, dashboard, visualization, or report binding.
`PASS` is valid when every applicable control was inspected and no defect was found.
Never infer that a check was skipped solely from the number of controls on the screen.
+For `QACHK-NO-HEIGHT-TRAP`, `QACHK-GALLERY-ROW-FITS-CONTENT`,
+`QACHK-HORIZONTAL-BUDGET`, and `QACHK-PRIMARY-ACTION-REACHABILITY`, PASS also requires the
+numeric branch calculations in `QA layout evidence`; unsupported PASS text fails review.
+These calculations are static evidence. Browser execution remains necessary to prove the
+rendered controls are visible, scrollable, and pointer-reachable.
---
@@ -240,12 +262,12 @@ An enum literal has two parts and each fails differently. Check both.
fails with `Name isn't recognized`. The same property name maps to different enum types on
different controls:
-| Control | Property | Correct enum name |
-|---------|----------|-------------------|
-| `ModernDropdown` / `ModernTextInput` / `ModernNumberInput` | `Appearance` | `Appearance` |
-| `ModernButton` | `Appearance` | `ButtonAppearance` |
-| `Badge` | `Appearance` / `Shape` / `ThemeColor` | `BadgeCanvas.Appearance` / `BadgeCanvas.Shape` / `BadgeCanvas.ThemeColor` |
-| `Progress` | `Shape` / `Thickness` / `ProgressColor` | `Progress.Shape` / `Progress.Thickness` / `Progress.ProgressColor` |
+| Control | Property | Correct enum name |
+| ---------------------------------------------------------- | --------------------------------------- | ------------------------------------------------------------------------- |
+| `ModernDropdown` / `ModernTextInput` / `ModernNumberInput` | `Appearance` | `Appearance` |
+| `ModernButton` | `Appearance` | `ButtonAppearance` |
+| `Badge` | `Appearance` / `Shape` / `ThemeColor` | `BadgeCanvas.Appearance` / `BadgeCanvas.Shape` / `BadgeCanvas.ThemeColor` |
+| `Progress` | `Shape` / `Thickness` / `ProgressColor` | `Progress.Shape` / `Progress.Thickness` / `Progress.ProgressColor` |
**Detect:** For every property you set to an enum value, find that property in the control
definition in your screen brief and compare your qualifier against its `Enum name:` line.
@@ -405,7 +427,7 @@ dimension (e.g., a 28px circular avatar inside a 44px horizontal row), use
natural size and is centered.
⚠️ This check is per-control and there is no compile diagnostic behind it. A screen where
-`AlignInContainer` appears on *none* of its controls has not had this check run — say so
+`AlignInContainer` appears on _none_ of its controls has not had this check run — say so
in your report rather than claiming a clean pass.
---
@@ -490,7 +512,7 @@ comment text. These should keep the default wrapping behavior.
---
-## Check 11 — `QACHK-NO-HEIGHT-TRAP` (`FillPortions: =0` without explicit `Height`)
+## Check 11 — `QACHK-NO-HEIGHT-TRAP` (missing `Height` or vertical budget overflow)
**Problem:** When an AutoLayout child has `FillPortions: =0` (or `FillPortions`
is absent, which defaults to 0) and no explicit `Height`, Power Apps defaults
@@ -499,6 +521,7 @@ inexplicable gaps or clipping.
**Detect:** For every `GroupContainer` whose parent has `LayoutDirection`
(AutoLayout child), check:
+
- Is the parent's `LayoutDirection` **Vertical**? This check applies to the parent's main
axis only. In a horizontal parent, `FillPortions` governs width, so apply the same test
to `Width` instead of `Height`.
@@ -536,7 +559,10 @@ After confirming a fixed size exists, verify that it fits. For every fixed-heigh
vertical section, evaluate each responsive branch and sum direct child heights, nested
minimum content heights, gaps and padding. Include wrapped or `AutoHeight` text at its
expected narrow-width line count. Flag any branch where the section height is smaller
-than that budget. Do not mark this check `PASS` merely because `Height` is present.
+than that budget. Protect Save and every required action from falling below the available
+height. For a directional mutation receipt, include the labeled operation, old, amount,
+expected, and actual fields together in the sum; a container that fits only a receipt
+heading fails. Do not mark this check `PASS` merely because `Height` is present.
Avoid parent-height formulas that depend on descendant control `.Height` values when
those descendants also size from their parent. Use collection counts and literal content
@@ -595,6 +621,7 @@ padding and gaps.
The container renders one size at design time and another at runtime.
**Detect:** For every control, check whether it has both:
+
- `FillPortions` with a value greater than 0, AND
- An explicit `Height` (any non-formula numeric or a formula that doesn't
reference Parent)
@@ -612,6 +639,7 @@ confuses the layout engine. The container renders one size at design time and
another at runtime.
**Detect:** For every control, check whether it has both:
+
- `FillPortions` with a value greater than 0, AND
- An explicit `Width` (any non-formula numeric or a formula that doesn't
reference Parent)
@@ -737,6 +765,20 @@ AccessibleLabel: ="Quantity on hand for " & ThisItem.Name
**Exception:** Purely decorative controls — spacer containers, background rectangles,
divider lines. Do not label those.
+Accessibility naming is separate from visible field labeling. For every required classic
+or modern TextInput, NumberInput, Radio, DropDown, and ComboBox—including
+`ModernTextInput`, `ModernNumberInput`, `ModernRadio`, `ModernDropdown`, and
+`ModernCombobox`—also require a persistent human-readable visible label under the same
+immediate field-region parent. `AccessibleLabel` and `HintText` alone fail this usability
+contract. Static acceptance recognizes a native visible `Label` only for
+`ModernNumberInput`; every other type needs a sibling Text/Label control.
+
+A validated plan-declared state-driven surface may conditionally gate both the input and
+its sibling label. That shared ancestor predicate does not make the label transient while
+the surface is visible. Still reject a label with its own false or conditional `Visible`
+formula, a label outside the input's immediate field region, a label nested under the
+input, or a conditional ancestor not declared as that shared surface.
+
---
## Check 19 — `QACHK-NO-REFLOW` (horizontal row with no narrow-width strategy)
@@ -828,7 +870,7 @@ Color: =RGBA(239, 246, 250, 1)
## Check 22 — `QACHK-VARIANT-SURFACE-CONTRAST` (light foreground on a variant-supplied surface)
-**Problem:** `QACHK-LOW-CONTRAST-TEXT` catches text that *omits* a colour. This is the
+**Problem:** `QACHK-LOW-CONTRAST-TEXT` catches text that _omits_ a colour. This is the
opposite failure: the colour is set, and it is set against a surface the control derives
from a **Fluent enum** rather than from `Fill`. The agent picks a near-white foreground
for a dark theme, the variant supplies a near-white surface, and the control renders
@@ -837,12 +879,12 @@ an empty pill.
These are the enum values that produce a **light** surface:
-| Property | Light-surface members |
-|----------|----------------------|
+| Property | Light-surface members |
+| ------------------------------ | ------------------------------------------------------------------- |
| `Appearance` on `ModernButton` | `ButtonAppearance.Secondary`, `.Outline`, `.Subtle`, `.Transparent` |
-| `Appearance` on inputs | `Appearance.Outline`, `.FilledLighter` |
-| `Appearance` on `Badge` | `'BadgeCanvas.Appearance'.Tint`, `.Ghost`, `.Outline` |
-| `ThemeColor` on `Badge` | `'BadgeCanvas.ThemeColor'.Informative`, `.Warning` |
+| `Appearance` on inputs | `Appearance.Outline`, `.FilledLighter` |
+| `Appearance` on `Badge` | `'BadgeCanvas.Appearance'.Tint`, `.Ghost`, `.Outline` |
+| `ThemeColor` on `Badge` | `'BadgeCanvas.ThemeColor'.Informative`, `.Warning` |
**Detect:** For every control that sets `Color` or `FontColor` to a light value (any
channel triple averaging above ~180), check whether its surface comes from one of the enum
@@ -879,12 +921,13 @@ never one from your palette and the other from an enum default.
---
+
## Check 23 — `QACHK-CARD-PLACEHOLDER` (`ModernCard` slot left unset)
**Problem:** `ModernCard` does not render unset slots as empty. It substitutes placeholder
content: a large stock photograph for `Image`, and the literal strings `Title`, `Subtitle`
and `Description` for the text slots. The photo takes most of the card's height, so the
-value you *did* set is pushed out of view or clipped mid-glyph. Every card on the screen
+value you _did_ set is pushed out of view or clipped mid-glyph. Every card on the screen
looks identical and none of them shows its data. `compile_canvas` reports nothing.
**Detect:** For every `Control: ModernCard`, list the slots supported by the control
@@ -896,13 +939,13 @@ that the card's layout displays but the YAML leaves unset.
```yaml
- KpiOpenCard:
- Control: ModernCard
- Properties:
- Image: =Blank()
- HeaderImage: =Blank()
- Title: =CountRows(colOpenTasks) & ""
- Subtitle: ="Open tasks"
- Description: ="Across all projects"
+ Control: ModernCard
+ Properties:
+ Image: =Blank()
+ HeaderImage: =Blank()
+ Title: =CountRows(colOpenTasks) & ""
+ Subtitle: ="Open tasks"
+ Description: ="Across all projects"
```
If the control definition includes `ImageAccessibleLabel` or
@@ -916,6 +959,7 @@ visible, use at least `Height: =180`; anything below 180 is a failure, not a com
variant. Do not force all
three text slots into a short fixed height.
+
**Exception:** None. If you chose `ModernCard`, you own all of its slots.
---
@@ -924,7 +968,7 @@ three text slots into a short fixed height.
**Problem:** `TemplateSize` fixes the row height; the template's content does not
negotiate with it. A row sized for density — `TemplateSize: =If(Self.Width < 640, 320, 132)`
-— clips whatever does not fit at the *desktop* branch, so the app looks correct on a phone
+— clips whatever does not fit at the _desktop_ branch, so the app looks correct on a phone
and loses its card titles on a laptop. It is easy to miss because the narrow branch, which
is the one usually eyeballed, is fine.
@@ -932,11 +976,23 @@ The trap is worst with a `ModernCard` row template, whose image band alone can e
row height you chose.
**Detect:** For every `Gallery`, evaluate `TemplateSize` at **each** branch of its formula.
-For each branch, add up the stacked heights of the row template's children plus their gaps
-and padding — counting nested fixed-height descendants and a `ModernCard`'s image band.
-When a vertical row contains a `FillPortions: =1` child, calculate the minimum height of
-that child's descendants and include it in the sum; do not treat it as zero. Flag any
-branch where the total exceeds `TemplateSize`.
+First resolve the breakpoint scope. Inside a gallery template, a direct row child's
+`Parent.Width` is gallery/template-scoped and can differ from the outer container width
+that the Gallery's own `TemplateSize` formula sees. Pass only when `LayoutDirection` and
+`TemplateSize` use the same deliberate breakpoint source, or after evaluating every
+reachable cross-branch pair (for example, vertical-row/desktop-template as well as
+vertical-row/phone-template).
+
+For each case, write the numeric height budget. A vertical row needs
+`top/bottom padding + sum(child minimum/fixed heights) + inter-child gaps`; a horizontal
+row needs `top/bottom padding + tallest child minimum/fixed height`, plus any height added
+by wrapping. Count nested fixed-height descendants, required identity and quantity/status
+fields, badges, action controls, and a `ModernCard` image band. When a child has
+`FillPortions: =1`, calculate the minimum height of its descendants and include it; do not
+treat it as zero. Flag any case where the total exceeds `TemplateSize`, or where a required
+field can clip even though its control exists. For example, 24px padding + three child
+heights totaling 136px + two 8px gaps needs 176px; a 132px template fails.
+Record those numbers in QA evidence; unsupported `PASS` text is not sufficient.
**Fix:** Raise the branch to fit, or reduce what the row renders at that width:
@@ -1019,22 +1075,22 @@ properties:
```yaml
Screens:
- Screen1:
- Children:
- - AppRoot:
- Control: GroupContainer
- Variant: AutoLayout
- Properties:
- Width: =Parent.Width
- Height: =Parent.Height
- LayoutMinWidth: =0
- LayoutMinHeight: =0
- LayoutDirection: =LayoutDirection.Vertical
- Children:
- - AppHeader:
- # ...
- - AppContent:
- # ...
+ Screen1:
+ Children:
+ - AppRoot:
+ Control: GroupContainer
+ Variant: AutoLayout
+ Properties:
+ Width: =Parent.Width
+ Height: =Parent.Height
+ LayoutMinWidth: =0
+ LayoutMinHeight: =0
+ LayoutDirection: =LayoutDirection.Vertical
+ Children:
+ - AppHeader:
+ # ...
+ - AppContent:
+ # ...
```
After moving the controls, re-run `QACHK-FILLPORTIONS-DEFAULT`, `QACHK-SCROLL-TRAP`,
@@ -1074,9 +1130,9 @@ new item, toggle `Reset` and restart explicitly:
```yaml
# Screen OnVisible
OnVisible: |-
- =Set(varTimerRunning, false);
- Set(varTimerReset, !varTimerReset);
- Set(varTimerRunning, true)
+ =Set(varTimerRunning, false);
+ Set(varTimerReset, !varTimerReset);
+ Set(varTimerRunning, true)
# Timer
AutoStart: =true
@@ -1111,11 +1167,11 @@ or row-action buttons.
```yaml
- EventGallery:
- Control: Gallery
- Variant: Vertical
- Properties:
- Selectable: =false
- DisplayMode: =DisplayMode.Edit
+ Control: Gallery
+ Variant: Vertical
+ Properties:
+ Selectable: =false
+ DisplayMode: =DisplayMode.Edit
```
Set `DisplayMode` only on the individual action when it genuinely needs to be disabled.
@@ -1124,20 +1180,19 @@ Set `DisplayMode` only on the individual action when it genuinely needs to be di
---
-## Check 30 — `QACHK-HIDDEN-BOUNDED-LIST` (small bounded gallery hidden in nested scrolling)
+## Check 30 — `QACHK-HIDDEN-BOUNDED-LIST` (Gallery viewport is circular, non-deterministic, or hidden)
-**Problem:** A short, known roster is placed in a fixed-height Gallery inside an already
-scrollable screen. The Gallery creates a second scroll region and silently hides rows;
-Studio may not render a visible scrollbar even when `ShowScrollbar: =true`. Users see
-four of six people and have no cue that more exist.
+**Problem:** A Gallery may compile with populated `Items` but render zero rows when its
+own height is derived from collection count and `Self.TemplateHeight`,
+`Self.TemplateSize`, or `Self.TemplatePadding`. A hidden nested scroll region can also
+make additional rows undiscoverable.
**Detect:** For every Gallery inside a root scroll container:
-1. If its Items source is a bounded local collection with roughly ten or fewer rows,
- compare `Height` with the count of the same source/filter used by `Items`, multiplied
- by `TemplateHeight` with template padding included.
-2. Flag it when the fixed height is smaller than the full list, regardless of
- `ShowScrollbar`.
+1. Require a conservative viewport-bounded numeric `Height`, explicit positive
+ `TemplateSize`, numeric `TemplatePadding`, a nonempty `Items` formula, and row controls.
+2. Flag `Height` formulas combining `CountRows(...)` with `Self.TemplateHeight`,
+ `Self.TemplateSize`, or `Self.TemplatePadding`.
3. Flag a list that can open at a non-zero internal scroll position without an explicit
reset-to-top behavior.
4. Flag `Height` or empty-state `Visible` formulas that read `Self.AllItems`,
@@ -1145,19 +1200,22 @@ four of six people and have no cue that more exist.
on materialized rows; when height begins at zero, the formula can keep the gallery at
zero height even though its `Items` source contains records.
-**Fix:** Let small bounded lists grow and rely on the root scroll:
+**Fix:** Use a deterministic Gallery viewport:
```yaml
-Height: =With({rowCount: CountRows(<same source/filter used by Items>)}, rowCount * Self.TemplateHeight + ((rowCount + 1) * Self.TemplatePadding))
-ShowScrollbar: =false
+Height: =320
+TemplateSize: =64
+TemplatePadding: =8
+ShowScrollbar: =true
```
-Drive the empty-state control from that same source/filter count. For genuinely large or
-unbounded data, keep the internal scroll region but provide a visible affordance and reset
-it to the first row on screen entry.
+Drive empty-state visibility from the source/filter count. When row selection is the only
+path that assigns a required selected ID, the Gallery must satisfy this contract; a
+non-gallery selector event is the alternative.
-**Exception:** Large/unbounded datasets where virtualization and internal scrolling are
-intentional and visibly discoverable.
+**Exception:** Large or unbounded datasets may intentionally use virtualization and
+internal scrolling, but they still require the deterministic viewport, concrete row
+contract, and visible scroll affordance above.
---
@@ -1182,10 +1240,10 @@ An `AccessibleLabel` is not the visible value binding.
```yaml
- StatusBadge:
- Control: Badge
- Properties:
- Content: =ThisItem.Status
- AccessibleLabel: ="Assignment status " & ThisItem.Status
+ Control: Badge
+ Properties:
+ Content: =ThisItem.Status
+ AccessibleLabel: ="Assignment status " & ThisItem.Status
```
**Exception:** A purely decorative semantic control explicitly intended to have no
@@ -1225,12 +1283,34 @@ wrapping; shorten labels or use icons when the full labels cannot fit.
---
-## Check 33 — `QACHK-ACTION-CONTRACT` (required action is missing, unreachable, or not wired)
+## Check 33 — `QACHK-ACTION-CONTRACT` (required action, record field, or declared surface is missing)
**Problem:** A screen can display the expected entity while omitting or failing to wire a
-required action.
+required action. It can also render a sparse card or row that omits requested record
+fields, or fail to apply a plan-declared visibility predicate to the surface that owns
+the disclosure, even though its source and other actions are valid.
+
+**Detect:** First, for every row in the screen brief's `## Required Record Fields` table:
+
+1. Find the named control inside the declared card, row, or detail hierarchy.
+2. Confirm its formula references the required source field on the current record. For a
+ combined control, confirm the formula references every field assigned to it.
+3. Confirm it is visible in the normal state, non-zero-sized, readable, inside the record
+ surface, and not clipped or displaced at desktop and phone widths.
+4. Reject a time-only, identity-only, icon-only, tooltip-only, accessible-label-only, or
+ action-only surface when the brief requires additional visible fields.
-**Detect:** For every row in the screen brief's `## Required Actions` table:
+For every row in the screen brief's `## State-Driven Surface Visibility` table, or exact
+`Surface.Visible=state predicate` declaration in a Required Action:
+
+1. Find the named surface control and inspect its own `Visible` property.
+2. Confirm it uses the planned predicate or a provably equivalent Boolean form.
+3. Reject visibility applied only to a child control or replaced with navigation to
+ another screen.
+4. Do not infer this contract from implementation alone; apply it only to visibility
+ explicitly declared by the plan.
+
+Then, for every row in the screen brief's `## Required Actions` table:
1. Find the named entry point and action control.
2. Confirm it is visible, non-zero-sized, enabled, outside read-only ancestors, and
@@ -1257,9 +1337,10 @@ required action.
named source and stable ID -> postcondition -> observer -> visible evidence. Confirm
`Visible` and `DisplayMode` permit the Given state and every name in the trace exists.
-**Fix:** Surface the full canonical identity text and every planned entry control, and
-implement each required event behavior. Stack paired decisions or move both into the same
-immediately reachable detail rather than dropping one.
+**Fix:** Restore every required field binding, planned surface visibility binding, and
+entry control, then implement each required event behavior. Keep field controls inside
+the record surface with readable layout bounds. Stack paired decisions or move both into
+the same immediately reachable detail rather than dropping one.
**Exception:** None for a Required Actions row. If the brief cannot be implemented with
the discovered controls or data source, return `Status: Blocked` rather than shipping a
@@ -1287,24 +1368,157 @@ prove that the requested outcome occurred.
4. Compare the Required Action's mutation write set with its receipt proof set and the
handler formula. Every field or status changed by the formula must appear in the declared
write set. For create/edit, every user-entered or user-selected write-set field must also
- appear in the proof set.
+ appear in the proof set. Compare the Mutation Field Ledger as well: every handler
+ write is a Changed row with write/proof parity, while every user-visible or
+ lifecycle-significant value that must survive is a Preserved row. A Preserved row must
+ either be absent from a partial update or carry the exact canonical pre-state value and
+ must name a post-state observer. Defaults, display text, stale selection, and parallel
+ collections are not preservation sources.
5. Inspect the receipt controls and confirm each proof-set field has a readable label and a
visible binding to the captured state. Input values before submission, hidden variables,
agent memory, unlabeled or truncated text, and fields available only in a scrolled list
- do not count. `Notify()` and navigation do not pass.
+ do not count. A receipt formula may render literal label text, but static evidence must
+ expose exactly one unambiguous underlying dynamic value expression for that field:
+ either bind the value directly or decorate one dynamic value with literals. If multiple
+ dynamic expressions could be the value, report a dedicated
+ ambiguous-receipt-expression error rather than guessing. `Notify()` and navigation do
+ not pass.
6. For edit, require stable-ID selection and update, complete prepopulation, preservation
of unchanged fields, and non-mutating Cancel behavior.
7. For a shared create/edit form, require intentional state reset after create and save.
8. Confirm the observer formula reads the same source, stable ID, and changed fields used
by the handler. A receipt copied from input controls, a parallel collection, a stale
- `ThisItem`, or a badge bound to a different status field fails.
+ `ThisItem`, or a badge bound to a different status field fails. Apply the complete mutation
+ lifecycle trace: identify the canonical source and the requested destination, then
+ confirm their observers, the mutation receipt, and the operation all use the same
+ stable ID. If the destination reads a cache, projection, related collection, or
+ external query rather than the canonical live source, require an exact refresh,
+ requery, or cache update on the successful path before destination evidence appears.
+ If the destination contains multiple records, require selection, filtering,
+ highlighting, or opening by that stable ID. Display text and list position do not
+ establish focus.
9. Mentally substitute the Functional Test Scenario's concrete Given values into the
handler. Confirm its Then postcondition and every proof-set value follow from the
formula without assuming runtime state not established by the app.
+10. For opposing transitions, confirm each direction has a separate Required Action and
+ concrete scenario. A shared form may share controls but not contracts or expected
+ outcomes.
+ When directional selector events commit operation state and a distinct guarded event
+ consumes that state to mutate, inspect every directional selector event: each may set
+ only the common operation state plus selection, receipt, or display UI state, and must not
+ call `Patch`, `SubmitForm`, `Collect`, `Remove`, `RemoveIf`, `UpdateIf`, or a connector
+ mutation. Confirm both directions name the same operation state and the same distinct
+ mutation event, and that this event is the only mutation entry point; its control name
+ or label is irrelevant. The actual operation state is the one that event consumes.
+ Confirm an event-bearing selector assigns it, its invalid gate blank-checks it, and the
+ gated control owns or routes to the mutation. Reject a dead gated control beside
+ direct-mutation buttons. Button, dropdown, and radio selectors all pass when they
+ commit explicit direction state. Do not apply the shared-handler restriction to
+ separate direct actions: they pass when each has its own complete eligibility gate and
+ mutation handler, provided no dead shared gate is claimed.
+ Confirm shared operation state is reset to `Blank()` on action-screen entry and/or
+ after successful Apply. An `App.OnStart`-only assignment is insufficient because it
+ does not reset later visits or actions. Blank-operation evidence must name the actual
+ operation state and reset event; an amount control's `Default: =Blank()` does not pass.
+ When a classic Dropdown with nonempty `Items` is the operation state, confirm
+ `AllowEmptySelection: =true`; otherwise a blank default/reset does not prove no
+ operation. For a Combo box, confirm `DefaultSelectedItems: =[]`; do not require
+ `AllowEmptySelection`. Do not prescribe unsupported empty-selection properties for a
+ List box. Prefer explicit operation state when control semantics are uncertain.
+ Independent direct actions do not require shared operation state/reset because each
+ control identifies its direction, but each action still requires selected-ID and
+ amount gates.
+11. Confirm the operation selector and required amount/value input are visible,
+ pointer-selectable, inside parent bounds, and reachable in the scenario's Given state.
+ Confirm the operation selector is a Dropdown, radio group, or visible button-group that
+ commits on click — not an autocomplete/searching combobox whose selection does not
+ deterministically and visibly commit. Confirm submit is disabled when either input is
+ hidden, clipped, blank, invalid, unset, or unreachable, and confirm the opposite: that
+ submit positively becomes enabled and clickable once a valid operation and positive
+ amount are set. A gate that can never enable in any state fails this check.
+ Confirm blank and non-positive amount states are representable. For
+ `ModernNumberInput`, inspect `Default`, `Min`, current `Value`, `ValidationState`, and
+ every `Reset(...)`: reject `Min: =1` when the scenario claims the user enters `0`, and
+ reject a reset claim when `Default` restores a valid positive value. `Default: =0`
+ passes when `Min <= 0`, the gate rejects zero, and Reset restores zero as the chosen
+ invalid state. Both blank and `Value <= 0` must disable submission and produce visible
+ validation. When `OnChange` stages the amount, apply these same checks to the source
+ input and confirm the gate rejects its current/staged invalid value.
+ Accept either explicit non-positive form supported by the acceptance contract:
+ `value <= 0` or `Not(value > 0)`. Do not require a syntactic spelling the validator
+ rejects.
+12. Trace the current selected operation into the mutation formula. Reject a hard-coded
+ default direction, a stale variable from an earlier interaction, or a toggle that
+ infers the requested direction from prior state.
+13. For arithmetic pairs, substitute the same concrete old value and amount into both
+ scenarios. Increase must produce `old + amount`; decrease must produce
+ `old - amount`. Trace the branch condition and reject a reversed sign when the increase
+ operation selects the subtraction branch or the decrease operation selects the
+ addition branch, even if both expressions occur somewhere in the handler. When both
+ directions act on the same record type, also trace a same-record compound sequence
+ (e.g. `Qty 10 -> Receive 3 -> 13 -> Issue 2 -> 11`) and confirm the second operation's
+ old value is read from the canonical source the first mutation already updated, not a
+ stale original value.
+ Require a literal guard for each operation value. An `else` branch or default `Switch`
+ arm does not prove a direction because blank, stale, or unexpected operation values
+ can reach it.
+ Trace one nullable selected-record ID across initialization/reset (`Blank()`), row
+ selection assignment, selected-record display, gate, mutation `LookUp`, receipt, and
+ compound evidence. This is the default incomplete-state proof. Reject
+ `Control.Selected` / `.Selected.*` from a Gallery, Dropdown, List box, or Combo box as
+ proof of no explicit selection when nonempty `Items` can auto/default-select a record,
+ unless empty-selection semantics are explicitly configured and evidenced. Reject any
+ narrative/table that names an explicit ID while final code consumes control selection
+ (or vice versa).
+14. Confirm the receipt binds the selected operation, old value, amount, expected new
+ value, and actual persisted new value, and that the destination observer shows the
+ same actual value.
+15. **Staging-variable liveness.** When any operand the mutation reads — a `Patch`/`Collect`
+ change value, an arithmetic operand, an `If`/`Switch` condition, or a `LookUp`/`Filter`
+ key — is a variable meant to carry a user-entered or user-selected value (a *staging
+ variable* such as a global `varAmount`/`varOldQuantity` or screen-context
+ `locAmount`/`locOldQuantity`), trace every place that variable is written. It MUST be
+ written from the live input before the mutation consumes it: either in the mutation
+ event before `Patch`, or in a reachable input/selector event such as `OnChange` or
+ `OnSelect`
+ (`ModernNumberInput`, `ModernTextInput`, `ModernDropdown`, slider, combo box, …) that
+ runs `Set(varStaging, Control.Value)` / `Set(varStaging, Control.Selected)` or
+ `UpdateContext({locStaging: Control.Value})` /
+ `UpdateContext({locStaging: Control.Selected})`, or by reading `Control.Value` /
+ `Control.Selected` inline at mutation time. An assignment after `Patch` cannot supply
+ that write and fails. A staging variable initialized only in `App.OnStart` or
+ `Screen.OnVisible` and never re-written from a live input event is **dead**: it keeps
+ its seed value (`0`, `Blank()`) forever, so the mutation silently computes against the
+ seed instead of the typed amount, and the formula still compiles and still passes every
+ directional/sign check. Reject it. The preferred, grep-verifiable form is to read the
+ input directly at the point of mutation (`Value(txtAmount.Text)`,
+ `cmbItem.Selected.ID`); when a staging variable is used instead, its `Set(...)` or
+ `UpdateContext({...})` assignment from the corresponding input control must be present
+ and reachable before the mutation consumes it, not only its initialization seed.
+ `validate-canvas-acceptance.cs` enforces this bounded static provenance for directional
+ receipt old/amount operands; that liveness check does not establish that a staged
+ amount is valid, so separately inspect its `Default`, `Min`, current-value gate, and
+ reset behavior.
+ Runtime inspection remains necessary because a static formula match cannot prove that
+ `OnChange` fires, that a selector or mutation control
+ is pointer-reachable, or that an enabled control can actually be clicked.
**Fix:** Preserve the affected record state, update or refresh the visible binding, and add
the required in-viewport mutation receipt with write-set/proof-set parity and one labeled
-binding per proof-set field. `Notify()` alone is not an observable outcome.
+binding per proof-set field. Complete the mutation lifecycle row and field ledger, including
+same-ID destination synchronization/focus and canonical preservation evidence. For
+opposing transitions, split merged contracts and
+scenarios, expose a reachable operation selector, fail closed on invalid inputs, repair the
+arithmetic direction, and show complete before/after receipt evidence. Wire every staging
+variable to its live input control (a reachable `Set`/`UpdateContext` before `Patch`, or an
+inline `Control.Value`/`Control.Selected` read at mutation time) rather than leaving it at
+an `App.OnStart`/`Screen.OnVisible` seed or assigning it after the write. For
+shared-operation flows, move mutations out of selectors and into the one distinct guarded
+mutation event. `Notify()` alone is not an observable outcome.
+
+This check is static inspection. It cannot prove that a runtime event fires, an external
+write or synchronization succeeds, or destination focus renders. Preserve
+`Runtime evaluation: NOT RUN` until those behaviors are executed in the running app.
**Exception:** None for a mutation named in `## Required Actions`.
@@ -1354,20 +1568,39 @@ off-canvas.
**Detect:** For every horizontal AutoLayout container at each desktop, tablet, and phone
branch:
-1. Add the minimum or fixed widths of all visible children.
-2. Add `LayoutGap` for every gap and left/right padding.
-3. Compare the total with the parent width available in that branch.
+0. For nested coordinated branches, confirm the parent `Height`, child
+ `LayoutDirection`, and related formulas remain safe if a logical-width narrow branch
+ never activates. `App.Width`, named root width, and root `Parent.Width` may stay at
+ logical design width in embedded or scale-to-fit hosts. Because `.pa.yaml` does not
+ expose a proven display-setting contract, fail required horizontal field/action groups
+ unless the wide/default composition itself fits a static bound, wraps, deliberately
+ scrolls, or is replaced by an always-stacked composition. Layout Budget Evidence
+ cannot prove host viewport sensitivity.
+1. Record total available container/root width for the branch.
+2. Add left/right padding, the minimum or fixed widths of all visible children, and
+ `LayoutGap` for every gap.
+3. Compare that required total with total available width at each exact branch threshold
+ and record both numbers in QA evidence. Do not subtract padding from available width
+ and also add it to required width.
4. If flexible children use `FillPortions`, confirm their `LayoutMinWidth` values still
- fit before remaining width is distributed.
+ fit before remaining width is distributed. A `FillPortions > 0` child contributes its
+ explicit numeric `LayoutMinWidth`; an absent or zero minimum contributes zero, and
+ `Width` is not required. Every non-fill child needs numeric `Width`; use the greater of
+ that value and numeric `LayoutMinWidth`. A positive minimum alone does not safely bound
+ a symbolic width.
5. If the total does not fit, require a wrap or vertical-stack branch and repeat the
calculation for each resulting row.
6. For a record row, confirm its phone branch keeps identity, status, and required
lifecycle actions visible or uses an immediately visible overflow/detail entry.
-**Fix:** Stack or wrap the row, reduce justified minimum widths, group related fields, or
-move secondary actions to another reachable region. Keep required lifecycle actions in the
-visible phone composition. Do not shrink interactive controls below 44px or hide required
-actions.
+An overflow escape must be exactly `Scroll` or `LayoutOverflow.Scroll`. A conditional
+formula that merely contains `Scroll` does not prove its other branches are reachable.
+
+**Fix:** Stack or wrap the row, reduce justified minimum widths, group related fields, add
+a deliberate horizontal scroll region with a visible affordance, or move to a higher
+breakpoint/vertical layout. Keep the primary mutation action, amount control, and required
+lifecycle actions in the visible composition. Do not shrink interactive controls below
+44px or hide required actions.
**Exception:** A deliberately horizontally scrolling region with an obvious visible
scroll affordance and a brief that explicitly requires it.
@@ -1502,3 +1735,100 @@ by the brief. Remove placeholder surfaces and overlays that obscure the result.
**Exception:** None when the screen brief names a core visualization. If the discovered
controls cannot implement the requested interaction exactly, render the strongest truthful
approximation and report it as blocked or approximate; never ship a blank region.
+
+---
+
+## Check 42 — `QACHK-PRIMARY-ACTION-REACHABILITY` (required action cannot be used)
+
+**Problem:** A required action can exist in YAML but remain unusable because it is below a
+clipped form, inside a zero-height container, covered by an overlay, permanently disabled,
+or too small to target reliably.
+
+**Detect:** Trace every Required Actions entry point from the screen's initial state.
+Confirm its ancestor chain is visible, its enabled precondition is satisfiable, its target
+is at least 44px by 44px, and its bounds do not intersect another visible control at
+desktop, tablet, or phone widths. An action below the initial viewport needs an obvious
+working scroll or menu affordance that passes the same checks.
+For an action inside AutoLayout, include the ancestor horizontal and vertical arithmetic
+that places it inside bounds; "visible in YAML" or an unsupported `PASS` is insufficient.
+Explicitly verify Save, the amount input, and the primary mutation action.
+For directional flows, the operation selector, amount input, submit control, and
+validation/status prompt must remain visible in no-selection, no-operation, and
+non-positive states. Disable submit while invalid; do not hide that surface or a required
+ancestor behind `Not(IsBlank(selectedId))`, a positive-amount condition, or another
+valid-state visibility gate.
+
+**Fix:** Move the action into the initial task path, repair the containing layout, enlarge
+its target, or expose it through an immediately visible menu.
+
+**Exception:** A destructive confirmation action may begin hidden when a reachable
+delete/remove entry point makes it visible.
+
+---
+
+## Check 43 — `QACHK-LIFECYCLE-IDENTITY` (selected-record mutation targets the wrong row)
+
+**Problem:** Edit, delete, approve, reject, and status actions can appear wired while
+targeting display text, gallery position, a stale copied record, or the first row.
+
+**Detect:** For every selected-record mutation, trace the selected stable ID or record
+object through edit prepopulation, the mutation target, preservation of unchanged fields,
+and the immediate result observer. Review/status actions must write the same status field
+that filters, badges, dashboards, and reports render.
+
+When the plan declares a conditional continuation, trace the stable ID returned by create directly
+into the later edit, delete, relationship, approval, or transition target. Require a
+reachable continuation action bound to that ID, and require continuation identity and
+mode to clear after successful downstream completion and after non-mutating cancellation.
+A failed downstream mutation may retain context for retry. Do not require continuation
+for create-only flows, and reject recovery by display name, list position, or implicit
+control selection.
+
+Also apply a **LookUp key integrity** pass to every `LookUp`/`Filter` used to locate a
+mutation target (`Patch`, `Remove`, `UpdateIf`, or a connector mutation). The key comparison
+must test the collection's real key field against the exact selected or context value —
+`LookUp(colInventory, ID = cmbItem.Selected.ID)` — with NO string concatenation, prefix,
+suffix, casing change, padding, or reshaping applied to either side
+(`... = cmbItem.Selected.ID & " ID"`, `"ITEM-" & cmbItem.Selected.ID`,
+`Left(...)`, `Trim(...)`, `Upper(...)`), UNLESS the collection's documented schema in the
+plan genuinely stores the key in that transformed form. A concatenated or reshaped key is a
+**phantom LookUp key**: it can never equal any stored key, so `LookUp`/`Filter` returns
+`Blank()`/empty and the `Patch` silently creates nothing or targets no row while the formula
+still compiles. The acceptance validator now rejects the most common shape of this defect —
+a directional-mutation key that appends a string-concat or arithmetic operator directly to
+the selected-record expression (`... = cmbItem.Selected.ID & " ID"`) — so it no longer slips
+past the directional and selected-ID checks. It does **not** model every reshaping: a prefix
+wrap (`"ITEM-" & cmbItem.Selected.ID`), a function reshape (`Left(...)`, `Trim(...)`,
+`Upper(...)`), or the same surgery inside a `Remove`/`UpdateIf`/`Filter` or connector
+mutation still compiles cleanly. Confirm by
+inspection that both sides of the comparison name real, identically-typed fields with no
+cosmetic string surgery, and that the key used to locate the target is the same identity the
+receipt and observer report.
+
+**Fix:** Store the selected stable ID or record, mutate that identity, and bind post-action
+evidence to the same source and identity. Compare the `LookUp`/`Filter` key against the raw
+selected/context value with no concatenation, prefix, suffix, or reshaping unless the
+documented schema requires it; remove any phantom key surgery so the target row is actually
+found. For declared continuations, bind the downstream target to the returned create ID
+and clear continuation state on completion or cancellation.
+
+**Exception:** Create has no prior identity, but must assign a unique stable ID used by
+later lifecycle actions.
+
+---
+
+## Check 44 — `QACHK-SHARED-SOURCE-DERIVATION` (derived UI reads stale or unrelated data)
+
+**Problem:** CRUD can update one collection while filters, ordering, alerts, KPIs,
+dashboards, and reports read seed data, copied counters, or a screen-local collection.
+
+**Detect:** Identify the authoritative mutable source. Confirm every mutation writes it
+and every search, filter, ordering, alert, KPI, visualization, and report derives from it
+using the same field semantics.
+
+**Fix:** Remove duplicate or copied state and bind dependent surfaces to the authoritative
+source or a named formula derived from it. Refresh any intentional cache on every
+successful mutation path.
+
+**Exception:** An immutable version snapshot may use a separate source when the plan
+explicitly defines snapshot identity and comparison semantics.
diff --git a/plugins/canvas-apps/references/ValidationWorkflow.md b/plugins/canvas-apps/references/ValidationWorkflow.md
index 73346f121..095a765b8 100644
--- a/plugins/canvas-apps/references/ValidationWorkflow.md
+++ b/plugins/canvas-apps/references/ValidationWorkflow.md
@@ -1,6 +1,8 @@
# Validation Workflow
-The orchestrator owns compilation of the finished workspace and the final summary.
+The orchestrator owns compilation, evidence-based functional acceptance, and the final
+summary. Completion is fail-closed: the final successful compile must occur after the last
+app-YAML mutation.
## Contents
@@ -13,12 +15,15 @@ The orchestrator owns compilation of the finished workspace and the final summar
## 0. Compile Gates
-Compilation is not a final step. Three gates precede this workflow:
+Compilation is not a final step. Four gates precede completion:
-1. The planner compiles `[working directory]/App.pa.yaml` immediately after writing it.
+1. `[working directory]/App.pa.yaml` is compiled immediately after the planner writes it: the planner
+ owns this gate when it has `compile_canvas`; otherwise the MCP-owning orchestrator does.
2. The orchestrator confirms that result before dispatching builders.
3. The orchestrator compiles after each **wave** of builders returns, before dispatching
the next wave.
+4. After functional and layout repairs, the orchestrator compiles once more and makes no
+ further app-YAML mutation before the summary.
Gate 3 exists because builders work from a shared plan. A defect in the first wave is
almost certainly repeated in every later screen. Catching it after three files is cheap;
@@ -46,8 +51,8 @@ If compilation fails, fix diagnostics in this order:
1. `YamlInvalidSyntax` parse errors
2. Control template version conflicts — `Control type '...@X' has a version that is newer
- than the current version of 'Y'` and `Another instance of control type '...' has
- already been referenced using a different version`
+than the current version of 'Y'` and `Another instance of control type '...' has
+already been referenced using a different version`
3. `An entity with name '...' already exists` duplicate-name errors
4. `Unknown property ...` errors
5. `[Control 'App', Property '...']` errors
@@ -73,7 +78,7 @@ whole file instead of jumping to the reported line is the slowest possible respo
`${PLUGIN_ROOT}/references/YamlSyntax.md` maps every reason string to its cause.
**Sweep the file before you re-compile.** A parse error aborts the file, so the compiler
-reports only the *first* one it meets — the second instance of the identical mistake is
+reports only the _first_ one it meets — the second instance of the identical mistake is
invisible until you fix the first. After correcting an unquoted `: ` in a formula, a
mis-indented `Children:` entry, or a duplicate property key, read the rest of that file and
fix every other occurrence of the same pattern in the same pass. Otherwise each one costs a
@@ -122,15 +127,17 @@ Every turn in the repair phase must end in an `edit` or a `compile_canvas`. Thos
only two actions that change the outcome.
After **two consecutive turns** containing neither, stop and emit the unresolved-diagnostics
-report in section 2. Do not spend a third. A repair phase that has stopped writing and
+report in section 3. Do not spend a third. A repair phase that has stopped writing and
stopped compiling is not thinking — it is searching for a capability that does not exist,
and it will not recover on its own.
+
Reading a file, planning an approach, or delegating is not progress on its own. If you find
yourself unable to express a fix with `edit`, return to the named file and diagnostic
location. Repeated identical lines need separate targeted edits with enough surrounding
context to make each match unique.
+
### Convergence budget
Track the count of **distinct** diagnostics after every compile.
@@ -143,10 +150,10 @@ Track the count of **distinct** diagnostics after every compile.
cleared.
- Within one tier, if the distinct count does not strictly decrease across two consecutive
cycles, stop. You are guessing, not converging.
-- If two consecutive compiles return the *same* distinct diagnostic set, your last edit
+- If two consecutive compiles return the _same_ distinct diagnostic set, your last edit
changed nothing that mattered. Do not compile a third time hoping for a different
answer. Re-read the exact file and line the diagnostic names, and fix that text.
-- On stopping, report the remaining diagnostics explicitly as described in section 2.
+- On stopping, report the remaining diagnostics explicitly as described in section 3.
Never loop indefinitely and never claim success you have not observed.
### Repair ownership
@@ -169,16 +176,17 @@ diagnostic history, and a fresh agent would have to rediscover all of it.
screen or component-definition order requires correction. Preserve valid names and
repair only the affected order entries.
-### Verify before you summarize
+### Establish a clean candidate
-The summary must describe a compile you actually observed. Before writing it, confirm that
-**no `.pa.yaml` file has been edited since the last successful `compile_canvas`.** If one
-has, compile again — a clean result from before your last edit says nothing about what you
-shipped.
+Before functional conformance:
-Edits to non-compiled artifacts do not invalidate the result: `[working directory]/canvas-app-plan.md`,
-`[working directory]/canvas-app-shared.md` and `[working directory]/*.screen-plan.md` are planning documents, and
-updating one after the final compile is fine.
+1. Confirm every delegated builder and self-QA follow-up has returned. Do not begin
+ completion checks while a worker can still write to the workspace.
+2. Call `compile_canvas`, even when an earlier compile was clean.
+3. If the compile fails or another repair is necessary, repair and repeat this gate.
+
+This compile establishes a clean candidate. It is not the final generation-proof compile
+because functional conformance still writes the acceptance artifact.
## 2. Functional Conformance
@@ -188,16 +196,344 @@ files and evaluate every `## Functional Test Matrix` row.
For each scenario, record one result:
-- `PASS` only when the Given state establishes eligibility, the When interaction reaches
- the named event, the event reads or writes the named source and stable ID, the Then
- postcondition follows from the formula, and the evidence surface observes that same
- source/post-state.
+- `PASS` only when the Given state establishes eligibility, final YAML provides a
+ statically reachable path from the named When control to its event, the event reads or
+ writes the named source and stable ID, the Then postcondition follows from the formula,
+ and the evidence surface observes that same source/post-state.
- `FAIL` when any link is missing, contradictory, stale, bound to another source or field,
dependent on an unstated runtime assumption, or supported only by navigation,
notification, input text, or static copy.
+Write the result to `[working directory]/canvas-app-acceptance.md`:
+
+```markdown
+Runtime evaluation: NOT RUN
+
+
+Plugin root: [exact plugin root]
+Source revision: [git revision, package version, or "unavailable"]
+
+
+## Action Contract Acceptance
+
+| Action | Entry control | Event formula | Source / stable ID | Observer formula | Reachability | Result |
+| -------- | ------------- | --------------- | --------------------- | ---------------- | ----------------- | ------ |
+| [action] | [control] | [exact final-YAML `Control.Property: =formula` binding(s)] | [source and identity] | [exact formula] | [path and bounds] | PASS |
+
+## Mutation Lifecycle Evidence
+
+| Action | Receipt binding | Canonical source / observer | Requested destination / observer | Stable ID continuity | Synchronization | Focus | Result |
+| ------ | --------------- | --------------------------- | -------------------------------- | -------------------- | --------------- | ----- | ------ |
+| [mutation] | [exact final-YAML returned-record/ID or deletion-snapshot and receipt bindings] | [exact source and observer formula] | [exact destination and observer formula] | [same ID expression throughout] | [exact success-path sync, or N/A — same live source] | [exact focus-by-ID, or N/A] | PASS |
+
+## Mutation Field Evidence
+
+| Action | Field | Classification | Canonical pre-state or input | Write / preservation formula | Receipt / proof binding | Post-state observer | Result |
+| ------ | ----- | -------------- | ---------------------------- | ---------------------------- | ----------------------- | ------------------- | ------ |
+| [mutation] | [field/status] | Changed / Preserved | [exact final-YAML binding] | [exact final-YAML write, omission, or carry-forward evidence] | [exact labeled receipt or preservation evidence] | [exact observer for same ID/field] | PASS |
+
+## Continuation Evidence
+
+[Include only when the plan contains `## Continuation Contracts`.]
+
+| Create action | Returned stable-ID binding | Downstream action / event | Downstream target binding | Successful-completion clear | Cancellation clear | Result |
+| ------------- | -------------------------- | ------------------------- | ------------------------- | ---------------------------- | ------------------ | ------ |
+| [create] | [exact final-YAML returned ID capture] | [exact later mutation event] | [exact same-ID target] | [exact success clear] | [exact cancel clear] | PASS |
+
+## Required Record Field Evidence
+
+| Field key | Bound control | Exact formula | Record hierarchy | Visibility and layout evidence | Result |
+| --------- | ------------- | ------------- | ---------------- | ------------------------------ | ------ |
+| [key] | [control] | [formula] | [card/row/detail path] | [normal-state bounds and text fit] | PASS |
+
+## State-Driven Surface Visibility Evidence
+
+[Include when the plan contains `## State-Driven Surface Visibility` or an Action
+Contract `Observer and evidence` cell declares an exact
+`Surface.Visible=state predicate` binding.]
+
+| Surface key | Surface visibility binding | Result |
+| ----------- | -------------------------- | ------ |
+| [plan key] | [exact final-YAML `Surface.Visible: =state predicate`] | PASS |
+
+## Data Entry Label Evidence
+
+| Control | Visible label binding | Shared layout region |
+| ------- | --------------------- | -------------------- |
+| [required input] | [exact `lblField.Text` binding, unless a supported native visible Label is used] | [field row/group shared by label and input] |
+
+## Functional Test Matrix Results
+
+| Scenario | Static trace result | Evidence |
+| ---------- | ------------------- | ------------------------------ |
+| [scenario] | PASS | [Action Contract and observer] |
+
+## Directional Mutation Evidence
+
+| Pair | Selected-record expression | Operation-state reset binding | Invalid-submit gate | Receive/increase mutation | Issue/decrease mutation | Canonical-source observer | Receipt bindings | Result |
+| ---- | -------------------------- | ----------------------------- | ------------------- | ------------------------- | ----------------------- | ------------------------- | ---------------- | ------ |
+| [Receive/Issue] | [nullable selected ID; final YAML must blank-reset, row-assign, and consistently consume it] | [operation state plus exact entry/success `Blank()` reset event] | [exact `Control.Property: =formula`] | [exact `Control.Property: =formula`] | [exact `Control.Property: =formula`] | [exact `Control.Property: =formula`] | [five `<br>`-separated bindings: `operation`, `old`, `amount`, `expected`, `actual`] | PASS |
+
+## Compound Sequence Evidence
+
+[Include only when both directions of the pair act on the same record type. One row per pair.]
+
+| Pair | Same-record ID expression | Sequence (start -> op1 amount -> mid -> op2 amount -> end) | Second-op old-value binding (reads mutated canonical source) | Result |
+| ---- | ------------------------- | --------------------------------------------------------- | ------------------------------------------------------------ | ------ |
+| [Receive/Issue] | [exact selected ID expression] | [e.g. `Qty 10 -> Receive 3 -> 13 -> Issue 2 -> 11`] | [exact `Control.Property: =formula` sourcing the old value from the canonical collection] | PASS |
+
+## Screen QA Evidence
+
+| Screen | Coverage | Repairs | N/A |
+| -------- | ------------- | ------------------------------ | ---------------------- |
+| [screen] | 1-44 COMPLETE | [defined QACHK identifier followed by FIXED(n), or none] | [QACHK names, or none] |
+
+## Layout Budget Evidence
+
+| Screen / container | QACHK | Branch / width source | Available size | Required-size arithmetic | Protected controls | Result |
+| ------------------ | ------ | --------------------- | -------------- | ------------------------ | ------------------ | ------ |
+| [screen / control] | [QACHK-NO-HEIGHT-TRAP / QACHK-GALLERY-ROW-FITS-CONTENT / QACHK-HORIZONTAL-BUDGET / QACHK-PRIMARY-ACTION-REACHABILITY] | [screen-level expression and branch] | [total numeric container/root width or height] | [numeric child widths/heights + gaps + padding] | [amount, Save/Apply, receipt fields, etc.] | PASS |
+```
+
+
+Record the exact `${PLUGIN_ROOT}` and the plugin repository's short Git revision. If the
+installed plugin is not in a Git worktree, record source revision `unavailable`; never
+substitute the app workspace revision.
+
+
+The artifact is authoritative over builder summaries. `Runtime evaluation: NOT RUN`
+means this static acceptance validation ran, but browser/runtime evaluation did not.
+It does not mean acceptance was skipped. Replace it only when a
+fresh runtime evaluator returns a recorded result for this generated app.
+Even a recorded runtime success for directional arithmetic (for example,
+`10 + 3 = 13`, then `13 - 2 = 11`) proves only those executed transitions. It does not
+prove blank-selection, blank-operation, zero/non-positive amount, reset, cross-branch
+layout, or downstream visibility scenarios that were not executed and evidenced.
+
+The mutation lifecycle, field-ledger, and continuation tables are static formula evidence
+under that same boundary. A `PASS` proves
+that final YAML contains the receipt, canonical-source and requested-destination observers,
+same-ID trace, field ledger, synchronization/focus formulas, and conditional continuation
+bindings claimed by the plan. It does not prove that an event fired, an external write or
+refresh completed, a destination rendered the record, or focus moved in the running app.
+
+When the plan declares state-driven surface visibility—either in its dedicated table or
+with an exact `Surface.Visible=state predicate` Action Contract observer—static
+acceptance must preserve the named surface's exact `Visible` binding. The final YAML
+predicate must be the same as the plan or fall within the validator's bounded Boolean
+equivalence rules. This contract does not infer requirements for always-visible surfaces,
+child-only visibility, navigation-based disclosure, or visibility absent from the plan.
+
+The first line of the file must be exactly `Runtime evaluation: NOT RUN`; do not place a
+heading before it. The Action Contract table has exactly one row per Action Contract. When
+the plan contains `## Required Record Fields`, the field-evidence table has exactly one
+row per field key. `PASS` requires a final-YAML control inside the declared record surface,
+an exact formula that reads every required source field assigned to it, and normal-state
+evidence that the value is visible, non-zero-sized, readable, and inside the card or row.
+Missing, hidden, blank, clipped, displaced, tooltip-only, accessible-label-only, or
+time-only substitutes fail. The scenario table separately records every Functional Test
+Matrix row. The Screen QA table has one row per dispatch screen and preserves each
+worker's coverage, repairs, and N/A results. Copy formulas verbatim from final YAML. In
+every Gallery, compare the breakpoint scope used by `TemplateSize` with the direct row
+child's `LayoutDirection`: the row child's `Parent.Width` is gallery/template-scoped and
+can differ from the outer parent used by the Gallery. Require the same deliberate
+breakpoint source or evaluate every reachable cross-branch pair. Preserve a numeric height
+budget for every case covering padding, gaps, every child, required quantity/status
+fields, badges, actions, and wrapping. A required field that can clip fails even when its
+control and formula exist. For horizontal budgets, a `FillPortions > 0` child contributes
+its explicit numeric `LayoutMinWidth`; absent or zero contributes zero without requiring
+`Width`. Non-fill children need numeric `Width`; use the greater of it and numeric
+`LayoutMinWidth`, because a positive minimum cannot upper-bound a symbolic width. For
+fixed-height, non-scrolling vertical budgets, unresolved container or child heights fail
+until numeric container/child `Height` evidence is present, with numeric
+`LayoutMinHeight` as a floor. Exempt the canonical `Height: =Parent.Height` screen root
+and deliberate vertical-scroll containers only when no direct child has
+`FillPortions > 0`; a direct fill child is the documented scroll trap. `AutoHeight` text
+inside a fixed-height panel still needs numeric `Height`/`LayoutMinHeight` evidence or
+relocation into an intentionally scrolling/viewport-root layout. Accept horizontal scroll
+escape only for exact `Scroll`/`LayoutOverflow.Scroll`, never a conditional formula that
+contains a scroll branch. Never correlate `Parent.Width` conditions across nesting
+scopes; evaluate their cross-branch maximums, while matching `App.Width` conditions may
+correlate.
+In tables, preserve quoted and block-scalar formula content,
+normalize formula newlines to
+`<br>`, and escape `|` as `\|`; do not assume a one-line plain scalar or paraphrase an
+exact formula into an action summary. A phrase such as “Action uses Patch” is not an event
+formula. Record the exact final-YAML event binding for every event-bearing control involved
+in selection or mutation; do not add passive value inputs that have no relevant event.
+For a shared-operation flow — selector events commit operation state and a distinct guarded
+event consumes it to mutate — each directional Action Contract row must contain its exact
+selector event binding and the exact common mutation event binding. The two rows must name
+the same mutation `Control.Property` and operation state; control names and labels do not
+establish ownership. Selector bindings may set that state plus receipt/display UI state,
+but must not mutate; the actual operation state is the one the mutation event consumes.
+An event-bearing selector must assign it, the invalid gate must blank-check it, and the
+gated control must own or route to the mutation. A dead gated control beside
+direct-mutation buttons fails. When direct actions own their mutations instead,
+independently gated handlers remain valid and each row records its own exact event binding.
+Those independent action controls commit direction by identity and require no shared
+operation variable/reset, but each still needs selected-ID and amount gates.
+When a classic Dropdown with nonempty `Items` supplies operation state,
+`AllowEmptySelection: =true` is required before its blank default/reset proves no
+operation. For a Combo box use `DefaultSelectedItems: =[]`; do not assign
+`AllowEmptySelection`, and do not prescribe unsupported empty-selection properties for a
+List box. Otherwise use explicit operation state. For record selection, one nullable
+selected ID is the default incomplete-state proof. `Control.Selected` / `.Selected.*` on a
+Gallery, Dropdown, List box, or Combo box with nonempty `Items` does not prove no selection
+unless empty-selection semantics are explicitly configured and evidenced.
+Omit
+`## Required Record Field Evidence` only when the plan omits
+`## Required Record Fields`.
+
+Require `## Layout Budget Evidence` with numeric rows for every applicable
+`QACHK-NO-HEIGHT-TRAP`, `QACHK-GALLERY-ROW-FITS-CONTENT`,
+`QACHK-HORIZONTAL-BUDGET`, and `QACHK-PRIMARY-ACTION-REACHABILITY` PASS. For horizontal
+branches, record total available container/root width and compare it with left/right
+padding + child fixed/minimum widths + gaps. For fixed-height vertical branches, record child fixed/minimum heights, wrapped text,
+gaps, and padding against `Height`. Enumerate every reachable cross-branch combination.
+Logical `App.Width`, named-root width, and root `Parent.Width` are not rendered-host
+viewport evidence in embedded or scale-to-fit hosts. Record narrowest-host arithmetic
+when known, but never use that self-reported row to prove the narrow branch activates.
+Repeat a container in separate rows for each axis or responsive branch as needed; identify
+the applicable `QACHK` and branch in each row. `Available size` is the total width/height
+for that row, not a post-padding value.
+Evidence must show amount controls and Save/primary mutation actions remain reachable and
+all five labeled receipt fields fit together. These calculations are static evidence only;
+a browser evaluation remains necessary to prove rendered reachability.
+
+Include `## Data Entry Label Evidence` for every required classic or modern TextInput,
+NumberInput, Radio, DropDown, and ComboBox consumed by accepted action formulas,
+including `ModernTextInput`, `ModernNumberInput`, `ModernRadio`, `ModernDropdown`, and
+`ModernCombobox`. Name the exact visible label binding and immediate shared parent/field
+region. `AccessibleLabel` and `HintText` do not count. A `ModernNumberInput` may use its
+native visible `Label` binding in the evidence row; every other type needs a sibling
+label.
+When the input and sibling label are inside the same plan-declared state-driven surface,
+that surface's validated `Visible` predicate defines when both participate in the UI and
+does not make the label transient. The label itself must have no separate conditional
+`Visible` formula, and the evidence region must match their actual immediate parent.
+Logical canvas width evidence is never proof that a narrow branch activates in an
+embedded or scale-to-fit host; without settings exposed in `.pa.yaml`, require wrapping,
+always-stacked fields, deliberate scrolling, or a statically bounded wide/default branch.
+
+For list-driven requirements, post-export/runtime proof must include a screenshot with at
+least one real data row visibly rendered and its required row action reachable. A runtime
+probe reporting only four interactive descendants is hard-fail evidence for an expected
+multi-control/list screen, not support for static success. Keep these claims labeled
+runtime/post-export: the local static validator can reject risky Gallery shapes but cannot
+prove that a host rendered rows.
+
+When the plan contains an opposing directional pair, include `## Directional Mutation
+Evidence` with exactly one row per pair. This is an executable gate, not a self-reported
+trace: copy final-YAML formulas exactly. The validator independently requires one nullable
+selected ID initialized/reset blank and assigned by row selection, consistent consumers,
+an actual operation-state reset event, representable blank/non-positive amount states, a
+gate that rejects them, plus/minus arithmetic, one canonical source
+read by the observer, and five receipt bindings including an actual persisted `Patch`
+result. The operation selector, amount, submit, and validation/status surface must remain
+visible in invalid states; the submit may be disabled but neither it nor a required
+ancestor may be gated to the selected/valid state. A gallery-only selected-ID event also
+requires bounded Gallery `Height`, explicit positive `TemplateSize`, numeric
+`TemplatePadding`, `Items`, and row controls.
+For the amount rejection, accept either supported equivalent spelling in final YAML:
+`value <= 0` or `Not(value > 0)`; do not prescribe a third form unsupported by the
+validator.
+
+Receipt controls may include visible label text. Static evidence still has to expose one
+unambiguous underlying value expression for each required receipt field. A direct value
+formula is valid, as is literal label decoration around exactly one dynamic value
+expression after quoted/block-scalar normalization. When multiple dynamic expressions
+could be the field value, fail with a dedicated ambiguous-receipt-expression error; do not
+guess an operand or accept the visible text alone.
+
+During final validation, cross-check the Action Contract cells against final YAML and
+against `## Directional Mutation Evidence`; do not allow either table to contradict the
+other. For a shared-operation flow, trace every exact selector binding into the same
+operation state and the same exact distinct mutation event, then verify only that event
+contains the mutation. Verify an event-bearing selector assigns that exact state, the
+invalid gate blank-checks it, the gated control owns or routes to the mutation, and the
+mutation consumes it. Reject a dead gated control beside direct-mutation buttons. For
+arithmetic pairs, associate the operation values with their
+specific branches and prove increase reaches `old + amount` while decrease reaches
+`old - amount`; the mere presence of both expressions is insufficient. Require a literal
+guard for each direction; an `else` or default arm is not directional proof. Perform these
+comparisons on normalized formula content so quoted and block-scalar YAML forms are
+equivalent after newlines are represented as `<br>`. Static text/formula checks establish
+conformance, not runtime pointer reachability or event execution: a live browser
+evaluation must still prove that each selector and the distinct mutation control can be
+reached and clicked in the stated Given state.
+
+The directional gate also checks the two static shapes behind QAChecks Check 34
+"staging-variable liveness" and Check 43 "LookUp key integrity." A receipt old/amount
+operand that is a global `var*` or screen-context `loc*` staging variable must be assigned
+from a live `.Selected`, `.Text`, or `.Value` expression before `Patch`, either through
+`Set(...)`/`UpdateContext({...})` in the mutation prelude or through a reachable
+event-bearing input/selector control. An `App.OnStart` or `Screen.OnVisible` seed alone
+fails, and an assignment after `Patch` is too late. The `LookUp`/`Filter` key used by the
+mutation must use the raw selected-record expression with no concatenation or arithmetic
+suffix. These checks prove that the final YAML contains a live-input assignment and an
+untransformed key; they cannot prove that the running app actually fires the event, that
+the control is pointer-reachable, or that the data source accepts the write. Preserve the
+manual QAChecks inspection and live browser evaluation for those runtime properties.
+For an `OnChange`-staged amount, liveness proves only that the variable receives an input
+value. Separately verify compatible `Default`/`Min`, current-value rejection, visible
+validation, and Reset restoring the chosen invalid default (`Blank()` or `0`).
+
+When both directions of that pair act on the same record type, also include `## Compound
+Sequence Evidence` with one row per same-record pair. It records the same-record ID, the
+`start -> op1 -> mid -> op2 -> end` sequence, and the exact final-YAML binding that sources
+the second operation's old value from the canonical collection (e.g. a `LookUp` over the
+patched source), proving the second operation reads the already-mutated value, not the
+original. Unlike the directional table, the validator does not machine-check this table —
+no static check can prove the running app's submit button becomes clickable or that the
+second read observes the mutated value; that remains the live browser evaluation's job — so
+copy the formulas exactly and treat it as a required authoring/reviewer proof.
+
+Do not replace `NOT RUN` with another value unless a runtime evaluator actually executed
+against this app and the artifact records its run ID or result URL and score.
+
+
+After writing the artifact, run:
+
+```text
+dotnet run --file "${PLUGIN_ROOT}/scripts/validate-canvas-acceptance.cs" -- \
+ "[absolute working directory]" "${PLUGIN_ROOT}"
+```
+
+The validator compares the acceptance rows with the plan's Action Contracts, Functional
+Test Matrix, and dispatch screens. A nonzero exit blocks completion. Repair the artifact
+and rerun the validator until it passes; never summarize success without its `PASS`
+result.
+
+The validator itself is regression-tested. `scripts/tests/` drives it against the
+`receive-issue` fixture (a correctly-signed Receive/Issue workspace must `PASS`; a
+reversed-sign one must fail on the directional check) via `node scripts/run-tests.js`,
+which the `canvas-apps-script-tests` CI workflow runs on every change under
+`plugins/canvas-apps/**`. This is a static conformance gate only — it does not execute the
+app, and a live browser evaluation remains the authority for the runtime functional grade.
+
+
For mutations, also compare the handler, write set, proof set, receipt bindings, and
-downstream observer one-for-one. For filters, verify the concrete selector value is
+downstream observer one-for-one. Require one `## Mutation Lifecycle Evidence` row per
+mutation Action Contract. Confirm the receipt, canonical observer, requested destination,
+and destination observer all use the mutated stable ID. When destination and canonical
+source differ, require an exact successful-path synchronization formula before destination
+evidence; for multi-record destinations require an exact focus-by-ID formula.
+
+Require `## Mutation Field Evidence` to match the plan ledger. Every handler-written field
+is classified Changed, occurs in the Action Contract write and proof sets, and has one
+readable receipt binding. Every Preserved row identifies canonical pre-state, proves
+omission from a partial update or exact carry-forward, and names a post-state observer for
+the same stable ID. A default, stale selection, display value, or parallel collection is
+not preservation evidence.
+
+Require `## Continuation Evidence` only when the plan declares a continuation from create
+to a later edit, delete, relationship, approval, or transition. Trace the returned create
+ID directly into that later target and verify both successful completion and cancellation
+clear continuation identity/mode. Do not require or synthesize continuation for
+create-only flows.
+
+For filters, verify the concrete selector value is
pointer-committed into the target `Items` predicate, preserves both matching seeded
records, excludes the non-match, shows the active criterion, and clears deterministically.
@@ -216,6 +552,60 @@ runtime interaction tool. Report it as functional readiness, not as proof of run
execution. A fresh browser evaluation remains the authority for the external functional
grade.
+Never report an unqualified percentage such as `100% functional` or `18/18 (100%)`.
+Always include `static conformance` in the same sentence and immediately state the runtime
+evaluation status.
+
+
+### Verify the coauthoring round trip
+
+Before crossing the finalization barrier, prove that the coauthoring session returns the
+authored app rather than the original blank shell:
+
+1. Use `Bash` to create a fresh empty temporary directory outside `[working directory]`.
+ Do not place planning, acceptance, or other non-YAML files in it.
+2. Call `sync_canvas` with that temporary directory.
+3. Inspect the synchronized `App.pa.yaml` and every screen named by the plan's dispatch
+ table. Every expected file must exist. In CREATE mode, every screen must contain at
+ least one meaningful visible leaf control beneath its screen root; the root Screen and
+ layout-only containers do not count.
+4. If a screen is missing, root-only, or does not contain the controls present in the
+ authored working copy, delete the temporary directory, call `compile_canvas` again,
+ wait for it to succeed, and repeat the synchronization once with a new empty directory.
+ If the second server snapshot is still missing or stale, stop with
+ `Status: Coauthoring Sync Blocked`; do not claim generation succeeded.
+5. Delete the temporary verification directory before crossing the finalization barrier.
+ Never copy the synchronized snapshot over `[working directory]`.
+
+This round trip is server-state evidence. `compile_canvas` success alone proves validation,
+not that a nonblank app is observable when the browser joins the coauthoring session.
+
+
+### Final generation-proof gate
+
+Immediately before the summary:
+
+1. Confirm `[working directory]/canvas-app-acceptance.md` has one evidence row for every Action Contract
+ and every Required Record Fields key, no failed row, and has passed its required
+ validation.
+2. Confirm no delegated agent remains running or queued, every app, planning, and
+ acceptance-artifact write is complete, and the coauthoring round-trip check above has
+ passed when that check is available.
+3. Cross the finalization barrier: from this point onward, do not invoke `Task`, resume an
+ agent, request another QA pass, or perform another inspection. If any of those are still
+ needed, remain before the barrier and complete them first.
+4. Call `compile_canvas`, even when the clean-candidate compile succeeded.
+5. After it succeeds, make no further tool call. Return the summary immediately. In
+ particular, do not call `Task`, `read_agent`, `edit`, `create`, `apply_patch`,
+ `sync_canvas`, `view`, `glob`, `rg`, `Bash`, or another MCP tool.
+6. If any later tool call, delegation, write, inspection, or repair occurs, the compile is
+ no longer final. Finish that work, confirm every agent has returned, and repeat this
+ entire gate. A compile predating later activity is not final proof.
+
+The final successful `compile_canvas` must be the final tool call. This ordering prevents
+late agent waves from changing the workspace and lets external generation proof
+distinguish a completed app from an app changed after validation.
+
## 3. Summary
For CREATE:
@@ -223,12 +613,18 @@ For CREATE:
```markdown
**App generation complete.**
-| Screen | File | Status |
-|--------|------|--------|
+| Screen | File | Status |
+| -------- | -------------- | ------- |
| [Screen] | [file].pa.yaml | Created |
**Compiled clean** after [N] pass(es).
**Functional readiness:** [passed]/[total] scenarios passed static conformance.
+**Acceptance evidence:** `[working directory]/canvas-app-acceptance.md`.
+**Runtime evaluation:** NOT RUN.
+
+
+**Plugin provenance:** [exact plugin root] · version [version] · revision [revision or unavailable].
+
```
For EDIT:
@@ -236,12 +632,18 @@ For EDIT:
```markdown
**Edit complete.**
-| Action | Screen | File | Status |
-|--------|--------|------|--------|
-| [Create / Modify] | [Screen] | [file].pa.yaml | Done |
+| Action | Screen | File | Status |
+| ----------------- | -------- | -------------- | ------ |
+| [Create / Modify] | [Screen] | [file].pa.yaml | Done |
**Compiled clean** after [N] pass(es).
**Functional readiness:** [passed]/[total] scenarios passed static conformance.
+**Acceptance evidence:** `[working directory]/canvas-app-acceptance.md`.
+**Runtime evaluation:** NOT RUN.
+
+
+**Plugin provenance:** [exact plugin root] · version [version] · revision [revision or unavailable].
+
```
If diagnostics remain after the convergence budget is exhausted, report them explicitly
@@ -250,15 +652,15 @@ instead of claiming completion:
```markdown
**App generated with unresolved diagnostics.**
-| Screen | File | Status |
-|--------|------|--------|
+| Screen | File | Status |
+| -------- | -------------- | ------- |
| [Screen] | [file].pa.yaml | Created |
**Compile status:** [N] distinct diagnostics remain after [M] pass(es).
-| Diagnostic | Occurrences | File |
-|------------|-------------|------|
-| [message] | [count] | [file] |
+| Diagnostic | Occurrences | File |
+| ---------- | ----------- | ------ |
+| [message] | [count] | [file] |
[One line on what was tried and what is likely blocking.]
```
@@ -271,7 +673,7 @@ of claiming completion:
**Functional readiness:** [passed]/[total] scenarios passed static conformance.
-| Scenario | Failed link | Owner file |
-|----------|-------------|------------|
-| [scenario] | [eligibility / event / source-ID / postcondition / observer-evidence] | [file] |
+| Scenario | Failed link | Owner file |
+| ---------- | --------------------------------------------------------------------- | ---------- |
+| [scenario] | [eligibility / event / source-ID / postcondition / observer-evidence] | [file] |
```
diff --git a/plugins/canvas-apps/references/YamlSyntax.md b/plugins/canvas-apps/references/YamlSyntax.md
index f2d4913da..3bb95cad6 100644
--- a/plugins/canvas-apps/references/YamlSyntax.md
+++ b/plugins/canvas-apps/references/YamlSyntax.md
@@ -22,13 +22,13 @@ How a `.pa.yaml` file is shaped, the syntax rules that decide whether it parses,
## File structure
-Each '*.pa.yaml' file should contain a single top-level object. These are specified using one of the following top-level keywords:
-- `App` - Represents the 'App' object in the app. The filename for this object should be `App.pa.yaml`.
+Each `*.pa.yaml` file should contain a single top-level object, specified using one of the following top-level keywords:
+- `App` - Represents the App object in the app. The filename for this object should be `App.pa.yaml`.
- `EditorState` - Controls the Studio ordering of screens and local component definitions through `ScreensOrder` and `ComponentDefinitionsOrder`. Use filename `_EditorState.pa.yaml`.
- `ComponentDefinitions` - A named-object-mapping of local component definitions. Use filename `<the component's name>.pa.yaml`.
-- `Screens` - A named-object-mapping of screens in the app Use filename `<the screen's name>.pa.yaml`.
+- `Screens` - A named-object-mapping of screens in the app. Use filename `<the screen's name>.pa.yaml`.
-You should ensure each top-level object is placed into its own pa.yaml file, using the correct top-level keyword.
+You should ensure each top-level object is placed into its own `pa.yaml` file, using the correct top-level keyword.
```yaml
Screens:
diff --git a/plugins/canvas-apps/skills/canvas-app/SKILL.md b/plugins/canvas-apps/skills/canvas-app/SKILL.md
index b6ebefc44..a6b0e53f1 100644
--- a/plugins/canvas-apps/skills/canvas-app/SKILL.md
+++ b/plugins/canvas-apps/skills/canvas-app/SKILL.md
@@ -1,12 +1,15 @@
---
name: canvas-app
-version: 3.0.3
+version: 3.0.9
description: Creates or edits a Power Apps Canvas App through the Canvas Authoring MCP coauthoring session. Handles new app generation, direct targeted edits, complex multi-screen changes, responsive layout, per-screen self-QA, and compile-error convergence. Trigger on requests to create, build, generate, modify, update, change, fix, or edit a Canvas App or .pa.yaml files.
author: Microsoft Corporation
user-invocable: true
-allowed-tools: Read, Write, Edit, Bash, AskUserQuestion, Task, TaskCreate, TaskUpdate, TaskList, EnterPlanMode, ExitPlanMode, mcp__canvas-authoring__sync_canvas, mcp__canvas-authoring__compile_canvas, mcp__canvas-authoring__describe_control
+allowed-tools: Read, Write, Edit, apply_patch, Bash, AskUserQuestion, Task, TaskCreate, TaskUpdate, TaskList, EnterPlanMode, ExitPlanMode, mcp__canvas-authoring__sync_canvas, mcp__canvas-authoring__compile_canvas, mcp__canvas-authoring__list_controls, mcp__canvas-authoring__describe_control, mcp__canvas-authoring__list_apis, mcp__canvas-authoring__describe_api, mcp__canvas-authoring__list_data_sources, mcp__canvas-authoring__get_data_source_schema
+
---
+
+
# Create or Edit a Canvas App
Create or edit a Power Apps canvas app for:
@@ -17,15 +20,27 @@ $ARGUMENTS
Canvas Authoring tools operate on a local directory containing the app YAML.
-1. Reuse the current directory when it already contains `App.pa.yaml`.
-2. Otherwise, reuse the single immediate child directory containing `App.pa.yaml`, when
- exactly one exists.
-3. Otherwise, derive a short kebab-case folder name from the app name or requirements,
- create it with `Bash`, and resolve its absolute path.
-4. Call `sync_canvas` with that absolute working directory before reading or editing app
- files. Do not proceed if sync fails.
+1. Treat `${PLUGIN_ROOT}` as immutable runtime provenance. Never derive it from the
+ current directory, app workspace, repository root, or a sibling worktree.
+2. Read `${PLUGIN_ROOT}/references/QAChecks.md` and require
+ `QACHK-SHARED-SOURCE-DERIVATION`. If the check fails, stop with the observed path; do
+ not mix prompt generations.
+3. Reuse the current directory when it already contains `App.pa.yaml` and every existing
+ file in that directory is a `.pa.yaml` file.
+4. Otherwise, reuse the single immediate child directory containing `App.pa.yaml`, when
+ exactly one exists and every existing file in it is a `.pa.yaml` file.
+5. Otherwise, derive a short kebab-case folder name from the app name or requirements,
+ create a new empty directory with `Bash`, and resolve its absolute path. If that name
+ already exists and contains non-YAML files, choose a fresh suffixed name rather than
+ synchronizing into it.
+6. Call `sync_canvas` with that absolute working directory before reading or editing app
+ files. The directory must be dedicated to this app and contain no non-`.pa.yaml` files
+ when synchronization starts; never pass the repository root or `${PLUGIN_ROOT}`. Do not
+ call `sync_canvas` against the working directory again after planning or acceptance
+ documents have been created there. Do not proceed if the initial sync fails.
+
+Always use absolute paths for app files.
-Always use absolute paths for app files. Never edit `_EditorState.pa.yaml`; Studio owns it.
## Route the Request
@@ -48,54 +63,109 @@ CREATE and complex EDIT workflows return here after the planner finishes.
2. Verify its `## Requirement Coverage` table maps every concrete requested noun and
interaction to a visible affordance. Any approximation must be explicit and must not
use UI copy that claims the unavailable interaction is exact.
-3. Verify its `## Action Contracts` table:
- - Every requested or approved action has its own row and reachable entry point.
- - Create, edit, delete, search, filter, approve, reject, period, and export behaviors
- are not collapsed into vague combined rows.
- - When review distinguishes approved and rejected outcomes, Approve and Reject/Decline
- have separate contracts owned by the same eligible record surface.
- - Every mutation names an observable bound result, not only a confirmation message.
- - Every mutation declares a write set and receipt proof set. For create/edit, reject the
- plan when any user-entered or user-selected write-set field is absent from the proof set.
- - Supporting setup actions exist when required to exercise an explicitly requested
- lifecycle, relationship, comparison, or ranking.
- - Role-scoped management of all primary records includes separate visible select/edit/save
- and remove/cancel paths, not only review or status controls.
- - Create/edit contracts define required inputs, directly selectable finite choices,
- stable identity, edit prepopulation, cancel/reset behavior, and post-save evidence.
- - Every row names a precondition, source and stable identity, exact transition and
- postcondition, observer reading that source, and visible evidence.
-4. Verify its `## Functional Test Matrix`:
- - Every Action Contract has at least one deterministic Given/When/Then success row.
- - Every required invalid, blocked, empty, clear/reset, or boundary path has a row.
- - Every `Then` names a source postcondition and an evidence surface that reads it.
- - Local/mock scenarios use concrete seeded IDs and values. Filter scenarios include at
- least two matching records and one non-matching record.
- - EDIT scenarios cover existing behavior touched by changed sources, fields, controls,
- or observer formulas.
-5. Verify its `## Dispatch` table:
- - Every row has `Action`, `Screen`, `Target File`, `YAML Key`, `Name Prefix`, and
- `Screen Brief`.
- - CREATE rows use `Create`; EDIT rows use `Modify` or `Create`.
- - Target files and screen briefs are absolute paths under `[working directory]`.
- - No two rows target the same file.
- - No two rows share a `Name Prefix`.
- - In CREATE mode the first row targets `[working directory]/Screen1.pa.yaml` with YAML key `Screen1`.
- - `## Editor State Changes` exists and contains exact final order lists or `None`.
-6. Confirm `[working directory]/canvas-app-shared.md` and every dispatch row's `Screen Brief` exists.
+3. When the app contains record cards, rows, lists, or details, verify its
+ `## Required Record Fields` table has one stable key for the canonical identity and
+ every field the requirements say users must see. Reject a time-only, identity-only, or
+ action-only surface when additional title, person, time, description, status, or other
+ values are requested.
+4. Verify its `## Action Contracts` table:
+ - Every requested or approved action has its own row and reachable entry point.
+ - Create, edit, delete, search, filter, approve, reject, period, and export behaviors
+ are not collapsed into vague combined rows.
+ - When review distinguishes approved and rejected outcomes, Approve and Reject/Decline
+ have separate contracts owned by the same eligible record surface.
+ - Opposing transitions such as Receive/Issue, Increase/Decrease, Credit/Debit,
+ Allocate/Release, Check-in/Check-out, and Enable/Disable have separate contracts even
+ when one shared form implements both.
+ - When opposing actions use a shared-operation flow — directional selector events
+ commit operation state and a distinct guarded event consumes that state to mutate —
+ each selector is selection-only and that distinct event is the single mutation entry
+ point, regardless of control name or label. Both contracts name that same mutation
+ event and operation state. A selector that calls `Patch`, `SubmitForm`, `Collect`,
+ `Remove`, `RemoveIf`, `UpdateIf`, or a connector mutation is invalid. Separate
+ direct-action controls remain valid when no distinct shared mutation event exists
+ and each action has its own selected-ID and amount eligibility gates. Their control
+ identity commits direction, so they need no shared operation variable/reset.
+ - Every mutation names an observable bound result, not only a confirmation message.
+ - Every mutation declares a write set and receipt proof set. For create/edit, reject the
+ plan when any user-entered or user-selected write-set field is absent from the proof set.
+ - Every mutation has an additive lifecycle row naming its receipt, canonical source,
+ requested destination, same stable ID, and exact synchronization/focus behavior when
+ the destination differs or contains multiple records.
+ - Every mutation has a Changed/Preserved field ledger. Changed rows match handler
+ writes and receipt proofs one-for-one; Preserved rows retain canonical pre-state and
+ name post-state evidence.
+ - Conditional stable-ID continuation exists only when create feeds a later edit,
+ delete, relationship, approval, or transition. It binds that action to the returned
+ create ID and clears continuation state on downstream completion or cancellation.
+ - Every plan-declared state-driven UI surface names the surface control and its exact
+ state predicate. Recognize either the dedicated table or an exact
+ `Surface.Visible=state predicate` Action Contract observer. Do not add rows for
+ always-visible surfaces, child-only visibility, navigation-based disclosure, or
+ visibility not declared by the plan.
+ - Supporting setup actions exist when required to exercise an explicitly requested
+ lifecycle, relationship, comparison, or ranking.
+ - Role-scoped management of all primary records includes separate visible select/edit/save
+ and remove/cancel paths, not only review or status controls.
+ - Create/edit contracts define required inputs, directly selectable finite choices,
+ stable identity, edit prepopulation, cancel/reset behavior, and post-save evidence.
+ - Every row names a precondition, source and stable identity, exact transition and
+ postcondition, observer reading that source, and visible evidence.
+5. Verify its `## Functional Test Matrix`:
+ - Every Action Contract has at least one deterministic Given/When/Then success row.
+ - Every required invalid, blocked, empty, clear/reset, or boundary path has a row.
+ - Every direction of an opposing pair has its own concrete scenario with explicit old
+ value/state, selected operation, amount when applicable, and expected new value/state.
+ - Every `Then` names a source postcondition and an evidence surface that reads it.
+ - Local/mock scenarios use concrete seeded IDs and values. Filter scenarios include at
+ least two matching records and one non-matching record.
+ - EDIT scenarios cover existing behavior touched by changed sources, fields, controls,
+ or observer formulas.
+ - When a continuation contract is present, scenarios cover the returned-ID-bound
+ downstream completion and non-mutating cancellation paths, including
+ continuation-state clear.
+6. When the plan contains an opposing directional pair, require `## Directional Mutation
+ Evidence` before dispatch. It must state a nullable selected-ID state with blank reset
+ and row assignment, the actual operation state with an entry/success `Blank()` reset
+ event, representable blank/non-positive amount bindings, a disabled invalid submission
+ gate, exact final formulas for both directions, a canonical-source observer, and receipt
+ bindings for operation, old value, amount, expected value, and actual persisted value.
+ For a shared-operation flow, the plan must also identify each selection-only binding,
+ the common guarded mutation event, and their common operation state.
+7. Verify its `## Dispatch` table:
+ - Every row has `Action`, `Screen`, `Target File`, `YAML Key`, `Name Prefix`, and
+ `Screen Brief`.
+ - CREATE rows use `Create`; EDIT rows use `Modify` or `Create`.
+ - Target files and screen briefs are absolute paths under `[working directory]`.
+ - No two rows target the same file.
+ - No two rows share a `Name Prefix`.
+ - In CREATE mode the first row targets `[working directory]/Screen1.pa.yaml` with YAML key `Screen1`.
+ - `## Editor State Changes` exists and contains exact final order lists or `None`.
+8. Confirm `[working directory]/canvas-app-shared.md` and every dispatch row's `Screen Brief` exists.
Verify each brief's assignment matches its dispatch row and includes every Action
Contract owned by that screen under `## Required Actions` and every scenario it
- exercises under `## Functional Test Scenarios`.
-7. In EDIT mode, apply the `### Before builders` group of `## App Changes` to
+ exercises under `## Functional Test Scenarios`. It also includes every
+ `## Required Record Fields` row owned by that screen with an exact bound control,
+ formula, hierarchy, visibility rule, and layout budget.
+9. Before dispatch, read every brief and reject it when:
+ - a used control lacks its exact creation keywords, supported input-property names, or
+ the full `Enum name:` and compile-ready enum literal required by discovery;
+ - a Required Action is only an identifier or summary instead of its complete
+ precondition, event, source/stable identity, postcondition, observer, and evidence;
+ - a Functional Test Scenario is only an identifier instead of complete
+ Given/When/Then text, boundary conditions, and expected evidence; or
+ - it contains an unresolved placeholder or delegates discovery to the builder.
+10. In EDIT mode, apply the `### Before builders` group of `## App Changes` to
`[working directory]/App.pa.yaml` now. Screens bind to those collections, formulas and variables, and
compiling them against a stale `App.pa.yaml` produces a flood of false name errors.
-8. Confirm the planner reported a clean `compile_canvas` for `[working directory]/App.pa.yaml`. If it
- did not, compile now and resolve every `App`-level diagnostic before dispatching.
- For EDIT mode, compile after applying the before-builder app changes and resolve
- App-level diagnostics before dispatching.
-9. Invoke `canvas-screen-builder` once per dispatch row, in waves of
- **at most three**. Fire the wave's invocations together in one message, wait for that
- wave to return, then dispatch the next.
+11. Call `compile_canvas` now and resolve every `App`-level diagnostic before dispatching.
+ The planner cannot validate through the top-level MCP connection. For EDIT mode,
+ compile after applying the before-builder app changes and resolve App-level
+ diagnostics before dispatching.
+12. Invoke one general-purpose agent with `Task` per dispatch row and instruct it to read
+and follow `${PLUGIN_ROOT}/agents/canvas-screen-builder.md` using the supplied
+assignment. Run these workers in waves of **at most three**. Fire each wave together,
+wait for it to return, then dispatch the next.
Never dispatch more than three builders at once. Larger fan-outs have hung without
returning, and waves of three get you the first compile sooner, which is where systemic
@@ -104,6 +174,15 @@ defects surface.
If any pre-dispatch check fails, do not start builders. Re-invoke the planner with the
specific defects and repeat the checks on the corrected artifacts.
+
+If the planner reports that writing is unavailable or denied, or returns without the
+required artifacts for that reason, write the planner's complete inline artifact payloads
+verbatim with `apply_patch`; do not redesign or rediscover them. If any payload is absent
+or cannot be written, stop and report the tooling failure.
+If the planner returns `Status: Provenance Blocked`, stop without a fallback; mixed prompt
+generations cannot produce trustworthy artifacts.
+
+
Pass each builder only:
```text
@@ -120,6 +199,7 @@ Plugin root: ${PLUGIN_ROOT}
The target file, YAML key, and name prefix are authoritative. Modify actions preserve the
key already present in the target file.
+
Compile after each wave returns, before dispatching the next. A systemic mistake in the
first wave is usually repeated in every later screen. Repair files that already exist in
place; only rows still waiting for dispatch receive corrected briefs.
@@ -127,39 +207,57 @@ place; only rows still waiting for dispatch receive corrected briefs.
A between-wave compile can report a `Navigate` target that belongs to a later wave as
unrecognized. Confirm it matches a remaining dispatch row and leave it in place.
+
After all builders finish:
-- Check each builder's `Functional:` section before accepting its `QA:` line. It must
+- Confirm every dispatched builder and every targeted self-QA follow-up has returned before
+ final validation begins. Do not leave a worker running or queued that can write after the
+ final compile.
+- Treat final validation as a one-way barrier. Before crossing it, finish every `Task`,
+ `read_agent`, builder repair, QA follow-up, inspection, and evidence update that could
+ require another workspace change. Once final validation begins, do not launch or resume
+ an agent.
+- Check each builder's `Functional:` section before accepting its QA report. It must
contain exactly one `PASS` trace per Required Action in that screen's brief, and each
trace must name the precondition, control event, source/stable-ID operation,
postcondition, and observer/evidence. A missing link, generic claim, or `BLOCKED` result
sends that screen back for targeted repair and a corrected trace; do not accept
checklist `PASS` as a substitute.
-- Check each builder's `QA:` line. It must list an outcome for every check in
- `${PLUGIN_ROOT}/references/QAChecks.md`. Treat these as unrun and send the screen back for self-QA
- only — not a rebuild — before you compile:
- - a missing or truncated `QA:` line, a line that omits any check listed in
- `${PLUGIN_ROOT}/references/QAChecks.md`, or a bare fix count;
- - an outcome that contradicts the screen structure — for example,
- `QACHK-CROSS-AXIS-ALIGNMENT` is `N/A` despite AutoLayout children,
- `QACHK-ACCESSIBLE-LABEL-MISSING` is `N/A` despite content or input controls,
- `QACHK-LOW-CONTRAST-TEXT` is `N/A` despite a non-default coloured surface, or
- `QACHK-ROOT-CONTAINMENT` is `PASS` while a responsive root has screen-level siblings;
- - `QACHK-GALLERY-ROW-FITS-CONTENT` is `N/A` despite the screen containing a Gallery;
- - `QACHK-ACTION-LABEL-FIT` is `PASS` while a multiword action directly under vertical
+- Check each builder's QA coverage, repairs, and N/A lines. Treat these as unrun and send
+ the screen back for self-QA only — not a rebuild — before you compile:
+ - missing `QA coverage: 1-44 COMPLETE`, repair, or N/A lines;
+ - any legacy `QA: 1 PASS` checklist or repair entry that does not use
+ a defined `QACHK-*` identifier followed by `FIXED(n)`;
+ - an outcome that contradicts the screen structure — for example,
+ `QACHK-CROSS-AXIS-ALIGNMENT` is `N/A` despite AutoLayout children,
+ `QACHK-ACCESSIBLE-LABEL-MISSING` is `N/A` despite content or input controls,
+ `QACHK-LOW-CONTRAST-TEXT` is `N/A` despite a non-default coloured surface, or
+ `QACHK-ROOT-CONTAINMENT` is `PASS` while a responsive root has screen-level siblings;
+ - `QACHK-GALLERY-ROW-FITS-CONTENT` is `N/A` despite the screen containing a Gallery;
+ - `QACHK-ACTION-LABEL-FIT` is `PASS` while a multiword action directly under vertical
AutoLayout lacks `Width: =Parent.Width`;
- `PASS` is valid after a complete inspection finds no defect; never reject it solely
- because the screen has many controls.
- This costs one cheap turn. The defects these checks catch — clipped headings, invisible
- buttons, placeholder cards — are invisible to `compile_canvas`, so if you skip this the
- app ships broken while reporting clean.
+ `PASS` is valid after a complete inspection finds no defect; never reject it solely
+ because the screen has many controls.
+ For `QACHK-NO-HEIGHT-TRAP`, `QACHK-GALLERY-ROW-FITS-CONTENT`,
+ `QACHK-HORIZONTAL-BUDGET`, and `QACHK-PRIMARY-ACTION-REACHABILITY`, reject bare PASS
+ claims without numeric branch evidence.
+ This costs one cheap turn. The defects these checks catch — clipped headings, invisible
+ buttons, placeholder cards — are invisible to `compile_canvas`, so if you skip this the
+ app ships broken while reporting clean.
+- If any builder says checks 42-44 are undefined, stop instead of rerunning self-QA.
+Report the guide path and highest defined check as `Status: Provenance Blocked`.
- A self-QA follow-up is not a rebuild or a screen-generation re-dispatch. Tell the
- builder to inspect and repair the existing target file, then return the corrected
- `QA:` line without regenerating the screen.
+ builder to inspect and repair the existing target file, then return the corrected QA
+ coverage, repairs, and N/A lines without regenerating the screen.
- Compare every repeated navigation block against `[working directory]/canvas-app-shared.md`: same
destination items, same order, no extra brand/label injected into one screen's nav,
and width formulas that fit the narrowest target. This is an app-wide check builders
cannot perform because each sees only one screen.
+- In CREATE mode, inspect every planned screen file and reject a root-only screen. Each
+ screen must contain at least one meaningful visible leaf control beneath its screen root;
+ the screen root and layout containers do not count. Repair any missing screen content
+ before entering final validation. A clean compile alone does not prove that the generated
+ controls reached the coauthoring session.
- Verify each `## Action Contracts` row end to end against the generated files: the entry
point is reachable, the named event is wired, and the observable result is visible
immediately after the action. For mutations, require an in-viewport receipt bound to the
@@ -168,6 +266,30 @@ After all builders finish:
every user-entered or user-selected field written by the handler needs a readable labeled
receipt binding. Navigation, a notification, hidden state, or a row somewhere in a longer
list cannot replace it. Compile success does not prove runtime usability.
+- Verify each `## Mutation Lifecycle Evidence` row against final YAML: receipt,
+ canonical-source observer, requested-destination observer, synchronization/focus, and
+ operation all retain one stable ID. If source and destination differ, synchronization
+ must occur only after mutation success and before destination evidence.
+- Verify each `## Mutation Field Ledger` row against the handler. Every Changed field has
+ write/proof parity and one labeled receipt binding. Every Preserved field comes from
+ canonical pre-state, survives by omission or exact carry-forward, and has post-state
+ evidence for the same ID.
+- When `## Continuation Contracts` exists, verify create's returned ID directly targets the
+ declared later edit/delete/relationship/approval/transition, and both completion and
+ cancellation clear continuation ID/mode. Do not require this section for create-only
+ flows.
+- When `## State-Driven Surface Visibility` exists, require one acceptance row per plan
+ key with the exact final-YAML `Surface.Visible: =state predicate` binding. Verify the
+ named surface itself implements the planned predicate or a provably equivalent Boolean
+ form. Child visibility and navigation do not satisfy the surface contract. Do not infer
+ this contract for always-visible or undeclared surfaces.
+- For opposing mutation pairs, verify both contracts and scenarios against final YAML.
+ Shared-operation selectors are selection-only, one reachable guarded event owns the
+ mutation, selected-ID and operation state are reset and consumed consistently, invalid
+ inputs disable submission, and receipt arithmetic matches the persisted result.
+ Independently gated direct-action controls remain valid when no shared mutation event
+ exists. Apply the exact control, state, guard, and formula checks from
+ `${PLUGIN_ROOT}/references/ValidationWorkflow.md`; acceptance prose never overrides final code.
- Execute every `## Functional Test Matrix` row symbolically against the final formulas.
Confirm the Given state makes the entry point eligible, the When event targets the
declared source and stable ID, the Then values follow from the operation, and the
@@ -176,6 +298,19 @@ After all builders finish:
- For every primary-record list, verify each row or its immediately reachable detail renders
the canonical human-readable identity as full visible text. Avatar initials, icons,
record IDs, accessible labels, or evaluator inference cannot replace the identity.
+- Verify every `## Required Record Fields` row against final YAML. The named control must
+ exist inside the declared record surface, bind the current record's required source
+ field, and remain visible, non-zero-sized, readable, and inside the card or row in the
+ normal desktop and phone layouts. Repair missing, hidden, blank, clipped, or displaced
+ fields, then compile and repeat this field check before writing acceptance evidence.
+- Verify numeric layout evidence proves required record fields, actions, inputs, receipts,
+ Gallery rows, and fixed-height or horizontal branches fit their reachable desktop and
+ phone layouts. Static budgets do not replace post-export runtime proof for list rows and
+ row actions. Apply the exact containment, sizing, breakpoint, and scrolling rules from
+ `${PLUGIN_ROOT}/references/QAChecks.md` and `${PLUGIN_ROOT}/references/ValidationWorkflow.md`.
+- Require persistent human-readable visible labels for accepted data-entry controls,
+ including controls on state-driven surfaces, and record the corresponding Data Entry
+ Label Evidence from `${PLUGIN_ROOT}/references/ValidationWorkflow.md`.
- When Approve and Reject/Decline are paired contracts, verify every eligible pending record
exposes both decisions on the same row or the same immediately reachable detail at phone
width. Send the owning screen back when either decision is missing; never accept a
@@ -190,13 +325,17 @@ After all builders finish:
- Reject `QACHK-CARD-PLACEHOLDER` `PASS` when a ModernCard displays Title, Subtitle and
Description with `Height < 180`; send that screen back for self-QA.
- If a builder returns `Status: Blocked`, re-invoke the planner to correct that screen
- brief, then rerun only the affected builder. Never ask a builder to guess missing
- definitions.
-- `Status: Blocked` is the **only** reason to rerun screen generation from a brief.
- Compile diagnostics are not. Once a screen file exists you repair it in place with
- targeted edits. Re-running generation rewrites the whole screen from scratch, discards
- the fixes already applied, and produces a fresh crop of defects. That loop does not
- converge.
+brief, then rerun only the affected builder. Never ask a builder to guess missing
+definitions.
+- If a general-purpose screen worker cannot write its target, stop and report the exact
+ tooling failure. Do not retry with a custom screen builder whose write restriction is
+ already known.
+- If a builder returns `Status: Provenance Blocked`, stop the wave without a fallback and
+ report the mismatched plugin root or contract version.
+- `Status: Blocked` is the **only** reason to repair a brief and rerun its specialist
+generation. Tooling failures stop the run. Compile diagnostics trigger neither path.
+Once a screen file exists, repair it in place with targeted edits; regenerating it
+discards prior fixes and does not converge.
- In EDIT mode, apply the `### After builders` group of `## App Changes` in
`[working directory]/canvas-app-plan.md` to `[working directory]/App.pa.yaml`. The `### Before builders` group was
already applied at pre-dispatch. If a group says `None`, do not edit the file for it.
@@ -205,6 +344,13 @@ After all builders finish:
`[working directory]/_EditorState.pa.yaml` after all builders finish. If it says `None`, leave the
file unchanged.
- Read `${PLUGIN_ROOT}/references/ValidationWorkflow.md` and follow it.
+- Complete every app, planning, and acceptance-artifact write before the final compile.
+ The final successful `compile_canvas` must occur after the last `edit`, `create`, or
+ `apply_patch` and must be the final tool call before the summary. After it succeeds,
+ return the summary immediately without calling `Task`, `read_agent`, `view`, `glob`,
+ `rg`, `Bash`, another MCP tool, or any other tool. If any later tool call, delegation,
+ write, inspection, or repair occurs, the compile is no longer final: finish that work,
+ wait for every agent, and repeat the final generation-proof gate.
## Shared Invariants
@@ -236,8 +382,12 @@ After all builders finish:
9. Builders own exactly one screen file. The planner owns CREATE-mode `App.pa.yaml`.
The orchestrator owns EDIT-mode `App.pa.yaml`.
10. Compile early and often. `App.pa.yaml` is validated before builders are dispatched,
- and again as soon as the first builder returns. Never defer the first compile until
- every file is written.
-11. Do not report completion until the workspace compiles clean and the functional
- conformance gate passes, or remaining compile and functional defects are explicitly
- reported.
+ and again as soon as the first builder returns. Never defer the first compile until
+ every file is written.
+11. Compile after each builder wave.
+12. Do not report completion until the workspace compiles clean, every Action Contract has
+ a passing evidence row in `[working directory]/canvas-app-acceptance.md`, and no app YAML mutation
+ occurred after the final successful compile.
+13. Require only prompt- or approved-plan-derived actions. Treat role-scoped management of
+ primary records as a lifecycle requirement, but do not add universal CRUD to every
+ entity.