Add a Makefile target for plan viewer
This commit is contained in:
parent
a1d4c679d2
commit
c7560555b7
12
Makefile
12
Makefile
@ -99,6 +99,18 @@ export-fixtures: ## Regenerate plan JSON for every tools/exporter/examples/*.sce
|
||||
examples: export-fixtures ## Regenerate fixtures from scenarios and run them through plan-runner against their oracles.
|
||||
@cargo test -p plan-runner --test examples
|
||||
|
||||
VIEWER_PORT ?= 8000
|
||||
|
||||
.PHONY: viewer
|
||||
viewer: ## Serve the repository over HTTP for the plan viewer (override the port with VIEWER_PORT=...)
|
||||
@if ! command -v python3 >/dev/null 2>&1; then \
|
||||
echo "python3 not found. Enter the dev shell with 'make shell' (or 'nix develop') first."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "Plan viewer: http://localhost:$(VIEWER_PORT)/tools/plan-viewer/index.html"
|
||||
@echo "Example: http://localhost:$(VIEWER_PORT)/tools/plan-viewer/index.html?fixture=../../crates/plan-runner/fixtures/two_atom_join.json"
|
||||
@python3 -m http.server $(VIEWER_PORT)
|
||||
|
||||
.PHONY: shell
|
||||
shell: ## Enter the Nix dev shell defined in flake.nix
|
||||
@nix develop
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
# Plan Viewer
|
||||
## Query Plan Viewer
|
||||
|
||||
A static HTML viewer for `plan-runner` fixtures.
|
||||
A static HTML viewer for `plan-runner` JSON files (the fixtures).
|
||||
It renders the plan DAG, the input facts, and the relation computed at every plan node, so a fixture can be inspected without reading raw JSON.
|
||||
|
||||
## Usage
|
||||
### Usag
|
||||
|
||||
Open [`index.html`](index.html) in a browser, then drop a fixture from `crates/plan-runner/fixtures/` onto the page or pick one with the file input.
|
||||
|
||||
When the repository is served over HTTP, a fixture can also be loaded through a query parameter:
|
||||
|
||||
```sh
|
||||
python3 -m http.server 8000
|
||||
# then open:
|
||||
make viewer # Or `VIEWER_PORT=9000 make viewer`
|
||||
# Then open:
|
||||
# http://localhost:8000/tools/plan-viewer/index.html?fixture=../../crates/plan-runner/fixtures/two_atom_join.json
|
||||
```
|
||||
|
||||
@ -26,7 +26,7 @@ python3 -m http.server 8000
|
||||
|
||||
The header badge reports whether the evaluated bindings match the fixture's `expected_bindings` as a multiset, mirroring `plan_runner::verify`.
|
||||
|
||||
## Scope
|
||||
### Scope
|
||||
|
||||
The viewer re-implements the scan, semijoin, and natural join semantics of `crates/query-ops` and the execution order of `crates/plan-runner` in JavaScript, for display only.
|
||||
The Rust crates and their tests remain the correctness oracle; if the two ever disagree, the Rust behavior wins and the viewer has a bug.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user