fancy-flow 0.30.0__tar.gz → 0.30.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fancy_flow-0.30.2/AGENTS.md +81 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/CHANGELOG.md +58 -2
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/PKG-INFO +9 -2
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/README.md +8 -1
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/pyproject.toml +1 -1
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/logic.py +18 -2
- fancy_flow-0.30.2/src/fancy_flow/registry/blank.py +22 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/registry/registry.py +18 -4
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/events.py +17 -1
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_pinned_suite_version.py +1 -1
- fancy_flow-0.30.2/tests/unit/test_for_each_forwards_lane_events.py +69 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_transform_fields_mode.py +72 -0
- fancy_flow-0.30.0/AGENTS.md +0 -275
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/.gitignore +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/LICENSE +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/analysis/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/analysis/graph_connectivity.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/capabilities/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/contracts.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/discovery.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/coordinator.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/dispatch.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/frontier.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/human.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/replay.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/retry.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/durable/state.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/engine/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/engine/diagnostics.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/engine/runner.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/exceptions.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/executors.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/marketplace/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/marketplace/manifest.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/ai.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/data.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/human.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/io_.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/output.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/structural.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/support/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/support/clients.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/support/deps.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/support/expr.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/support/routing_diagnostics.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/support/structured.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/terminal.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/nodes/trigger.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/py.typed +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/registry/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/registry/builtin.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/registry/kind_id.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/registry/node_kind.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/registry/port_resolution.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/abort.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/context.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/identity.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/options.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/pause.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/ports.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/terminal.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/runtime/workflow_props.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/schema/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/schema/graph.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/schema/issues.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/security/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/security/policy.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/src/fancy_flow/workflow.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_bare_routing_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_durable_dispatch_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_entry_points_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_executor_resolution_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_expr_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_kind_declaration_surface_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_port_activation_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_range_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_run_diagnostics_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_run_diagnostics_durable_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_run_identity_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/conformance/test_workflow_props_conformance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/01-manual-transform-output.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/02-webhook-branch-true-notify.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/03-branch-false-log.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/04-switch-case.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/05-merge-after-decision.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/06-merge-concat.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/07-for-each.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/08-memory-store.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/09-data-store.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/10-variable-transform.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/11-llm-call.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/12-tool-use.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/13-embed-search.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/14-api-request.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/15-webhook-out.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/16-schedule-trigger.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/17-user-input.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/18-human-approval.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/19-wait.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/20-subgraph.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/21-cycle.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/22-unknown-kind.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/23-merge-same-handle.json +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/fixtures/SOURCE.md +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/test_durable_driver_parity.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/test_fixture_provenance.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/parity/test_graph_fixtures.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/test_builtin_output_shape.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/test_output_shape.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/__init__.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_caller_facing_errors.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_discovery.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_durable.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_engine.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_graph_connectivity.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_import_refuses_unsupported_version.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_marketplace.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_multi_port_activation.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_node_grouping.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_node_status_messages.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_nodes.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_registries.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_run_diagnostics.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_run_identity.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_security.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_subflow_propagates_a_pause.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_template_with_several_references.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_terminal_nodes.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_terminal_transcript.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_unresolved_path.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_version_metadata.py +0 -0
- {fancy_flow-0.30.0 → fancy_flow-0.30.2}/tests/unit/test_workflow_and_expr.py +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Using fancy-flow (Python) — guide for agents
|
|
2
|
+
|
|
3
|
+
How an agent installs and uses this package in a consumer app. What the package
|
|
4
|
+
is, is in [README.md](./README.md). Notes for working ON this repo's code are in
|
|
5
|
+
[CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install fancy-flow
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Python 3.11+. Zero runtime dependencies.
|
|
14
|
+
- The repo is `fancy-flow-py`; the distribution is `fancy-flow` and the import
|
|
15
|
+
is `fancy_flow`. Twins: npm `@particle-academy/fancy-flow`, Composer
|
|
16
|
+
`particle-academy/fancy-flow-php`.
|
|
17
|
+
|
|
18
|
+
## Find it on the Fancy MCP server
|
|
19
|
+
|
|
20
|
+
The catalog server is `https://ui.particle.academy/mcp` (streamable HTTP, no API
|
|
21
|
+
key; MCP id `fancy-ui`). It is listed as the registry entry `fancy-flow-py` (a
|
|
22
|
+
package entry, not vendorable source). Find it with `search-backend-packages`
|
|
23
|
+
(stack `python`).
|
|
24
|
+
|
|
25
|
+
Workflow nodes: fancy-flow's core builtins need no installation. Marketplace
|
|
26
|
+
nodes are found with `search-nodes`, `get-node` and `node-install-instructions`.
|
|
27
|
+
|
|
28
|
+
## API essentials
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from fancy_flow import FlowRunner, RunOptions, builtin, import_workflow
|
|
32
|
+
|
|
33
|
+
builtin.register()
|
|
34
|
+
result = import_workflow(schema_json) # WorkflowSchema v1, as <FlowEditor> exports it
|
|
35
|
+
|
|
36
|
+
run = FlowRunner().run(
|
|
37
|
+
result.graph,
|
|
38
|
+
builtin.executors(),
|
|
39
|
+
options=RunOptions(initial_inputs={"trigger-1": {"payload": body}}),
|
|
40
|
+
)
|
|
41
|
+
run.ok
|
|
42
|
+
run.outputs
|
|
43
|
+
run.error
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- **Async:** `await FlowRunner().arun(graph, executors)` awaits awaitable
|
|
47
|
+
executors. Same walk as `run()`.
|
|
48
|
+
- **Custom nodes:** `default_registry().register(NodeKind(name="@acme/...", category=..., label=..., aliases=(...), config_schema=(ConfigField(...),), side_effects=...))`,
|
|
49
|
+
then `builtin.executors().bind("@acme/...", fn)`. An executor is a callable,
|
|
50
|
+
an object with `.execute(ctx)`, or a class resolved through your container.
|
|
51
|
+
- **Durable runs:** `fancy_flow.durable.Coordinator(graph=..., executors=..., run=..., store=...)`.
|
|
52
|
+
A queue job wraps `advance()` (what may be dispatched now) and
|
|
53
|
+
`run_node(node_id)`; `run_to_completion()` drives both in-process.
|
|
54
|
+
`max_concurrent` (default 1; `UNLIMITED_CONCURRENCY` for the whole ready
|
|
55
|
+
frontier) caps how many of one run's nodes are held at once.
|
|
56
|
+
- **Untrusted graphs:** `fancy_flow.security.GraphPolicy.untrusted(allow=[...]).assert_safe(schema)`.
|
|
57
|
+
- **LLM and terminals are host capabilities.** Supply an `LlmClient`
|
|
58
|
+
(`llm_router`), a `WorkflowResolver` (`subflow`) and a `TerminalHost`
|
|
59
|
+
(terminal lanes). There is no LLM auto-detection.
|
|
60
|
+
|
|
61
|
+
## Traps
|
|
62
|
+
|
|
63
|
+
- **Check `result.refused` before running.** A document without `version: 1` is
|
|
64
|
+
refused in every mode, even with `lenient=True`, and an empty graph runs and
|
|
65
|
+
reports success.
|
|
66
|
+
- **`run()` refuses awaitables.** If any executor is `async`, use `arun()`.
|
|
67
|
+
Terminal lane nodes (`terminal_run`, `terminal_send`, `terminal_await`) are
|
|
68
|
+
async, so they only work through `arun()`.
|
|
69
|
+
- **Queued runs are serial by default**, and a node paused at a human gate keeps
|
|
70
|
+
its slot. `advance()` returns nothing while a node of the run is held.
|
|
71
|
+
- **Human gates fail closed.** Only a recorded answer for that node resumes the
|
|
72
|
+
run.
|
|
73
|
+
- `side_effects="unsafe-to-replay"` gives a node one attempt in a durable run.
|
|
74
|
+
- `GraphPolicy.untrusted()` starts with an empty allowlist; list every kind you
|
|
75
|
+
accept.
|
|
76
|
+
- `{{ x.length }}` on a list is `None` here (it resolves in the TypeScript
|
|
77
|
+
engine).
|
|
78
|
+
- A negative, `bool` or non-`int` `max_concurrent` is refused at construction.
|
|
79
|
+
- Not built yet: queue adapters (Celery, Dramatiq, Taskiq, Procrastinate), a
|
|
80
|
+
persistent `NodeClaimStore`, a web-framework integration, the `agent`
|
|
81
|
+
executor. Supply your own store and queue glue.
|
|
@@ -8,6 +8,64 @@ version number is not a promise it can yet keep; the entries are.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.30.2] - 2026-11-25
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **CI: the lab-certificate gate verifies against the lab's rotated key list.**
|
|
16
|
+
The lab's first signing key is retired: certificates it already issued still
|
|
17
|
+
verify, and nothing new it signs ever can. Consumers do nothing.
|
|
18
|
+
|
|
19
|
+
- **Releases need a lab-run certificate.** `publish.yml` gains a read-only
|
|
20
|
+
`lab-certificate` job that every publishing job needs: a tag is published only
|
|
21
|
+
when the fancy-labs lab has certified that exact version and commit. Consumers
|
|
22
|
+
do nothing; this changes how releases are cut, not what the package does.
|
|
23
|
+
- Rebranded the display name to Fancy Dev Kit (README and package description). Package names, the npm scope, URLs and the `fancy-ui` MCP id are unchanged.
|
|
24
|
+
- **Docs:** `AGENTS.md` is now the guide to using this package (install, its entries on the Fancy MCP catalog server, API essentials, traps). The contributor notes it held moved to `CONTRIBUTING.md`, and `CLAUDE.md` is now a symlink to it. The README points to the MCP server and to `AGENTS.md`. No code changed; nothing to do.
|
|
25
|
+
- CI: re-pin org third-party allowlist to 2614224
|
|
26
|
+
- Conformance fixtures 0.62.0: the `flow/*`, `shared/expr`, `shared/satisfies-range` and `shared/flow-run-identity` rows are now pinned at fancy-conformance 0.62.0 (was 0.32.0), in the CI checkout ref and `PINNED_SUITE_VERSION`. Test-only; no runtime change, nothing to do.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **`for_each` now forwards every event its item lane emits** (parity with
|
|
31
|
+
fancy-flow-php #25). Each iteration ran its lane with no event sink, so a
|
|
32
|
+
status, message or log from a node inside the loop never reached the host:
|
|
33
|
+
the PHP twin reported five per-item events for five items and this port
|
|
34
|
+
reported none. Node-scoped events now arrive re-addressed as
|
|
35
|
+
`<for_each id>/<index>/<node id>` (the id escaped as in run identities) by the
|
|
36
|
+
new `RunEvent.for_parent`, the twin of PHP's `RunEvent::forParent`. A lane's
|
|
37
|
+
own `run-start` / `run-end` / `run-error` are not forwarded. Nothing to do,
|
|
38
|
+
unless your sink assumed every `node_id` is a top-level node: ids with a `/`
|
|
39
|
+
now come from inside a loop.
|
|
40
|
+
|
|
41
|
+
## [0.30.1] - 2026-11-01
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **A whitespace-only key with a value was admitted and its value silently
|
|
46
|
+
dropped at run time; it is now refused like an empty key.** Reported by Maipa
|
|
47
|
+
against 0.30.0's twins: `transform` with `{"mode": "fields", "fields":
|
|
48
|
+
[{"key": " ", "value": "Configured synthetic value"}]}` passed
|
|
49
|
+
`validate_config` with no issue, then ran as a passthrough, because the
|
|
50
|
+
validator compared the key with `""` while the executor strips it and skips a
|
|
51
|
+
blank one. Both now call ONE helper, `fancy_flow.registry.blank.trimmed_key`
|
|
52
|
+
(`str.strip()`: every character for which `str.isspace()` is true).
|
|
53
|
+
- a whitespace-only key WITH a value is refused with the empty-key message,
|
|
54
|
+
`Output fields item N: Key is required`;
|
|
55
|
+
- a whitespace-only key with a blank value is a skipped blank row, as the
|
|
56
|
+
editor's untouched default still is;
|
|
57
|
+
- a padded non-blank key is admitted and runs under the stripped key,
|
|
58
|
+
unchanged;
|
|
59
|
+
- the value is never stripped; expression mode and typed `{{ }}` values are
|
|
60
|
+
unchanged.
|
|
61
|
+
|
|
62
|
+
In a `skipBlankRows` repeater a `text` cell that strips to `""` is blank, for
|
|
63
|
+
skipping the row and for a `required` check. Only `transform` declares
|
|
64
|
+
`skipBlankRows`. Matches `@particle-academy/fancy-flow` 0.82.1.
|
|
65
|
+
|
|
66
|
+
**What a consumer must DO:** a config that relied on this was already losing
|
|
67
|
+
data, and it now errors at validation, so fix the key. Nothing else changes.
|
|
68
|
+
|
|
11
69
|
## [0.30.0] - 2026-11-01
|
|
12
70
|
|
|
13
71
|
### Added
|
|
@@ -88,7 +146,6 @@ substring match on `Cycle detected` is unaffected. Otherwise nothing.
|
|
|
88
146
|
|
|
89
147
|
**What you must DO: nothing.** A case that used to throw now parses.
|
|
90
148
|
|
|
91
|
-
|
|
92
149
|
## [0.28.0] - 2026-09-22
|
|
93
150
|
|
|
94
151
|
### Changed
|
|
@@ -1412,7 +1469,6 @@ exactly; these are the edges that differ.
|
|
|
1412
1469
|
**`stopping_msg` fires only when the node SUCCEEDS.** A completion message
|
|
1413
1470
|
after a raise tells a human the opposite of what happened.
|
|
1414
1471
|
|
|
1415
|
-
|
|
1416
1472
|
### Added
|
|
1417
1473
|
|
|
1418
1474
|
- **`RunIdentity` on the execution context, so a node that WRITES can send an
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fancy-flow
|
|
3
|
-
Version: 0.30.
|
|
3
|
+
Version: 0.30.2
|
|
4
4
|
Summary: Python runtime for fancy-flow workflow graphs - the third twin of @particle-academy/fancy-flow's engine. Same WorkflowSchema JSON in, same outputs out.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Particle-Academy/fancy-flow-py
|
|
6
6
|
Project-URL: Issues, https://github.com/Particle-Academy/fancy-flow-py/issues
|
|
@@ -61,6 +61,13 @@ every mode, with an empty graph and `result.refused` true, exactly as the
|
|
|
61
61
|
TypeScript and PHP runtimes refuse it. Check `result.refused` before running,
|
|
62
62
|
or an empty graph runs and reports success.
|
|
63
63
|
|
|
64
|
+
<!-- fancy-agents-note:start -->
|
|
65
|
+
> **For agents.** This package is listed on the Fancy MCP catalog server at
|
|
66
|
+
> `https://ui.particle.academy/mcp` (streamable HTTP, no API key; MCP id `fancy-ui`),
|
|
67
|
+
> with install commands and docs, alongside the rest of the kit. How an agent
|
|
68
|
+
> installs and uses this package is in [AGENTS.md](https://github.com/Particle-Academy/fancy-flow-py/blob/main/AGENTS.md).
|
|
69
|
+
<!-- fancy-agents-note:end -->
|
|
70
|
+
|
|
64
71
|
## Async, without two engines
|
|
65
72
|
|
|
66
73
|
Executors may be synchronous or `async`. The graph walk is written once and
|
|
@@ -176,6 +183,6 @@ pytest
|
|
|
176
183
|
|
|
177
184
|
Pre-1.0: breaking changes land in minor releases. See
|
|
178
185
|
[`CHANGELOG.md`](CHANGELOG.md) and, for how the package is built and what is
|
|
179
|
-
staged next, `
|
|
186
|
+
staged next, [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
|
180
187
|
|
|
181
188
|
MIT.
|
|
@@ -38,6 +38,13 @@ every mode, with an empty graph and `result.refused` true, exactly as the
|
|
|
38
38
|
TypeScript and PHP runtimes refuse it. Check `result.refused` before running,
|
|
39
39
|
or an empty graph runs and reports success.
|
|
40
40
|
|
|
41
|
+
<!-- fancy-agents-note:start -->
|
|
42
|
+
> **For agents.** This package is listed on the Fancy MCP catalog server at
|
|
43
|
+
> `https://ui.particle.academy/mcp` (streamable HTTP, no API key; MCP id `fancy-ui`),
|
|
44
|
+
> with install commands and docs, alongside the rest of the kit. How an agent
|
|
45
|
+
> installs and uses this package is in [AGENTS.md](https://github.com/Particle-Academy/fancy-flow-py/blob/main/AGENTS.md).
|
|
46
|
+
<!-- fancy-agents-note:end -->
|
|
47
|
+
|
|
41
48
|
## Async, without two engines
|
|
42
49
|
|
|
43
50
|
Executors may be synchronous or `async`. The graph walk is written once and
|
|
@@ -153,6 +160,6 @@ pytest
|
|
|
153
160
|
|
|
154
161
|
Pre-1.0: breaking changes land in minor releases. See
|
|
155
162
|
[`CHANGELOG.md`](CHANGELOG.md) and, for how the package is built and what is
|
|
156
|
-
staged next, `
|
|
163
|
+
staged next, [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
|
157
164
|
|
|
158
165
|
MIT.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fancy-flow"
|
|
7
|
-
version = "0.30.
|
|
7
|
+
version = "0.30.2"
|
|
8
8
|
description = "Python runtime for fancy-flow workflow graphs - the third twin of @particle-academy/fancy-flow's engine. Same WorkflowSchema JSON in, same outputs out."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
# 3.11, not the modal 3.10: 3.10 reaches end of life on 2026-10-31, and a floor
|
|
@@ -9,8 +9,10 @@ from __future__ import annotations
|
|
|
9
9
|
import re
|
|
10
10
|
from typing import TYPE_CHECKING, Any
|
|
11
11
|
|
|
12
|
+
from ..registry.blank import trimmed_key
|
|
12
13
|
from ..runtime.context import ExecutionContext
|
|
13
14
|
from ..runtime.events import RunEvent
|
|
15
|
+
from ..runtime.identity import escape_segment
|
|
14
16
|
from ..runtime.ports import Port
|
|
15
17
|
from .support import expr
|
|
16
18
|
from .support.routing_diagnostics import warn_if_unresolved
|
|
@@ -219,10 +221,20 @@ def for_each(ctx: ExecutionContext) -> Any:
|
|
|
219
221
|
for edge in entries:
|
|
220
222
|
initial_inputs.setdefault(edge.target, {})[edge.target_handle or "in"] = item
|
|
221
223
|
|
|
224
|
+
# EVERY node-scoped event the lane emits, re-addressed for the parent,
|
|
225
|
+
# as fancy-flow-php's ForEachExecutor does (#25). This passed no sink,
|
|
226
|
+
# so a status, message or log from inside the loop never reached the host.
|
|
227
|
+
prefix = f"{escape_segment(ctx.node.id)}/{index}/"
|
|
228
|
+
|
|
229
|
+
def forward(event: RunEvent, prefix: str = prefix) -> None:
|
|
230
|
+
forwarded = event.for_parent(prefix)
|
|
231
|
+
if forwarded is not None:
|
|
232
|
+
ctx.emit(forwarded)
|
|
233
|
+
|
|
222
234
|
nested = FlowRunner().run(
|
|
223
235
|
lane_graph,
|
|
224
236
|
lane_executors,
|
|
225
|
-
|
|
237
|
+
forward,
|
|
226
238
|
RunOptions(
|
|
227
239
|
initial_inputs=initial_inputs,
|
|
228
240
|
depth=ctx.depth + 1,
|
|
@@ -360,6 +372,10 @@ def _transform_rows(config: dict[str, Any]) -> list[tuple[str, Any]]:
|
|
|
360
372
|
A row that is not an object, or whose ``key`` is not a non-blank string, is
|
|
361
373
|
skipped. A later row with the same key overwrites the value but keeps the
|
|
362
374
|
first position -- which is what a JavaScript object does, and a dict too.
|
|
375
|
+
|
|
376
|
+
"Blank" is :func:`~fancy_flow.registry.blank.trimmed_key`, the helper
|
|
377
|
+
``validate_config`` judges a ``skipBlankRows`` row's text cells with -- so a
|
|
378
|
+
key the run skips is a key admission refuses whenever the row has a value.
|
|
363
379
|
"""
|
|
364
380
|
rows = config.get("fields")
|
|
365
381
|
if not isinstance(rows, list):
|
|
@@ -369,7 +385,7 @@ def _transform_rows(config: dict[str, Any]) -> list[tuple[str, Any]]:
|
|
|
369
385
|
if not isinstance(row, dict):
|
|
370
386
|
continue
|
|
371
387
|
key = row.get("key")
|
|
372
|
-
trimmed =
|
|
388
|
+
trimmed = trimmed_key(key)
|
|
373
389
|
if trimmed != "":
|
|
374
390
|
out.append((trimmed, row.get("value")))
|
|
375
391
|
return out
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""The one definition of a blank KEY, shared by ``transform``'s executor and the
|
|
2
|
+
validator that admits its config.
|
|
3
|
+
|
|
4
|
+
A key is the string stripped by ``str.strip()`` -- every character for which
|
|
5
|
+
``str.isspace()`` is true: ASCII tab, LF, vertical tab, form feed, CR and space,
|
|
6
|
+
the separators U+001C to U+001F, U+0085, U+00A0, and every Unicode ``Zs``,
|
|
7
|
+
``Zl`` and ``Zp`` character. A non-string is no key at all. It is blank when
|
|
8
|
+
that leaves ``""``.
|
|
9
|
+
|
|
10
|
+
It lives in its own module because the two callers used to carry their own
|
|
11
|
+
reading of "blank": the validator compared with ``""``, the executor stripped,
|
|
12
|
+
so ``{"key": " ", "value": "x"}`` was admitted and then dropped at run time.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from typing import Any
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def trimmed_key(key: Any) -> str:
|
|
21
|
+
"""``key`` stripped, or ``""`` when it is not a string."""
|
|
22
|
+
return key.strip() if isinstance(key, str) else ""
|
|
@@ -13,6 +13,7 @@ import copy
|
|
|
13
13
|
from typing import Any
|
|
14
14
|
|
|
15
15
|
from . import kind_id as kid
|
|
16
|
+
from .blank import trimmed_key
|
|
16
17
|
from .node_kind import ConfigField, NodeKind
|
|
17
18
|
|
|
18
19
|
__all__ = [
|
|
@@ -181,8 +182,19 @@ def _validate_field(field: ConfigField, value: Any) -> str | None:
|
|
|
181
182
|
return None
|
|
182
183
|
|
|
183
184
|
|
|
184
|
-
def _is_blank(cell: Any) -> bool:
|
|
185
|
-
|
|
185
|
+
def _is_blank(sub: ConfigField, cell: Any, strip_text: bool) -> bool:
|
|
186
|
+
"""A repeater cell is blank when it is absent, ``None`` or ``""``.
|
|
187
|
+
|
|
188
|
+
In a ``skip_blank_rows`` repeater a ``text`` cell that strips to ``""`` is
|
|
189
|
+
blank too, judged by :func:`~fancy_flow.registry.blank.trimmed_key` -- the
|
|
190
|
+
executor's own helper -- because that is how ``transform`` reads its key.
|
|
191
|
+
Without it a whitespace-only key with a value was admitted and the run
|
|
192
|
+
dropped the value. Only text cells (the value is never stripped), and only
|
|
193
|
+
where the kind opted in. TypeScript's ``isBlankCell``.
|
|
194
|
+
"""
|
|
195
|
+
if cell is None or cell == "":
|
|
196
|
+
return True
|
|
197
|
+
return strip_text and sub.type == "text" and isinstance(cell, str) and trimmed_key(cell) == ""
|
|
186
198
|
|
|
187
199
|
|
|
188
200
|
def _validate_repeater(field: ConfigField, value: Any) -> str | None:
|
|
@@ -199,11 +211,13 @@ def _validate_repeater(field: ConfigField, value: Any) -> str | None:
|
|
|
199
211
|
for index, row in enumerate(value, start=1):
|
|
200
212
|
if not isinstance(row, dict):
|
|
201
213
|
return f"{field.label} item {index} must be an object"
|
|
202
|
-
if field.skip_blank_rows and all(
|
|
214
|
+
if field.skip_blank_rows and all(
|
|
215
|
+
_is_blank(sub, row.get(sub.key), True) for sub in field.fields
|
|
216
|
+
):
|
|
203
217
|
continue
|
|
204
218
|
for sub in field.fields:
|
|
205
219
|
cell = row.get(sub.key)
|
|
206
|
-
if sub.required and _is_blank(cell):
|
|
220
|
+
if sub.required and _is_blank(sub, cell, field.skip_blank_rows):
|
|
207
221
|
return f"{field.label} item {index}: {sub.label} is required"
|
|
208
222
|
if cell is None:
|
|
209
223
|
continue
|
|
@@ -8,7 +8,7 @@ serializes differently per language is not a union.
|
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
|
-
from dataclasses import dataclass
|
|
11
|
+
from dataclasses import dataclass, replace
|
|
12
12
|
from typing import Any, ClassVar, Final
|
|
13
13
|
|
|
14
14
|
__all__ = ["NodeStatus", "RunEvent"]
|
|
@@ -56,6 +56,22 @@ class RunEvent:
|
|
|
56
56
|
ok: bool | None = None
|
|
57
57
|
error: str | None = None
|
|
58
58
|
|
|
59
|
+
def for_parent(self, prefix: str) -> RunEvent | None:
|
|
60
|
+
"""This event as a PARENT run sees it, or None if the parent must not.
|
|
61
|
+
|
|
62
|
+
Twin of fancy-flow-php's ``RunEvent::forParent`` (#25). A nested run
|
|
63
|
+
(``for_each`` over its item lane) emits events about nodes the host has
|
|
64
|
+
never heard of, under ids that collide with the parent's, so a
|
|
65
|
+
node-scoped event is re-addressed under ``prefix``. Run-scoped events
|
|
66
|
+
return None: a lane's ``run-start`` is not the workflow starting, once
|
|
67
|
+
per item. A node-scoped event with no node id passes through as is.
|
|
68
|
+
"""
|
|
69
|
+
if self.type in (self.RUN_START, self.RUN_END, self.RUN_ERROR):
|
|
70
|
+
return None
|
|
71
|
+
if self.node_id is None:
|
|
72
|
+
return replace(self)
|
|
73
|
+
return replace(self, node_id=prefix + self.node_id)
|
|
74
|
+
|
|
59
75
|
@classmethod
|
|
60
76
|
def run_start(cls) -> RunEvent:
|
|
61
77
|
return cls(cls.RUN_START)
|
|
@@ -63,7 +63,7 @@ from fancy_conformance import version
|
|
|
63
63
|
# CI checks out `ref: v<this>` from .github/workflows/ci.yml. Move the two
|
|
64
64
|
# together, and only after re-running the tables;
|
|
65
65
|
# test_ci_checks_out_the_fixture_tag_this_suite_pins fails otherwise.
|
|
66
|
-
PINNED_SUITE_VERSION = "0.
|
|
66
|
+
PINNED_SUITE_VERSION = "0.62.0"
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
def test_the_pinned_fixture_version_is_the_one_on_disk(
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""``for_each`` forwards what its item lane EMITS, as fancy-flow-php does (#25).
|
|
2
|
+
|
|
3
|
+
Each iteration ran its lane with no event sink, so every status, message and
|
|
4
|
+
log a lane node emitted was dropped. A host collecting events (a lab snapshot,
|
|
5
|
+
a progress feed) saw nothing from inside the loop: the PHP twin recorded five
|
|
6
|
+
per-item events for five items, and this engine recorded none.
|
|
7
|
+
|
|
8
|
+
The rule is PHP's ``RunEvent::forParent``: node-scoped events reach the parent
|
|
9
|
+
with their node id re-addressed as ``<for_each id>/<index>/<node id>``, and the
|
|
10
|
+
lane's own run-start / run-end / run-error are NOT forwarded.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from fancy_flow import ExecutorRegistry, FlowEdge, FlowGraph, FlowNode, FlowRunner, RunOptions
|
|
16
|
+
from fancy_flow.nodes import logic
|
|
17
|
+
from fancy_flow.runtime.events import RunEvent
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _recorder(ctx):
|
|
21
|
+
ctx.emit(RunEvent.log("info", "recorded", ctx.node.id, {"value": ctx.input("in")}))
|
|
22
|
+
return None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_events_emitted_inside_each_iteration_reach_the_host_re_addressed_per_item() -> None:
|
|
26
|
+
graph = FlowGraph(
|
|
27
|
+
(
|
|
28
|
+
FlowNode("each", "@particle-academy/for_each", config={"source": "{{ in.rows }}"}),
|
|
29
|
+
FlowNode("rec", "recorder"),
|
|
30
|
+
),
|
|
31
|
+
(FlowEdge("e1", "each", "rec", source_handle="item"),),
|
|
32
|
+
)
|
|
33
|
+
executors = (
|
|
34
|
+
ExecutorRegistry()
|
|
35
|
+
.bind("@particle-academy/for_each", logic.for_each)
|
|
36
|
+
.bind("recorder", _recorder)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
seen: list[RunEvent] = []
|
|
40
|
+
result = FlowRunner().run(
|
|
41
|
+
graph,
|
|
42
|
+
executors,
|
|
43
|
+
seen.append,
|
|
44
|
+
RunOptions(initial_inputs={"each": {"in": {"rows": ["a", "b", "c"]}}}),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
assert result.ok, result.error
|
|
48
|
+
logs = [e for e in seen if e.type == RunEvent.LOG and e.message == "recorded"]
|
|
49
|
+
assert [e.node_id for e in logs] == ["each/0/rec", "each/1/rec", "each/2/rec"]
|
|
50
|
+
assert [e.detail["value"] for e in logs] == ["a", "b", "c"]
|
|
51
|
+
|
|
52
|
+
# The result's own event list carries them too: that is what a host reads
|
|
53
|
+
# when it did not pass a sink.
|
|
54
|
+
assert [
|
|
55
|
+
e.node_id for e in result.events if e.type == RunEvent.LOG and e.message == "recorded"
|
|
56
|
+
] == [
|
|
57
|
+
"each/0/rec",
|
|
58
|
+
"each/1/rec",
|
|
59
|
+
"each/2/rec",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
assert any(
|
|
63
|
+
e.type == RunEvent.NODE_STATUS and e.node_id == "each/1/rec" and e.status == "done"
|
|
64
|
+
for e in seen
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# The lanes' own run boundaries are not the parent's.
|
|
68
|
+
assert len([e for e in seen if e.type == RunEvent.RUN_START]) == 1
|
|
69
|
+
assert len([e for e in seen if e.type == RunEvent.RUN_END]) == 1
|
|
@@ -19,6 +19,7 @@ from typing import Any
|
|
|
19
19
|
import pytest
|
|
20
20
|
|
|
21
21
|
from fancy_flow import FlowRunner, NodeKindRegistry, RunOptions, builtin, import_workflow
|
|
22
|
+
from fancy_flow.registry.node_kind import NodeKind
|
|
22
23
|
|
|
23
24
|
EDITOR_DEFAULTS = {"mode": "fields", "fields": [{"key": "", "value": ""}]}
|
|
24
25
|
|
|
@@ -146,6 +147,77 @@ def test_invalid_configs_are_still_refused(
|
|
|
146
147
|
assert registry.validate_config(kind(registry), config) == issues
|
|
147
148
|
|
|
148
149
|
|
|
150
|
+
# -- a whitespace-only key is blank, in admission as in the executor -----------
|
|
151
|
+
#
|
|
152
|
+
# ``{"key": " ", "value": "Configured synthetic value"}`` validated with no
|
|
153
|
+
# issue (the check compared with ""), then ran as a passthrough: the executor
|
|
154
|
+
# strips the key, finds it blank and skips the row, so the value vanished.
|
|
155
|
+
# Reported by Maipa against the published 0.30.0. Messages read off
|
|
156
|
+
# ``@particle-academy/fancy-flow`` 0.82.1.
|
|
157
|
+
|
|
158
|
+
KEY_REQUIRED = [{"key": "fields", "message": "Output fields item 1: Key is required"}]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def test_a_whitespace_only_key_with_a_value_is_refused(registry: NodeKindRegistry) -> None:
|
|
162
|
+
config = {"mode": "fields", "fields": [{"key": " ", "value": "Configured synthetic value"}]}
|
|
163
|
+
assert registry.validate_config(kind(registry), config) == KEY_REQUIRED
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
@pytest.mark.parametrize("key", ["\t", "\n", " \r\n ", chr(0x00A0), chr(0x2003), chr(0x3000)])
|
|
167
|
+
def test_every_whitespace_the_executor_strips_is_refused(
|
|
168
|
+
registry: NodeKindRegistry, key: str
|
|
169
|
+
) -> None:
|
|
170
|
+
config = {"mode": "fields", "fields": [{"key": key, "value": "x"}]}
|
|
171
|
+
assert registry.validate_config(kind(registry), config) == KEY_REQUIRED
|
|
172
|
+
# ...and the executor really does drop that row: same helper, same verdict.
|
|
173
|
+
assert run(config, {"a": 1}) == {"a": 1}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def test_a_whitespace_only_key_with_an_empty_value_is_a_blank_row(
|
|
177
|
+
registry: NodeKindRegistry,
|
|
178
|
+
) -> None:
|
|
179
|
+
fields_mode = {"mode": "fields", "fields": [{"key": " ", "value": ""}]}
|
|
180
|
+
assert registry.validate_config(kind(registry), fields_mode) == []
|
|
181
|
+
assert (
|
|
182
|
+
registry.validate_config(kind(registry), {"mode": "fields", "fields": [{"key": "\t"}]})
|
|
183
|
+
== []
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def test_a_padded_key_is_admitted_and_runs_under_the_trimmed_key(
|
|
188
|
+
registry: NodeKindRegistry,
|
|
189
|
+
) -> None:
|
|
190
|
+
config = {"mode": "fields", "fields": [{"key": " name ", "value": "{{ $json.first }}"}]}
|
|
191
|
+
assert registry.validate_config(kind(registry), config) == []
|
|
192
|
+
assert run(config, {"first": "Ada"}) == {"name": "Ada"}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def test_the_value_is_judged_unstripped(registry: NodeKindRegistry) -> None:
|
|
196
|
+
padded = {"mode": "fields", "fields": [{"key": "pad", "value": " "}]}
|
|
197
|
+
assert registry.validate_config(kind(registry), padded) == []
|
|
198
|
+
no_key = {"mode": "fields", "fields": [{"key": "", "value": " "}]}
|
|
199
|
+
assert registry.validate_config(kind(registry), no_key) == KEY_REQUIRED
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def test_a_repeater_that_did_not_opt_in_does_not_strip(registry: NodeKindRegistry) -> None:
|
|
203
|
+
other = NodeKind.from_dict(
|
|
204
|
+
{
|
|
205
|
+
"name": "acme/rows",
|
|
206
|
+
"category": "logic",
|
|
207
|
+
"label": "Rows",
|
|
208
|
+
"configSchema": [
|
|
209
|
+
{
|
|
210
|
+
"type": "repeater",
|
|
211
|
+
"key": "rows",
|
|
212
|
+
"label": "Rows",
|
|
213
|
+
"fields": [{"type": "text", "key": "key", "label": "Key", "required": True}],
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
assert registry.validate_config(other, {"rows": [{"key": " "}]}) == []
|
|
219
|
+
|
|
220
|
+
|
|
149
221
|
# -- execution ---------------------------------------------------------------
|
|
150
222
|
|
|
151
223
|
|