← All guided builds

Guided build · 15

Explain and validate a decision

Trace a decision to its inputs, compare revisions, quantify uncertainty, and reject invalid writes.

You will finish with: An auditable margin decision with history, explanation, validation, and declared presentation.

25 minIntermediateSource checked for Grid 0.61.0Reviewed 2026-08-24
Related canonical example08-truth-inspector.grid
Get Grid
Practice modelexplainable-margin-practice.gridA unit-safe decision cone without history, rules, or inspector-specific outputs.

Watch it in Grid

See the workflow before you build it.

Follow the finished interaction, then use the written steps below to build and inspect it yourself.

Companion film

Ask WHY

Select a result, reveal its formula, and trace the evaluated lineage behind the number.

17 secGrid 0.61.0
Open film page
On this page

What you will build

An auditable decision model with unit-safe arithmetic, dependency explanation, saved history, quantified uncertainty, guarded inputs, and declared presentation.

You will use two canonical models. Truth Inspector demonstrates how to ask why a result moved. Cell Metadata & Validation demonstrates how the model controls what may be written and how values should appear.

1. Establish the decision

Open the Truth Inspector example and follow its core path:

B1 = A2 * A3
B2 = A1 + B1
C1 = B2 * A4 - A5
C2 = C1 / B2
C3 = C2 > 0.45 THEN "healthy-margin" ELSE "watch-margin"

The model translates euro revenue, combines it with domestic revenue, calculates operating profit and margin, then classifies the result.

Binding Baseline
B2 170,360 USD
C1 90,623.20 USD
C2 approximately 0.53195
C3 "healthy-margin"

2. Ask why

Select C3 and use Grid’s Why or dependency-inspection action. Inspect C1 next.

The explanation should travel from C3 to C2, then through profit and translated revenue to the inputs A1:A5. WHY is an inspection request over evaluated state; do not add a WHY(C3) formula to the workbook.

Checkpoint: you can identify the margin ratio and fixed cost as direct decision drivers, and the two revenue inputs plus exchange rate as upstream drivers.

3. Create a decision-changing revision

Save the baseline, then change gross margin ratio A4 from 0.62 to 0.50.

Binding Revised value
C1 70,180 USD
C2 approximately 0.41195
C3 "watch-margin"
F1 "margin-escalation" after the rule fires

Use the history inspector or a previous-revision reference such as C1@-1 to compare the current result with 90,623.20 USD from the saved baseline.

History must exist before an AS_OF or previous-revision demonstration can work. The model cannot explain a revision that was never committed.

4. Keep uncertainty separate from the point estimate

D3 = PROPAGATE_UNCERTAINTY([B2, -1], [A6, A7])

At the baseline inputs, D3 is approximately 14,517.03. It describes propagated uncertainty around profit without replacing the profit formula or its status decision.

Change A6 or A7. The uncertainty band should move while the point-estimate path remains legible and independently inspectable.

5. Add write contracts

Open the Cell Metadata & Validation example. Try these invalid edits:

  • UnitPrice = 600
  • Category = "office"
  • InvoiceRef = "1042"

Each write should return the authored validation message and leave the stored value unchanged.

At the original inputs, the model should show:

Binding Expected value
Subtotal 120
BudgetShare 0.005
NetAmount 114
ApprovalStatus "auto-approved"

On an input, VALIDATE is a write contract. On a computed cell, it is a compile-time assertion. Those are related ideas with intentionally different enforcement moments.

6. Inspect proofs and presentation layers

The compiler can prove the Subtotal and BudgetShare assertions from the bounded inputs. Toggle AuditMode and observe formatting without changing the underlying values:

  • NetAmount switches from two to four decimal places.
  • DiscountRate switches from the tag policy to the rule override.
  • Turning Audit Mode off runs RESET FORMAT, revealing the declared policy again.

Presentation changes should never masquerade as computational changes.

Try it yourself

Within the valid bounds, set Units = 48 and UnitPrice = 120.

Checkpoint: Subtotal = 5,760, NetAmount = 5,472, and ApprovalStatus = "needs-approval".

Use Why on ApprovalStatus, then compare NetAmount with its prior revision. Write one sentence that names the changed inputs, the affected calculation, and the decision consequence.

You are done when

  • You can trace a decision to its inputs.
  • You can compare current and saved state.
  • Invalid writes fail without corrupting the model.
  • You can distinguish value, uncertainty, validation, and formatting.
Build statusReached the expected checkpoint?