Skip to content

test(kinds): route kind-URI literals through the constants - #164

Open
akesling wants to merge 1 commit into
mainfrom
akesling/kind-uri-constants
Open

test(kinds): route kind-URI literals through the constants#164
akesling wants to merge 1 commit into
mainfrom
akesling/kind-uri-constants

Conversation

@akesling

@akesling akesling commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Supersedes #163, which GitHub auto-marked as merged when the branch was restructured (its commits briefly appeared in its former base branch). Same change, retargeted to main where it belongs.

Why

Minting a kind version restates its URI in a lot of places. Today most of those places are test literals and registration glue re-spelling a URI that PATH_KIND_AGENT_CODING_SESSION already holds — duplication that lets a typo pass its own tests.

Landing this before the next mint means the mint itself touches only the constant, its schema file, its BUNDLED_KINDS entry, the site page, and the changelog.

What

Tests and registration glue go through the constants (and BUNDLED_KINDS for "newest") instead of restating the version, across toolpath::{types,jsonl}, toolpath-convo::derive, and path-cli::{kinds,cmd_kind,schema,query} plus tests/query.rs. Tests that deliberately pin older versions keep using the version-suffixed constants, and stored fixture documents are left alone — a document's kind URI is data, not a shared string.

Two tests stay deliberately literal, for opposite reasons:

  • One pin test in toolpath::types spells the current URI in full, so a typo in the constant cannot self-validate through every test that consumes the constant.
  • A new coherence test in path-cli::kinds binds each bundled entry together: the schema's $id and meta.kind const match the entry's URI, the URI's name/version segments match the entry's fields, the compiled-in bytes match the on-disk kinds/<name>/<version>/schema.json, and the newest entry equals the constant. Mutation-tested during review — pointing a bundled entry at the wrong version's schema fails it.

path-cli's kinds module becomes pub so the integration test can iterate BUNDLED_KINDS, matching the existing pub-for-tests precedent in that crate (harness, cmd_resume).

Testing

Full workspace suite, clippy, rustdoc, and the examples gate green. No behavior change — production code already flowed through the constants; this is tests and registration glue only.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Tests and registration glue spell the agent-coding-session URI via
PATH_KIND_AGENT_CODING_SESSION (and the superseded-version constants)
instead of restating the version, so a future mint touches only the
constant, the schema file, its BUNDLED_KINDS entry, the site page, and
the changelog. One deliberate literal remains: a pin test spelling the
full URI so a typo in the constant cannot self-validate.

A new coherence test binds each bundled entry together: schema $id and
meta.kind const match the entry URI, the URI's segments match the
entry's name/version, the bundled bytes match the on-disk schema, and
the newest entry is the current constant. path-cli's kinds module goes
pub so integration tests can iterate BUNDLED_KINDS, matching the
existing pub-for-tests precedent in the crate; its module docs name the
private schema module in prose rather than linking it, since a public
module's docs cannot link a private item.
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.

1 participant