Companion film
Strict by dimension
Try to combine incompatible currencies, see Grid stop the mismatch, then make the conversion explicit.
19 secGrid 0.61.0
Open film page →Guided build · 04
Separate failed business checks from error values and compiler diagnostics, then add explicit recovery and guarded write contracts.
You will finish with: A defensive text-processing model plus an expense model whose invalid inputs fail visibly without replacing valid state.
You will diagnose four different outcomes: a business rule that returns false, a formula error value, a strictness failure, and a rejected input write. Each needs a different repair.
Open the practice model above or the canonical Text And Quality example. Its parsing layer is:
A4 = REGEXMATCH(A1, A3)
A5 = REGEXEXTRACT(A1, /INV-(\d+)/)
A6 = REGEXREPLACE(A2, /owner:\w+/, "owner:shared")
A7 = WILDCARDMATCH(A1, glob"INV-*-001")
Checkpoint:
A4 = TRUE,A5 = "2026",A6 = "priority:urgent owner:shared", andA7 = TRUE.
The downstream cells settle at B1 = :accepted, B2 = "current", B3 = 0, and B4 = "unassigned".
Temporarily change only the wildcard in A7:
A7 = WILDCARDMATCH(A1, glob"PO-*-001")
Checkpoint:
A7 = FALSEandB1 = :rejected;A4remainsTRUE,A5remains"2026", andB2remains"current".
Nothing crashed. The model computed a valid negative business result. Restore the original wildcard before continuing.
Replace the guarded formula temporarily:
B3 = 10 / 0
Checkpoint:
B3 = #DIV/0!.
An error is a value and propagates unless a formula handles it. Restore the intended boundary:
B3 = TRY 10 / 0 ELSE 0
Checkpoint:
B3 = 0.
The fallback is policy. It should be visible in source rather than inferred from a blank display.
Add this temporary binding:
C1 = "5" + 3
In the default loose mode, C1 = 8. Add coercion strict after the model header directives.
Checkpoint:
C1 = #TYPE!because the arithmetic requires text-to-number coercion.
Repair the assumption explicitly:
C1 = VALUE("5") + 3
Checkpoint:
C1 = 8undercoercion strict.
Remove the temporary binding and directive before moving to the canonical validation model.
Open Cell Metadata & Validation. Its guarded inputs include:
input UnitPrice = 40
VALIDATE BETWEEN 0 AND 500 MESSAGE "Unit price must be between $0 and $500."
input Category = "travel"
VALIDATE IN ["travel", "software", "meals", "hardware"] MESSAGE "Pick an approved expense category."
input InvoiceRef = "INV-1042"
VALIDATE STARTS WITH "INV-" MESSAGE "Invoice references begin with INV-."
Baseline checkpoint:
Subtotal = 120,BudgetShare = 0.005,NetAmount = 114, andApprovalStatus = "auto-approved".
Try writing 600 to UnitPrice, "office" to Category, and "1042" to InvoiceRef.
Checkpoint: each write returns its authored message and leaves
UnitPrice = 40,Category = "travel", andInvoiceRef = "INV-1042".
A validation rejection is neither a formula error nor a compiler failure. The stored state remains valid.
Temporarily change the declaration to:
input Units = 60 VALIDATE 1..48
Checkpoint: diagnostics include
GRID_VALIDATE_UNSATISFIABLEbecause the authored default violates its own contract.
Restore Units = 3.
In Text And Quality, set A1 = "INV-2025-099" without changing either pattern.
Checkpoint:
A4 = TRUE,A5 = "2025",A7 = FALSE,B1 = :rejected, andB2 = "legacy". Explain why the regex and wildcard answer different questions.
In Cell Metadata & Validation, make valid writes Units = 48 and UnitPrice = 120.
Checkpoint:
Subtotal = 5,760,BudgetShare = 0.24,NetAmount = 5,472, andApprovalStatus = "needs-approval".