The implementation includes pytest tests that verify parser, emitter, validator, runtime, dashboard, and MCP correctness.
Current totals: 3,888 passed, 81 skipped. Overall coverage: 87%.
| Category | Test File | Tests | Coverage |
|---|---|---|---|
| Compiler | tests/test_parser.py |
123 | Parser functionality |
| Compiler | tests/test_emitter.py |
85 | JSON emission |
| Compiler | tests/test_validator.py |
120 | Semantic validation |
| Compiler | tests/test_source.py |
33 | Source input and provenance |
| Compiler | tests/test_config.py |
16 | Configuration loading |
| Compiler | tests/test_cli.py |
25 | CLI argument parsing and error handling |
| Compiler | tests/test_loader.py |
13 | MongoDB and Maven source loaders |
| Compiler | tests/test_runner_main.py |
5 | Runner CLI entry point |
| Compiler | tests/test_ast_utils.py |
24 | AST normalization utilities |
| Compiler | tests/test_resolver.py |
24 | Cross-file type resolution |
| Compiler | tests/test_publisher.py |
14 | Namespace publishing |
| Compiler | tests/test_entry_points.py |
9 | Package entry points |
| Compiler | tests/test_lifecycle_integration.py |
24 | End-to-end lifecycle tests |
| Runtime | tests/runtime/test_types.py |
8 | StepId, BlockId, ObjectType, FacetAttributes |
| Runtime | tests/runtime/test_states.py |
15 | State constants and transitions |
| Runtime | tests/runtime/test_step.py |
13 | StepDefinition and StepTransition |
| Runtime | tests/runtime/test_entities.py |
29 | Runtime entity types |
| Runtime | tests/runtime/test_memory_store.py |
14 | In-memory persistence |
| Runtime | tests/runtime/test_mongo_store.py |
31 | MongoDB persistence (mongomock) |
| Runtime | tests/runtime/test_dependency.py |
10 | DependencyGraph from AST |
| Runtime | tests/runtime/test_expression.py |
60 | Expression evaluation (InputRef, StepRef, BinaryExpr, ConcatExpr) |
| Runtime | tests/runtime/test_evaluator.py |
77 | Spec examples, iteration traces, acceptance tests |
| Runtime | tests/runtime/test_script_executor.py |
32 | Sandboxed script execution |
| Runtime | tests/runtime/test_runner_service.py |
106 | Distributed runner service |
| Runtime | tests/runtime/test_agent_poller.py |
20 | AgentPoller core |
| Runtime | tests/runtime/test_agent_poller_async.py |
10 | Async handler tests |
| Runtime | tests/runtime/test_agent_poller_extended.py |
20 | AgentPoller edge cases |
| Runtime | tests/runtime/test_agent.py |
39 | Agent integration |
| Runtime | tests/runtime/test_addone_agent.py |
7 | AddOne agent end-to-end |
| Runtime | tests/runtime/test_resume_task.py |
7 | Resume task protocol |
| Runtime | tests/runtime/test_storage.py |
46 | Storage backends (local, HDFS) |
| Runtime | tests/runtime/test_hdfs_storage.py |
19 | HDFS storage operations |
| Runtime | tests/runtime/test_dispatcher.py |
23 | Event dispatcher |
| Runtime | tests/runtime/test_submit.py |
24 | Workflow submission |
| Runtime | tests/runtime/test_registry_runner.py |
37 | RegistryRunner unit tests |
| Runtime | tests/runtime/test_registry_runner_integration.py |
30 | RegistryRunner integration |
| Runtime | tests/runtime/test_agent_runner.py |
11 | AgentRunner make_store/config/run_agent |
| Runtime | tests/runtime/test_inline_dispatch.py |
14 | Inline handler dispatch |
| Runtime | tests/runtime/test_script_handlers.py |
8 | Script handler tests |
| Dashboard | tests/dashboard/test_app.py |
3 | App creation and route registration |
| Dashboard | tests/dashboard/test_filters.py |
53 | Jinja2 filter unit tests |
| Dashboard | tests/dashboard/test_global_filters.py |
13 | Global Flow/Workflow filter page + cookie application |
| Dashboard | tests/dashboard/test_routes.py |
97 | Route integration tests (v3) |
| Dashboard | tests/dashboard/test_step_routes.py |
14 | Step detail and name resolution |
| Dashboard | tests/dashboard/test_workflows.py |
10 | Workflow routes |
| Dashboard | tests/dashboard/test_dependencies.py |
5 | Dependency injection |
| Dashboard | tests/dashboard/test_users_teams_ui.py |
7 | v3 Users/Teams admin + acting-as |
| Dashboard | tests/dashboard/test_template_rendering.py |
12 | Navigation and template rendering |
| Dashboard | tests/dashboard/test_edge_cases.py |
33 | Dashboard edge cases |
| Dashboard | tests/dashboard/test_flow_namespaces.py |
8 | Flow namespace views |
| Dashboard | tests/dashboard/test_flow_run.py |
14 | Flow run execution |
| Dashboard | tests/dashboard/test_step_tree.py |
10 | Execution graph / step tree |
| Dashboard | tests/dashboard/test_catalog_page.py |
6 | v3 Catalog page + run/publish |
| Dashboard | tests/dashboard/test_output_browser.py |
33 | v3 Output browser + /output/view |
| Dashboard | tests/dashboard/test_census_maps.py |
139 | Census Maps domain app |
| Dashboard | tests/dashboard/test_site_selection.py |
13 | Site Selection domain app |
| Dashboard | tests/dashboard/test_climate_trends.py |
12 | Climate Trends domain app |
The v2-UI test suites (
test_dashboard_v2.py,test_servers_v2.py,test_handlers_v2.py) were removed along with the v2 UI; the remaining tests assert v3 behavior. | MCP |tests/mcp/test_server.py| 49 | Tool + resource integration | | MCP |tests/mcp/test_server_extended.py| 18 | Continue/resume/resource edge cases | | MCP |tests/mcp/test_serializers.py| 23 | Serializer unit tests | | MCP |tests/mcp/test_store.py| 3 | MongoStore singleton factory | | MCP |tests/mcp/test_error_handling.py| 29 | Error handling edge cases | | MCP |tests/mcp/test_tool_workflows.py| 14 | Workflow tool tests | | Total | | 1718 | |
test_empty_program- Empty input produces empty programtest_simple_facet- Parse basic facet declarationtest_facet_multiple_params- Multiple parameter parsingtest_facet_no_params- Empty parameter listtest_facet_with_return- Return clause parsing
test_event_facet- Parseevent facetdeclarations
test_simple_workflow- Basic workflow declarationtest_workflow_with_body- AndThen block with steps and yield
test_simple_namespace- Namespace with contentstest_namespace_with_uses- Uses declarationstest_namespace_with_workflow- Full namespace example
test_mixin_in_signature- Mixin in facet signaturetest_mixin_call_with_alias- Mixin call withasalias
test_implicit_decl- Implicit declarations
test_input_reference-$.fieldreferencestest_step_reference-step.fieldreferencestest_nested_reference- Nested path references
test_string_literal- String parsingtest_integer_literal- Integer parsingtest_boolean_literal- Boolean parsing (true/false)test_null_literal- Null parsing
test_foreach_in_workflow- Foreach iteration
test_line_comment-//comments ignoredtest_block_comment-/* */comments ignored
test_builtin_types- All builtin types (String, Long, Int, Boolean, Json)test_qualified_type- Qualified type names
test_unexpected_token- Error includes line/columntest_missing_parenthesis- Missing token errorstest_invalid_return_clause- Invalid syntax errors
test_parse_function- Convenience functiontest_facet_has_location- Source location trackingtest_multiple_facets- Multiple declarationstest_mixed_declarations- Mixed declaration typestest_semicolon_separator- Semicolon separatorstest_mixed_separators- Mixed newlines and semicolons
test_simple_concat- Parse++operatortest_multi_concat- Multiple concat operandstest_concat_with_newlines- Newlines after++
test_use_singular- Parseuse(singular form)test_multiple_use_declarations- Multipleusestatements
test_string_default- Parse string default valuetest_integer_default- Parse integer default valuetest_boolean_default- Parse boolean default valuetest_null_default- Parse null default valuetest_no_default- Parameters without defaults have default=Nonetest_mixed_defaults- Mix of params with and without defaultstest_workflow_with_defaults- Workflow params and return defaultstest_event_facet_with_defaults- Event facet with defaultstest_multiple_defaults- Multiple parameters with defaultstest_reference_default- Parameter with literal default in workflow context
test_empty_program- Empty program JSONtest_simple_facet- Facet to JSONtest_facet_with_return- Return clause emissiontest_event_facet- Event facet typetest_workflow- Workflow emission
test_workflow_with_steps- Steps and yield emissiontest_foreach- Foreach clause emission
test_input_ref- InputRef JSON formattest_step_ref- StepRef JSON formattest_nested_ref- Nested path emission
test_string_literal- String JSON formattest_integer_literal- Int JSON formattest_boolean_literal- Boolean JSON formattest_null_literal- Null JSON format
test_mixin_in_signature- MixinSig emissiontest_mixin_call_with_alias- MixinCall with alias
test_namespace- Full namespace emission
test_implicit- Implicit declaration emission
test_locations_included- Location fields presenttest_locations_excluded- Location fields absent
test_emit_json-emit_json()functiontest_emit_dict-emit_dict()functiontest_compact_json- Compact output mode
test_full_workflow- Real-world workflow example
test_string_default- String default value emitted correctlytest_integer_default- Integer default value emitted correctlytest_boolean_default- Boolean default value emitted correctlytest_null_default- Null default value emitted correctlytest_no_default_omits_key- No default key when absenttest_mixed_defaults- Mix of params with and without defaultstest_workflow_defaults_roundtrip- Workflow params and returns with defaultstest_default_in_json_output- Default survives JSON serialization
test_valid_json_output- Output is valid JSONtest_roundtrip_consistency- Consistent output
test_duplicate_facet_names- Duplicate facets errortest_duplicate_workflow_names- Duplicate workflows errortest_duplicate_event_facet_names- Duplicate event facets errortest_facet_workflow_same_name- Mixed type duplicates errortest_unique_names_valid- Unique names passtest_duplicate_names_in_namespace- Namespace duplicate errortest_same_name_different_namespaces- Cross-namespace OKtest_duplicate_step_names- Duplicate steps errortest_unique_step_names_valid- Unique steps pass
test_valid_input_reference-$.paramOKtest_invalid_input_reference-$.unknownerrortest_valid_step_reference-step.attrOKtest_invalid_step_attribute- Unknown attribute errortest_reference_undefined_step- Unknown step errortest_reference_step_defined_after- Forward reference errortest_foreach_variable_valid- Foreach var OK
test_valid_yield_containing_facet- Yield to self OKtest_invalid_yield_target- Wrong target errortest_yield_to_mixin_valid- Yield to mixin OKtest_yield_references_validated- Yield refs checkedtest_duplicate_yield_targets- Duplicate yields error
test_validate_function- Convenience functiontest_validate_with_errors- Returns errorstest_empty_result_is_valid- Empty = validtest_result_with_errors_invalid- Errors = invalidtest_error_string_format- Error formattingtest_error_string_no_location- Error without locationtest_nested_block_references- Complex referencestest_multiple_errors_reported- All errors reportedtest_full_namespace_example- Real-world example
test_valid_use_statement- Use existing namespace OKtest_invalid_use_statement- Use nonexistent namespace errortest_multiple_valid_use_statements- Multiple valid uses OKtest_mixed_valid_invalid_use_statements- Mixed valid/invalid errors
test_unambiguous_facet_reference- Unambiguous reference OKtest_ambiguous_facet_reference- Ambiguous reference errortest_qualified_name_resolves_ambiguity- Qualified name OKtest_local_facet_takes_precedence- Local facet winstest_mixin_with_qualified_name- Qualified mixin OKtest_unknown_qualified_facet- Unknown qualified error
# Setup
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# Run all tests
pytest tests/ examples/ -v
# Run with coverage
pytest tests/ examples/ --cov=afl --cov-report=term-missing
# Run specific test file
pytest tests/test_parser.py -v
# Run specific test class
pytest tests/test_parser.py::TestWorkflows -v
# Run specific test
pytest tests/test_parser.py::TestBasicParsing::test_simple_facet -v
# Run tests matching pattern
pytest tests/ -k "namespace" -vThe runtime implementation includes pytest tests that verify evaluator, state machine, persistence, and execution correctness.
| Test File | Tests | Coverage |
|---|---|---|
tests/runtime/test_types.py |
8 | Type system (StepId, BlockId, ObjectType, FacetAttributes) |
tests/runtime/test_states.py |
15 | State constants and transitions |
tests/runtime/test_step.py |
13 | StepDefinition and StepTransition |
tests/runtime/test_entities.py |
29 | Runtime entity types |
tests/runtime/test_memory_store.py |
9 | In-memory persistence |
tests/runtime/test_mongo_store.py |
32 | MongoDB persistence (mongomock) |
tests/runtime/test_dependency.py |
10 | DependencyGraph from AST |
tests/runtime/test_expression.py |
51 | Expression evaluation (InputRef, StepRef, BinaryExpr, ConcatExpr) |
tests/runtime/test_events.py |
15 | Event lifecycle management |
tests/runtime/test_evaluator.py |
68 | Integration tests, iteration traces, acceptance tests |
tests/runtime/test_script_executor.py |
25 | Sandboxed script execution |
tests/runtime/test_runner_service.py |
105 | Distributed runner service |
tests/runtime/test_agent_poller.py |
14 | AgentPoller core polling |
tests/runtime/test_agent_poller_async.py |
10 | Async handler tests |
tests/runtime/test_agent_poller_extended.py |
19 | AgentPoller edge cases |
tests/runtime/test_agent.py |
19 | Agent integration |
tests/runtime/test_addone_agent.py |
7 | AddOne agent end-to-end |
tests/runtime/test_resume_task.py |
7 | Resume task protocol |
All 10 acceptance tests from spec/70_examples.md Examples 2-4 are implemented in tests/runtime/test_evaluator.py::TestIterationTraces:
| Test Name | Validates | Spec Reference |
|---|---|---|
test_event_facet_blocks_at_transmit |
subStep1 calling event facet blocks at EventTransmit with request_state_change(False) |
Example 4, §8.1 |
test_step_continue_resumes_step |
StepContinue event unblocks step from EventTransmit |
Example 4, §12.1 |
test_nested_statement_block |
s1 with statement-level andThen creates block_s1 |
Examples 3-4, §8.2 |
test_facet_definition_lookup |
EventTransmitHandler detects EventFacetDecl via get_facet_definition() |
Example 4, §11.1 |
test_multi_run_execution |
Evaluator pauses at fixed point, resumes after external event processing | Example 4, §10.2 |
test_facet_level_block_creation |
Step calling facet with andThen body creates block from facet definition |
Examples 2-4, §8.2 |
test_block_ast_resolution_nested |
BlockExecutionBegin resolves correct AST for nested statement-level blocks |
Examples 3-4, §8.3 |
test_example_2_full_trace |
Full iteration-by-iteration trace for Example 2 (8 steps, 8 iterations) | Example 2 |
test_example_3_full_trace |
Full iteration-by-iteration trace for Example 3 (11 steps, 11 iterations) | Example 3 |
test_example_4_full_trace |
Full iteration-by-iteration trace for Example 4 (11 steps, 2 evaluator runs) | Example 4 |