Praxis Visual Builder JSON Logic Round Trip
Use this skill for JSON Logic conditions and import/export stability in @praxisui/visual-builder. JSON Logic is the canonical persisted condition contract for new authoring; JavaScript expressions and legacy textual DSL are not baseline payloads.
Pair it with:
praxis-visual-builder-graph-runtime for RuleBuilderState, node identity, graph edges, validation errors, and registry integrity.
praxis-visual-builder-schemas-templates for field schemas, target property schemas, template-compatible rules, and context variables.
praxis-visual-builder-ai-validation for manifest operation condition.set, effect.set, and dsl.roundTrip.validate.
praxis-form-ai-rules-validation when exported form rules materialize in dynamic-form behavior.
praxis-manual-form-rules-agentic when FormLayoutRule JSON Logic is authored or round-tripped through manual-form formRules/formRulesState.
praxis-core-runtime-contracts when shared JsonLogicExpression, JsonLogicValue, FormLayoutRule, or RULE_PROPERTY_SCHEMA contracts change.
Source Audit
Before editing round-trip behavior, inspect:
projects/praxis-visual-builder/AGENTS.md
projects/praxis-visual-builder/README.md
projects/praxis-visual-builder/src/public-api.ts
projects/praxis-visual-builder/src/lib/models/rule-builder.model.ts
projects/praxis-visual-builder/src/lib/services/rule-builder.service.ts
projects/praxis-visual-builder/src/lib/ai/praxis-visual-builder-authoring-manifest.ts
- round-trip specs and rule-builder service specs
Inspect @praxisui/core contracts when a change touches JsonLogicExpression, FormLayoutRule, target property schema, or property sanitization.
Canonical Boundary
RuleBuilderService owns the supported conversions:
- builder-state import from
{ nodes, rootNodes } or nested builderState;
- form-rule import from
FormLayoutRule[] or { formRules };
- JSON export as
{ formRules, builderState };
currentJSON projection from the visual graph;
- condition-only import through
loadFromConditionExpression(...);
- condition export through
buildConditionExpressionFromGraph(...);
- validation of graph structure and supported node configs before persistence.
The exported ExportOptions advertises json, typescript, and form-config, but the current service only implements JSON export. Do not document or rely on TypeScript/form-config export as finished runtime behavior unless code and tests are completed in the same change.
JSON Logic Rules
- Persist conditions as JSON Logic objects or
null, not JavaScript strings.
- Treat
RuleNodeType.EXPRESSION and ExpressionConfig.expression as legacy textual expression support, not the preferred contract for new authoring.
- Field conditions can serialize literal comparisons and field-to-field comparisons when they map to supported JSON Logic operators.
valueType: "context" and valueType: "function" currently produce validation errors because they do not yet have canonical JSON Logic serialization in the visual builder.
- Boolean groups must preserve supported operator semantics and child order where order affects meaning.
propertyRule conditions can use inline JSON Logic or conditionNodeId, but both must validate against graph state and export deterministically.
buildConditionExpressionFromGraph(...) and import paths must be treated as a semantic round trip, not as string formatting.
Preserve the original inline condition when a partial visual import cannot reconstruct it
exactly, including unsupported operators or children and root-data var: ""; visual limitations
must not erase valid runtime semantics. Build condition projections purely from fresh graph
nodes/rootNodes; absent or stale currentJSON and cached diagnostics are not semantic input.
After initialization, accept external initialRules replacements through the canonical importer,
including same-ID and empty documents, without treating equivalent echoes as new history. Inspect
rule-definition.component.spec.ts, rule-editor.component.spec.ts, and
rule-builder.service.spec.ts; for Form bridges also prove exact-expression preservation in
utils/rule-converters.spec.ts and runtime-only diagnostics in the host.
Inventory Before New Contract
Classify requested additions:
ja-suportado-so-ux: JSON Logic exists but the editor, preview, error message, or validation result is not visible enough.
ja-suportado-mal-nomeado-ou-mal-materializado: a host calls the contract “DSL”, “expression”, or “script” while the actual supported payload is JSON Logic.
suportado-parcialmente: the model exposes a node or value type, but parse/export/validation/docs do not fully support it yet.
lacuna-real-de-contrato: no supported JSON Logic representation, parser branch, validation rule, core type, or form-rule materialization can express the condition.
Only a real contract gap justifies adding operators, operands, or exported types. If context variables or custom functions are needed as condition operands, define the canonical JSON Logic shape and consumers before authoring local UI behavior.
Validation
Use focused local gates:
rule-builder.service.spec.ts for import/export and validation behavior;
- round-trip specs for JSON Logic condition graphs;
field-condition-editor.component.spec.ts when editor controls or operator support changes;
- property-effect specs when conditions are attached to effects;
- AI manifest specs when
dsl.roundTrip.validate, condition.set, or failure modes change;
npm run build:praxis-visual-builder for public model or export changes.
Every completed issue should state whether JSON export, import back, graph validation, semantic drift detection, and dynamic-form/form-rule materialization were actually tested.
1---2name: praxis-visual-builder-jsonlogic-roundtrip3description: "Use when Codex must implement, audit, or consume @praxisui/visual-builder JSON Logic authoring: RuleBuilderService import/export, currentJSON, loadFromConditionExpression, buildConditionExpressionFromGraph, JSON/form-config payloads, FormLayoutRule bridge, field-to-field conditions, unsupported context/function operands, legacy expression safeguards, dsl.roundTrip.validate, or visual/textual round-trip stability."4metadata:5 source: https://skillmd.com/skills/codexrodrigues/praxis-visual-builder-jsonlogic-roundtrip6---78# Praxis Visual Builder JSON Logic Round Trip910Use this skill for JSON Logic conditions and import/export stability in `@praxisui/visual-builder`. JSON Logic is the canonical persisted condition contract for new authoring; JavaScript expressions and legacy textual DSL are not baseline payloads.1112Pair it with:1314- `praxis-visual-builder-graph-runtime` for `RuleBuilderState`, node identity, graph edges, validation errors, and registry integrity.15- `praxis-visual-builder-schemas-templates` for field schemas, target property schemas, template-compatible rules, and context variables.16- `praxis-visual-builder-ai-validation` for manifest operation `condition.set`, `effect.set`, and `dsl.roundTrip.validate`.17- `praxis-form-ai-rules-validation` when exported form rules materialize in dynamic-form behavior.18- `praxis-manual-form-rules-agentic` when `FormLayoutRule` JSON Logic is authored or round-tripped through manual-form `formRules`/`formRulesState`.19- `praxis-core-runtime-contracts` when shared `JsonLogicExpression`, `JsonLogicValue`, `FormLayoutRule`, or `RULE_PROPERTY_SCHEMA` contracts change.2021## Source Audit2223Before editing round-trip behavior, inspect:2425- `projects/praxis-visual-builder/AGENTS.md`26- `projects/praxis-visual-builder/README.md`27- `projects/praxis-visual-builder/src/public-api.ts`28- `projects/praxis-visual-builder/src/lib/models/rule-builder.model.ts`29- `projects/praxis-visual-builder/src/lib/services/rule-builder.service.ts`30- `projects/praxis-visual-builder/src/lib/ai/praxis-visual-builder-authoring-manifest.ts`31- round-trip specs and rule-builder service specs3233Inspect `@praxisui/core` contracts when a change touches `JsonLogicExpression`, `FormLayoutRule`, target property schema, or property sanitization.3435## Canonical Boundary3637`RuleBuilderService` owns the supported conversions:3839- builder-state import from `{ nodes, rootNodes }` or nested `builderState`;40- form-rule import from `FormLayoutRule[]` or `{ formRules }`;41- JSON export as `{ formRules, builderState }`;42- `currentJSON` projection from the visual graph;43- condition-only import through `loadFromConditionExpression(...)`;44- condition export through `buildConditionExpressionFromGraph(...)`;45- validation of graph structure and supported node configs before persistence.4647The exported `ExportOptions` advertises `json`, `typescript`, and `form-config`, but the current service only implements JSON export. Do not document or rely on TypeScript/form-config export as finished runtime behavior unless code and tests are completed in the same change.4849## JSON Logic Rules5051- Persist conditions as JSON Logic objects or `null`, not JavaScript strings.52- Treat `RuleNodeType.EXPRESSION` and `ExpressionConfig.expression` as legacy textual expression support, not the preferred contract for new authoring.53- Field conditions can serialize literal comparisons and field-to-field comparisons when they map to supported JSON Logic operators.54- `valueType: "context"` and `valueType: "function"` currently produce validation errors because they do not yet have canonical JSON Logic serialization in the visual builder.55- Boolean groups must preserve supported operator semantics and child order where order affects meaning.56- `propertyRule` conditions can use inline JSON Logic or `conditionNodeId`, but both must validate against graph state and export deterministically.57- `buildConditionExpressionFromGraph(...)` and import paths must be treated as a semantic round trip, not as string formatting.5859Preserve the original inline condition when a partial visual import cannot reconstruct it60exactly, including unsupported operators or children and root-data `var: ""`; visual limitations61must not erase valid runtime semantics. Build condition projections purely from fresh graph62`nodes`/`rootNodes`; absent or stale `currentJSON` and cached diagnostics are not semantic input.63After initialization, accept external `initialRules` replacements through the canonical importer,64including same-ID and empty documents, without treating equivalent echoes as new history. Inspect65`rule-definition.component.spec.ts`, `rule-editor.component.spec.ts`, and66`rule-builder.service.spec.ts`; for Form bridges also prove exact-expression preservation in67`utils/rule-converters.spec.ts` and runtime-only diagnostics in the host.6869## Inventory Before New Contract7071Classify requested additions:7273- `ja-suportado-so-ux`: JSON Logic exists but the editor, preview, error message, or validation result is not visible enough.74- `ja-suportado-mal-nomeado-ou-mal-materializado`: a host calls the contract “DSL”, “expression”, or “script” while the actual supported payload is JSON Logic.75- `suportado-parcialmente`: the model exposes a node or value type, but parse/export/validation/docs do not fully support it yet.76- `lacuna-real-de-contrato`: no supported JSON Logic representation, parser branch, validation rule, core type, or form-rule materialization can express the condition.7778Only a real contract gap justifies adding operators, operands, or exported types. If context variables or custom functions are needed as condition operands, define the canonical JSON Logic shape and consumers before authoring local UI behavior.7980## Validation8182Use focused local gates:8384- `rule-builder.service.spec.ts` for import/export and validation behavior;85- round-trip specs for JSON Logic condition graphs;86- `field-condition-editor.component.spec.ts` when editor controls or operator support changes;87- property-effect specs when conditions are attached to effects;88- AI manifest specs when `dsl.roundTrip.validate`, `condition.set`, or failure modes change;89- `npm run build:praxis-visual-builder` for public model or export changes.9091Every completed issue should state whether JSON export, import back, graph validation, semantic drift detection, and dynamic-form/form-rule materialization were actually tested.