WorkSpec v2.0 Validation & Errors
WorkSpec is designed to be validation-first. Validators should provide precise, actionable feedback before a document is executed or simulated.
WorkSpec is designed to be validation-first. Validators should provide precise, actionable feedback before a document is executed or simulated.
This page defines the error format and the core validation rules required for v2.0.
See also:
- Error code reference: /docs/workspec/reference/errors
- JSON Schema: /docs/workspec/specification/v2.0/schema
Problem Details (RFC 7807)¶
All validation results are represented using RFC 7807 Problem Details with WorkSpec extensions.
{
"type": "https://universalautomation.wiki/workspec/errors/{category}/{specific}",
"title": "Human-Readable Title",
"severity": "error",
"detail": "Detailed explanation of what went wrong.",
"instance": "/simulation/path/to/problem",
"metric_id": "schema.integrity.missing_version",
"context": {
"relevant": "data"
},
"suggestions": [
"First suggested fix",
"Second suggested fix"
],
"doc_uri": "https://universalautomation.wiki/workspec/docs/errors/{specific}"
}
Required fields¶
| Field | Type | Required | Meaning |
|---|---|---|---|
type |
URI | Yes | Error type identifier |
title |
string | Yes | Short, human-readable title |
severity |
enum | Yes | error | warning | info |
detail |
string | Yes | Full explanation |
instance |
JSON Pointer | Yes | Pointer to the exact location in the document |
metric_id |
string | Yes | Validation metric identifier |
context |
object | Yes | Structured debugging data |
suggestions |
string[] | Yes | Fix suggestions |
doc_uri |
URI | No | Documentation link |
Severity semantics¶
| Severity | Meaning | Blocks execution |
|---|---|---|
error |
Invalid document | Yes |
warning |
Suspicious but allowed | No |
info |
Optimization or note | No |
Example error (invalid time)¶
{
"type": "https://universalautomation.wiki/workspec/errors/invalid-time-format",
"title": "Invalid Time Format",
"severity": "error",
"detail": "Task 'proof_dough' has invalid start time '07:60'. Minutes must be 00-59.",
"instance": "/simulation/process/tasks/2/start",
"metric_id": "task.integrity.invalid_start_time",
"context": {
"task_id": "proof_dough",
"field": "start",
"value": "07:60"
},
"suggestions": [
"Change to '08:00' if you meant 8:00 AM",
"Change to '07:59' if you meant 7:59 AM"
]
}
Metric IDs¶
Metric IDs are namespaced:
{domain}.{category}.{specific}
Domains used in WorkSpec validation include:
schema— structural correctnessobject— object-level issuestask— task-level issuesresource— resource flowtemporal— scheduling/dependencieseconomic— costs/revenue/profitabilityspatial— layout/location referencesrecipe— recipe compliancecustom— user-defined metrics
Required validation rules (v2.0)¶
This list describes the core rules a v2.0 validator must enforce.
Schema rules¶
simulationmust exist.simulation.schema_versionmust exist and match supported versions (v2.0:"2.0").- Document structure must include
simulation.worldandsimulation.process. simulation.world.objectsmust be an array.simulation.process.tasksmust be an array.simulation.metamust exist and include required v2 fields (title,description,domain).meta.article_titlemust not be present.
Object rules¶
- Objects must include required fields:
id,type,name. - Object IDs must follow the ID rules (including optional
{type}:{id}namespacing). - Disallowed type aliases (
material,ingredient,tool) must be rejected. - Reserved type names must be rejected.
- Custom types must have corresponding
simulation.type_definitionsentries and validextends. locationvalues must reference a valid location if a layout is present.
Task rules¶
- Tasks must include required fields:
id,actor_id,start,duration. actor_idmust reference a valid performer object.- Task
startmust be valid and strictly formatted. - Task
durationmust be valid (integer, ISO 8601 duration, or shorthand). depends_onmust reference valid task ids and must not contain cycles.- Dependency timing must be respected (task cannot start before dependency condition is met).
Interaction rules¶
target_idis required for property-change interactions and delete interactions.property_changesis required for property-change interactions.objectis required for create interactions.- Legacy interaction fields
object_idandrevert_aftermust be rejected. - References to deleted objects must be rejected.
Recipe rules (optional; warnings)¶
If recipes are provided under simulation.process.recipes, a validator may check recipe compliance:
- When a task produces a product (positive quantity delta), check for
recipes[product_id]. - If a recipe exists, verify that required inputs are consumed by that task.
- Missing inputs produce a warning, not an error.
Recipe schema details (inputs/equipment/output quantity/process time) live in:
Time format validation (strict)¶
Time strings must be strict and zero-padded:
HH:MMwhereHHis00–23andMMis00–59HH:MM:SSwhereSSis00–59
Invalid times (example: "07:60", "9:30") must be rejected (not corrected).