refactor: type the example source inline instead of shipping a manifest
A dora-node.yml describes exactly one node and is the unit `dora hub publish` operates on, which expects it beside pyproject.toml. This repository ships one node, so it should carry one manifest. examples/dora-node.yml described a test fixture that nobody installs and that has no package of its own -- a manifest for something that is not a node. The source's outputs are now annotated with `output_types:` in the dataflow, which is the documented way to type an output without a manifest: "only annotated outputs are type-checked". It runs as `path: python` + `args:` because `dora validate` matches a manifest to a `path:` node by entrypoint, so a path node would be tried against the root manifest, fail to match `dora-image-view`, and warn -- fatal under strict_types. Through the interpreter there is nothing to match. The type gate is unchanged in strength: the viewer's contract is still injected and compared against the source's annotations, and a deliberate Float32 -> String swap still fails validate. The cost is that the fixture no longer gets a managed venv of its own and runs against the project environment. That applies to the fixture only; the shipped node still uses path: + build:, which is what a consumer exercises. This supersedes the approach in "fix strict-type validation by giving the example source a manifest" and the doc commit that cited the manifest-next-to-a-path-node rule as justification.
This commit is contained in:
@@ -49,7 +49,7 @@ dora run dataflow.yml --uv
|
||||
A window opens with a square bouncing across a gradient, boxed and labelled. Press `q`
|
||||
to quit.
|
||||
|
||||
It builds both nodes from this checkout (`path:` + `build:`) rather than from a tag,
|
||||
It builds the viewer from this checkout (`path:` + `build:`) rather than from a tag,
|
||||
which is what lets `dora validate` pick up the manifest described below.
|
||||
|
||||
Set `SOURCE_FRAMES` to stop the source after a fixed number of frames instead of running
|
||||
@@ -66,16 +66,19 @@ CI=true SOURCE_FRAMES=30 dora run dataflow.yml --uv
|
||||
[`dora-node.yml`](dora-node.yml) declares the node's inputs with type URNs. No source
|
||||
package is shared between node repositories, so it is the only contract a consumer has,
|
||||
and it is what makes a wiring mistake fail at build time instead of at runtime. The
|
||||
example source has a manifest of its own, so `dora validate` checks the two against
|
||||
each other:
|
||||
example source is typed inline in the dataflow with `output_types:`, so `dora validate`
|
||||
checks the two against each other:
|
||||
|
||||
```
|
||||
$ dora validate dataflow.yml
|
||||
node "source": injected 2 contract type(s) from .../examples/dora-node.yml
|
||||
node "view": injected 2 contract type(s) from .../dora-node.yml
|
||||
node "view": injected 4 contract type(s) from .../dora-node.yml
|
||||
All type annotations OK.
|
||||
```
|
||||
|
||||
There is one manifest because this repository ships one node. The example source is a
|
||||
test fixture rather than something anyone installs, so it has none, and runs through
|
||||
the interpreter to keep `dora validate` from matching the viewer's manifest against it.
|
||||
|
||||
`image` is `std/core/v1/UInt8`, `depth` and `camera_info` are `std/core/v1/Float32` and
|
||||
`text` is `std/core/v1/String`; the payloads are raw buffers described by their
|
||||
metadata, so the URN names the element type rather than a struct. `bbox` is deliberately
|
||||
|
||||
Reference in New Issue
Block a user