Treewalker: DAG Engine & Configuration Aggregation
sinq uses a directory-traversal engine called the Treewalker. Instead of relying on monolithic definitions, the Treewalker treats your physical filesystem as a Directed Acyclic Graph (DAG) to build test workflows.
Core Algorithm
- Discovery: Starting at the target root, the engine finds all
.scenarioand.sinqfiles. - Sorting: Files within the same directory are sorted in natural alphanumeric order. This means
2_request.sinqwill correctly execute before10_finalize.sinq. - Descent & Inheritance: The engine recursively descends into subdirectories. Child directories inherit and append the sorted
.scenarioand.sinqfiles from their parents. - Leaf Compilation: Once the engine reaches a directory containing at least one
.sinqor.scenariofile but no subdirectories, it compiles the accumulated path into an executable Scenario.
Note: Sibling leaf directories are completely isolated. sinq will spin up separate workers to execute them concurrently.
Configuration Aggregation (Deep Merging)
config.scenario files control the environment variables, timeouts, and behavioral limits of a scenario.
When a leaf directory inherits a config.scenario file from a parent, the configurations are deep merged, with the deeper (child) configuration taking precedence.
Parent config.scenario:
Child (Leaf) config.scenario:
Final Aggregated Configuration for the Leaf:
{
"req_timeout": "15s",
"fail_fast": true,
"env": {
"BASE_URL": "https://api.local",
"FEATURE_FLAG": "false",
"NEW_VAR": "hello"
}
}
fail_fast, are preserved, BASE_URL is inherited, and FEATURE_FLAG is overwritten).
Scenario Ordering
Scenarios parsed by the Treewalker tend to seem deterministically parsed, but Treewalker doesn't guarantee deterministic scenario ordering.