Simplify toolpath format to single Graph root#63
Merged
eliothedeman merged 1 commit intomainfrom Apr 28, 2026
Merged
Conversation
|
🔍 Preview deployed: https://db8fdccf.toolpath.pages.dev |
akesling
approved these changes
Apr 27, 2026
| PascalCase variant names visually distinguish the type tag from the lowercase | ||
| structural fields inside (`step`, `path`, `graph`). | ||
| A "single PR" or "single conversation" is just a Graph that holds one inline | ||
| path in `paths`. A "release" is a Graph with several paths (or `$ref`s). |
Contributor
There was a problem hiding this comment.
What is a "release"? Did the LLM eat its tail here?
| @@ -1,29 +1,31 @@ | |||
| //! JSONL streaming format for `Path` documents. | |||
| //! JSONL streaming format for single-path Toolpath documents. | |||
Contributor
There was a problem hiding this comment.
Not necessary in this PR, but do we want to allow general graph streaming via the JSONL?
Collaborator
Author
There was a problem hiding this comment.
yes absolutely
|
LGTM as well |
Remove the `Document` enum and the `{"Step":…}` / `{"Path":…}` /
`{"Graph":…}` envelope. Every `.path.json` file is a `Graph` at the root;
every `.path.jsonl` file is a single-path `Graph` at the file boundary.
What was a bare Step or Path is now wrapped in a single-path Graph —
one schema, one parser path, no envelope to detect.
Why: the three-variant root pushed discriminator logic into every
consumer (CLI commands, renderers, schema, fixtures, docs). Collapsing
to a single root type makes file shape uniform and removes a class of
"which kind is this?" branching across the workspace.
Public API changes (pre-1.0 = potentially breaking):
- toolpath 0.2.0 → 0.3.0 — Document enum removed; new helpers on Graph
(`from_json`/`to_json`/`to_json_pretty`, `from_path`, `single_path`,
`into_single_path`) plus JSONL on Graph (`Graph::from_jsonl_*` /
`to_jsonl_*` wrap a single inline Path; new `JsonlError::NotSinglePathGraph`)
- toolpath-git 0.1.3 → 0.2.0 — `derive` returns Graph
- toolpath-dot 0.1.2 → 0.2.0 — `render` takes &Graph (single-path graphs
use the path layout, multi-path use the cluster layout)
- toolpath-md 0.2.0 → 0.3.0 — `render` takes &Graph (same dispatch)
- toolpath-pi 0.2.0 → 0.3.0 — `derive_project` returns Graph
- toolpath-cli 0.5.0 → 0.6.0 — file format change end-to-end
CLI: `validate`, `render`, `query`, `merge`, `import`, `export`, `track`,
`cache` all read/write Graph at file boundaries. `export claude` and
`export gemini` reject multi-path graphs with a clear error.
Examples: `step-NN.json` are now single-path single-step graphs;
`path-NN.path.json` are single-path graphs; `graph-01-release.json`
drops its envelope. JSONL fixtures regenerated.
Schema: `schema/toolpath.schema.json` collapses the root `oneOf` of
three envelopes into a direct `$ref` to the `graph` definition.
Docs: RFC.md, docs/RFC-jsonl.md, README.md, CHANGELOG.md, and per-crate
READMEs all updated.
Tests: workspace fully green (cargo build, cargo test --workspace,
cargo clippy --workspace -- -D warnings). Render-md snapshot tests for
step examples regenerated under the new single-path-graph rendering.
023a301 to
4c1ee8c
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documentenum and the{"Step":…}/{"Path":…}/{"Graph":…}envelope. Every.path.jsonfile is aGraphat the root; every.path.jsonlfile is a single-pathGraphat the file boundary.What changed
Core
toolpath0.2.0 → 0.3.0:Documentremoved. NewGraphhelpers:from_json/to_json/to_json_pretty,from_path,single_path,into_single_path. JSONL helpers onGraphwrap a single inlinePath(newJsonlError::NotSinglePathGraph).Provider crates
toolpath-git0.1.3 → 0.2.0:derivereturnsGraph(single branch → single-path graph; multi-branch → multi-path graph).toolpath-pi0.2.0 → 0.3.0:derive_projectreturnsGraph.Renderers
toolpath-dot0.1.2 → 0.2.0:render(&Graph, …). Single-path graphs use the path layout, multi-path use clusters.toolpath-md0.2.0 → 0.3.0:render(&Graph, …). Same dispatch.CLI (
toolpath-cli0.5.0 → 0.6.0)validate,render,query,merge,import,export,track,cacheall operate onGraphat file boundaries.export claude/export geminireject multi-path graphs with a clear error — projection requires exactly one inline path.Format artifacts
examples/step-NN.jsonare now single-path single-step graphs.examples/path-NN.path.jsonare single-path graphs (no envelope).examples/graph-01-release.jsondrops its envelope. All.path.jsonlregenerated.schema/toolpath.schema.jsoncollapses the rootoneOfof three envelopes into$ref: #/$defs/graph.RFC.md,docs/RFC-jsonl.md,README.md,CHANGELOG.md, and per-crate READMEs updated.Why
The three-variant root forced discriminator logic into every consumer (CLI commands, renderers, schema validators, fixture writers, docs). Collapsing to one root type removes that branching and gives every file a uniform shape — what used to be a bare Step or Path is now a degenerate single-path graph.
Reviewer notes
Mid-way through the change I made a tooling misstep: an early
cppartially clobbered two large files. I restored both fromHEADand re-applied just theDocument → Graphmigration, but it's worth a focused look at:crates/toolpath-cli/src/cmd_import.rs— fzf integration restored from HEAD; onlyDocument::*→Graph::*swaps and thedoc_summary/doc_inner_idsimplifications should appear in the diff.crates/toolpath-cli/src/cmd_export.rs— full gemini-export code restored from HEAD; onlyDocument::*→Graph::*swaps plus the new "reject multi-path graph" error path.Diff vs. main on those two files should show no behavior or feature changes beyond the format migration.
Test plan
cargo build --workspacecleancargo test --workspace— all tests passing across every crate (no failures)cargo clippy --workspace -- -D warningscleancargo run -p toolpath-cli -- validate --input <each>passes for all 16 example fixtures (12 JSON graphs + 4 JSONL streams)path import git→ cache →path render dot/md→path validateflowpath import claude --no-cache | path export clauderound-trip on a real session