feat!: add path.base.branch + schema-validating path validate#69
Merged
Conversation
Reconcile the workspace with the RFC after the simplification commit. Two drifts addressed: 1. `path.base` now has a real `branch` field. The PR-shaped example fixtures originally carried both `ref:"main"` (branch) and `commit:"abc123…"` (SHA), but the simplified `Base` had no slot for the SHA — serde silently dropped it on every round-trip. Splitting `ref` and `branch` makes both pieces of state round-trippable. `toolpath-github` was the load-bearing bug: it was writing the branch name into `ref` and discarding the SHA. 2. `path validate` now actually validates against `schema/toolpath.schema.json`. Previously it only round-tripped through the Rust types, so any field with no Rust home (like the stale `commit`) was silently accepted. A new integration test schema-validates every `examples/*.json` fixture so future drift is caught at `cargo test` time. Public API changes (pre-1.0 = potentially breaking): - toolpath 0.3.0 → 0.4.0 — `Base.branch: Option<String>` added; `with_branch` builder. - toolpath-github 0.2.1 → 0.3.0 — behavioral: `Base.ref` now reads `pr.base.sha`; `Base.branch` reads `pr.base.ref`. Re-derive any PR to get the corrected shape. - toolpath-git 0.2.0 → 0.3.0 — populates `Base.branch` from spec. - toolpath-codex 0.1.0 → 0.2.0 — populates `Base.branch` from `session_meta.git.branch`. - toolpath-md 0.3.0 → 0.4.0 — renders `branch` alongside `ref`. - path-cli 0.6.0 → 0.7.0 — new `jsonschema` runtime dep; schema validation wired into `path validate`; new `schema_examples` integration test. - toolpath-cli 0.6.0 → 0.7.0 — lockstep shim bump. Schema: - `base.branch` added (optional). Only `uri` is required. - `pathIdentity.base` no longer required (matches Rust `Option<Base>` and the RFC's minimal-step example). - Descriptions softened: `base` is an "origin identifier", not strictly a "VCS reference". Examples: - The four PR-shaped fixtures and their `.path.jsonl` siblings carry their original SHAs in `ref` again with `"main"` moved to `branch`. `path-02-local-session.path.json`'s standalone `commit` was renamed to `ref`. Cosmetic: - `crates/path-cli/src/cmd_query.rs` — "Document has no head step" → "Graph has no head step" (the `Document` enum is gone). Tests: cargo build, cargo test --workspace (1354 passed, 0 failed), cargo clippy --workspace -- -D warnings all green.
|
🔍 Preview deployed: https://6031b92f.toolpath.pages.dev |
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.
Reconcile the workspace with the RFC after the simplification commit. Two drifts addressed:
path.basenow has a realbranchfield. The PR-shaped example fixtures originally carried bothref:"main"(branch) andcommit:"abc123…"(SHA), but the simplifiedBasehad no slot for the SHA — serde silently dropped it on every round-trip. Splittingrefandbranchmakes both pieces of state round-trippable.toolpath-githubwas the load-bearing bug: it was writing the branch name intorefand discarding the SHA.path validatenow actually validates againstschema/toolpath.schema.json. Previously it only round-tripped through the Rust types, so any field with no Rust home (like the stalecommit) was silently accepted. A new integration test schema-validates everyexamples/*.jsonfixture so future drift is caught atcargo testtime.Public API changes (pre-1.0 = potentially breaking):
Base.branch: Option<String>added;with_branchbuilder.Base.refnow readspr.base.sha;Base.branchreadspr.base.ref. Re-derive any PR to get the corrected shape.Base.branchfrom spec.Base.branchfromsession_meta.git.branch.branchalongsideref.jsonschemaruntime dep; schema validation wired intopath validate; newschema_examplesintegration test.Schema:
base.branchadded (optional). Onlyuriis required.pathIdentity.baseno longer required (matches RustOption<Base>and the RFC's minimal-step example).baseis an "origin identifier", not strictly a "VCS reference".Examples:
.path.jsonlsiblings carry their original SHAs inrefagain with"main"moved tobranch.path-02-local-session.path.json's standalonecommitwas renamed toref.Cosmetic:
crates/path-cli/src/cmd_query.rs— "Document has no head step" → "Graph has no head step" (theDocumentenum is gone).Tests: cargo build, cargo test --workspace (1354 passed, 0 failed), cargo clippy --workspace -- -D warnings all green.