Document 1 — Source-Driven Traversal Core Invariant
The engine walks the source data.
At each step, it checks the instructions to see if an action is defined.
If yes, it understands the instruction and applies it to the current source node.
1. The Two Objects
The system always works with two distinct structures:
The Source Object
The source is the actual data. It describes what exists in your system:
{
"customer": {
"name": "Keshav"
},
"order": {
"id": "ORD-101"
}
}
The Instructions Object
The instructions describe what to do at specific locations:
{
"customer": {
"transform": "logPath"
},
"order": {
"transform": "logPath"
}
}
Notice that the instructions object mirrors only the locations where behavior is needed. It does not dictate traversal order.
2. The Traversal Rule
The execution order is always driven by the source:
Walk the source node by node
↓
Look up the corresponding path in the instructions
↓
Did we find an instruction for this node?
├── YES → Apply the instruction to the current source node
└── NO → Continue traversing the source
3. Why Source-Driven Matters
Because traversal is driven by the source, the instruction object never needs to duplicate the entire source tree. If the source contains dozens of properties, but only two have instructions, the engine seamlessly walks the source and only attaches behavior where instructed.