Skip to content

Pin the form edition per row

The escalation boundaryDashboardHTTPSDKCLIMCPconditionalschemaVersionlt_role_schemas

Each row renders and validates against the form version its code was written for, while the role's form keeps evolving.

The situation

The inspection form gains a lotNumber field next week. Rows created today were written by code that expects the old shape, and they should keep rendering the old form until they close.

The recipe

workflows/inspect-lot.ts
const result = await conditional<{ pass: boolean; lotNumber: string }>(signalId, {
role: 'inspection',
description: 'Inspect the lot',
metadata: { orderId },
schemaVersion: 3,
});
Save and inspect versions
ltc roles save-schema inspection --file inspection.json --summary "Added lotNumber"
ltc roles schema-versions inspection
ltc roles schema inspection --version 3

Every save that changes a role’s form_schema appends an immutable snapshot to lt_role_schemas and advances the current version. schemaVersion pins one snapshot to the row as metadata.schema_version.

The guarantee

A pinned row renders and validates against that snapshot regardless of later edits. A pin that names a missing version fails at creation with a 400 rather than falling through to another version. Unpinned rows use the latest form. The pin is a facet, so “rows still on v3” is a containment query. See Forms.