Skip to content

fix: make derive_path actors conform to the base schema#87

Merged
benbaarber merged 1 commit into
mainfrom
ben/actor-schema-validation
May 20, 2026
Merged

fix: make derive_path actors conform to the base schema#87
benbaarber merged 1 commit into
mainfrom
ben/actor-schema-validation

Conversation

@ben-emp
Copy link
Copy Markdown
Collaborator

@ben-emp ben-emp commented May 20, 2026

Problem

Path documents produced by this project's own provider crates fail the project's own base JSON Schema, and nothing tested it.

derive_path emitted three actor forms the base schema's actorRef rejects:

  • provider:<name> on event steps (hundreds per Claude session)
  • <role>:unknown on Role::Other turns (pi's bash/tool/custom outputs)
  • any agent:<model> whose model contains a . (e.g. gpt-5.5, claude-sonnet-4.6) — the actorRef name segment disallowed .

Real claude/codex sessions produced 15–41 violations each against toolpath.schema.json.

Fix

  • toolpathactorRef permits the system prefix and . in the name segment.
  • toolpath-convoderive_path maps event steps and Role::Other turns to tool:<provider>. No information is lost: the role label already lives in the change's role field, so the actor string doesn't need to carry it.
  • toolpath-convo — new test derives a path covering every actor variant (human/agent with a dotted model/system/Role::Other) plus an event, then validates the result against the embedded base schema. This is the missing coverage; it'll catch any future derive/schema drift. Pulls jsonschema in as a dev-dependency only (not in the published dep graph).

Test plan

  • cargo test -p toolpath -p toolpath-convo
  • cargo clippy --workspace --tests -- -D warnings
  • new derived_path_validates_against_base_schema passes; fails if reverted

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

🔍 Preview deployed: https://6fd8540c.toolpath.pages.dev

@ben-emp ben-emp force-pushed the ben/actor-schema-validation branch 2 times, most recently from 20867cb to acf4ffd Compare May 20, 2026 18:54
@benbaarber benbaarber requested a review from akesling May 20, 2026 18:57
Path documents produced by this project's own provider crates failed the
base JSON Schema, and nothing tested it.

derive_path emitted actor strings the base actorRef rejected:
- provider:<name> on event steps
- system:<provider> on system turns
- <role>:unknown on Role::Other turns
None of those prefixes are in the human|agent|tool|ci vocabulary. Separately
the actorRef name segment disallowed '.', so any agent:<model> with a dotted
model name (e.g. gpt-5.5) failed.

- toolpath: actorRef's name segment now allows '.'.
- toolpath-convo: event steps, system turns, and Role::Other turns all map to
  tool:<provider>; the role label is preserved in the change's 'role' field.
- toolpath-convo: new test derives a path covering every actor variant and an
  event, then validates it against the embedded base schema.
@ben-emp ben-emp force-pushed the ben/actor-schema-validation branch from acf4ffd to 5648012 Compare May 20, 2026 19:25
Copy link
Copy Markdown
Contributor

@akesling akesling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benbaarber benbaarber merged commit 43c888b into main May 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants