diff --git a/.changeset/sta-445-schemas.md b/.changeset/sta-445-schemas.md new file mode 100644 index 000000000..8fb405bfc --- /dev/null +++ b/.changeset/sta-445-schemas.md @@ -0,0 +1,7 @@ +--- +"@stainless-code/verdict": minor +--- + +**Breaking changes** + +Published JSON schemas moved from `skills/verdict/schemas/` to `/schemas/`; every `$id` changed accordingly. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba065ef43..9b8c4836b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,11 +70,11 @@ rename in the tree. The binary installs its own embedded skill copy with ``` verdict/ - skills/verdict/ # the skill payload, exactly what `verdict skill files` lists: + skills/verdict/ # the skill payload copied by `npx skills add`: SKILL.md # skill entry point (feed to any agent) prompts/ # system, review, incremental, address, fix-ci, build, ci, grade, diagrams, subagent - schemas/ # JSON Schemas for the envelope and store files scripts/verdict # POSIX skill shim: VERDICT_BIN, bundled bin, PATH, then bootstrap + schemas/ # published JSON Schemas, served by `verdict skill files` at schemas/ install.sh # verified binary installer (macOS/Linux release asset) install.ps1 # verified binary installer (Windows release asset) install-skill.sh # doctor-gated symlink installer for checkouts diff --git a/README.md b/README.md index 7f31bb0ce..c0cba7947 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Inputs are `version` (default `latest`) and `require-signature` (default `true`) - **MCP.** `verdict mcp` serves the review verbs as tools over stdio. `verdict mcp config --agent claude` prints the config entry, and `--write` merges it into the file. It supports `claude`, `cursor`, and `codex`, and is experimental until 1.0. See the [manual](docs/manual.md#mcp-server-stdio-experimental-until-10). - **Go SDK.** [`pkg/verdict`](pkg/verdict) runs the verbs in-process for Go programs, with typed requests and responses — no `verdict` subprocess, no `--json` parsing. - **TypeScript client.** `import { createClient } from "@stainless-code/verdict/client"`. It ships in the npm package. See [`clients/ts`](clients/ts/README.md). -- **Other languages.** Every `--json` envelope and store file has a JSON Schema in [`skills/verdict/schemas/`](skills/verdict/schemas). The [Build a client guide](https://stainless-code.com/verdict/build-a-client) covers exit codes and codegen, with a tested [Python example](examples/python-client/). +- **Other languages.** Every `--json` envelope and store file has a JSON Schema in [`schemas/`](schemas). The [Build a client guide](https://stainless-code.com/verdict/build-a-client) covers exit codes and codegen, with a tested [Python example](examples/python-client/). ## Hosts diff --git a/apps/docs/content/01-docs/(build-on-verdict)/build-a-client.mdx b/apps/docs/content/01-docs/(build-on-verdict)/build-a-client.mdx index 62d13c869..05e432844 100644 --- a/apps/docs/content/01-docs/(build-on-verdict)/build-a-client.mdx +++ b/apps/docs/content/01-docs/(build-on-verdict)/build-a-client.mdx @@ -39,7 +39,7 @@ verdict report acme/app 123 --json Every successful `--json` run prints one object with these nine keys, in this order. The [JSON envelope and exit codes](/docs/json-envelope) reference pins this table with the exit codes. The -[envelope schema](https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/envelope.schema.json) +[envelope schema](https://github.com/stainless-code/verdict/blob/main/schemas/envelope.schema.json) is generated from the Go shape and is the machine-readable source of truth. | Key | Type | Meaning | @@ -153,7 +153,7 @@ release version. - **A major change needs a new `schema_version`.** A client must reject an unknown major instead of guessing. The schemas README (`make schemas`) remains the source of truth: - [schemas/README.md](https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/README.md). + [schemas/README.md](https://github.com/stainless-code/verdict/blob/main/schemas/README.md). - **The clients, the Go SDK, and the MCP tool shapes are experimental until 1.0.** Their ergonomics may change without a major schema bump. The envelope contract does not. @@ -253,7 +253,7 @@ The profiles are `$defs` entries, not a `oneOf` on `data`: the envelope keeps one open `data` object so a client that does not know a verb can still read it. The schemas are published under -[`skills/verdict/schemas/`](https://github.com/stainless-code/verdict/tree/main/skills/verdict/schemas). They +[`schemas/`](https://github.com/stainless-code/verdict/tree/main/schemas). They also ship in the npm package and inside the binary. `verdict skill files` lists them. There is no hosted schema URL yet, so link the repo path. `verdict mcp` serves the verbs over stdio and has no `--json` envelope of its @@ -302,7 +302,7 @@ python3 -m venv .venv pip install -r examples/python-client/requirements-dev.txt datamodel-codegen \ - --input skills/verdict/schemas/envelope.schema.json \ + --input schemas/envelope.schema.json \ --input-file-type jsonschema \ --output examples/python-client/models.py \ --output-model-type dataclasses.dataclass \ diff --git a/apps/docs/content/01-docs/(reference)/json-envelope.mdx b/apps/docs/content/01-docs/(reference)/json-envelope.mdx index 75b6ff9af..cf9e04410 100644 --- a/apps/docs/content/01-docs/(reference)/json-envelope.mdx +++ b/apps/docs/content/01-docs/(reference)/json-envelope.mdx @@ -40,7 +40,7 @@ A failure keeps `data` null and names a typed `error.code` with its cause and fi ## Schemas -The shapes live in `skills/verdict/schemas/`, generated from `internal/schemagen/model.go` and shipped in the npm tarball. `envelope.schema.json` covers the envelope plus the 21 pinned `Data` profiles (including `report`, `post`, and `record`). Pin one by vendoring the file at a release tag and generating types from it — the Python client example checks in `models.py` generated exactly this way — and refuse at runtime when `schema_version` is not `"1"`. +The shapes live in `schemas/`, generated from `internal/schemagen/model.go` and shipped in the npm tarball. `envelope.schema.json` covers the envelope plus the 21 pinned `Data` profiles (including `report`, `post`, and `record`). Pin one by vendoring the file at a release tag and generating types from it — the Python client example checks in `models.py` generated exactly this way — and refuse at runtime when `schema_version` is not `"1"`. ## Worked example diff --git a/apps/docs/content/01-docs/(start)/glossary.mdx b/apps/docs/content/01-docs/(start)/glossary.mdx index 812347e11..18a728be4 100644 --- a/apps/docs/content/01-docs/(start)/glossary.mdx +++ b/apps/docs/content/01-docs/(start)/glossary.mdx @@ -46,9 +46,9 @@ tools. Commands accept a unique short prefix. ## Surfaces -**Skill.** The instructions an agent loads to run a review: `SKILL.md`, -`prompts/`, and `schemas/`. The binary carries its own copy, and -`verdict skill install` writes it into an agent's skills directory. +**Skill.** The instructions an agent loads to run a review: `SKILL.md` and +`prompts/`. The binary carries its own copy and the published `schemas/`; +`verdict skill install` writes them into an agent's skills directory. **Envelope.** The one JSON object a `--json` run prints to stdout. It has nine fixed keys and `schema_version: "1"`. New information goes inside `data`. See diff --git a/apps/docs/content/04-roadmap/index.mdx b/apps/docs/content/04-roadmap/index.mdx index da2f3b4e6..5a16818ed 100644 --- a/apps/docs/content/04-roadmap/index.mdx +++ b/apps/docs/content/04-roadmap/index.mdx @@ -30,7 +30,7 @@ Planned means it is not built yet, and says so on its own line. | Housekeeping | `init`, `config`, `pack`, `learn`, `upgrade`, `uninstall` | Repo config, explain policy, lens packs (`pack list`, `pack test`, `pack add`), project rules with provenance, and channel-aware upgrades and removals. | Clients and actions over those verbs: the Go SDK (`pkg/verdict`), the TypeScript -client (`@stainless-code/verdict/client`), the JSON schemas in `skills/verdict/schemas/`, and +client (`@stainless-code/verdict/client`), the JSON schemas in `schemas/`, and `setup-verdict` for GitHub Actions. diff --git a/bench/corpus/README.md b/bench/corpus/README.md index 29fa8b9af..c4258e541 100644 --- a/bench/corpus/README.md +++ b/bench/corpus/README.md @@ -7,7 +7,7 @@ bundle with ground truth: ``` bench/corpus// - case.json # ground truth + provenance (skills/verdict/schemas/corpus.schema.json) + case.json # ground truth + provenance (schemas/corpus.schema.json) full.diff # real git diff of the reviewed change, with the bug lines in hunks snapshots/.before # the reviewed base tree snapshots/.after # the reviewed head tree @@ -124,7 +124,7 @@ bench/corpus/--/ real case never enters the hermetic rates. Real cases are scored by live runs under `.verdict/state/`, as `docs/benchmark.md` §2 describes. -Do not edit `skills/verdict/schemas/corpus.schema.json` by hand; run `make schemas`. +Do not edit `schemas/corpus.schema.json` by hand; run `make schemas`. The operator runbook for real PRs, real agents, cost estimates, and publishing measured rates lives in [`docs/benchmark.md`](../../docs/benchmark.md). diff --git a/clients/ts/README.md b/clients/ts/README.md index fab3c49a4..48b049f5f 100644 --- a/clients/ts/README.md +++ b/clients/ts/README.md @@ -109,7 +109,7 @@ createClient({ `src/types.gen.ts` (envelope `$defs`) and the platform → npm package map (`src/platforms.gen.ts` for the client, `scripts/npm-shim/platforms.gen.json` -for the install shim) are rendered from `skills/verdict/schemas/envelope.schema.json` and +for the install shim) are rendered from `schemas/envelope.schema.json` and `release/contract.json`: ```sh diff --git a/clients/ts/scripts/gen-ts-types.mjs b/clients/ts/scripts/gen-ts-types.mjs index b468359bf..c1d47395c 100644 --- a/clients/ts/scripts/gen-ts-types.mjs +++ b/clients/ts/scripts/gen-ts-types.mjs @@ -195,10 +195,7 @@ function mapTS(node, defs) { function genTypes() { const schema = JSON.parse( - readFileSync( - join(REPO_ROOT, "skills", "verdict", "schemas", "envelope.schema.json"), - "utf8", - ), + readFileSync(join(REPO_ROOT, "schemas", "envelope.schema.json"), "utf8"), ); const defs = hoist(schema.$defs ?? {}); const chunks = []; @@ -215,7 +212,7 @@ function genTypes() { ); } } - return `${header("skills/verdict/schemas/envelope.schema.json ($defs)")}\n${chunks.join("\n\n")}\n`; + return `${header("schemas/envelope.schema.json ($defs)")}\n${chunks.join("\n\n")}\n`; } function genPlatforms() { diff --git a/clients/ts/src/types.gen.ts b/clients/ts/src/types.gen.ts index fcac15fb6..2600112ee 100644 --- a/clients/ts/src/types.gen.ts +++ b/clients/ts/src/types.gen.ts @@ -1,4 +1,4 @@ -// GENERATED from skills/verdict/schemas/envelope.schema.json ($defs) by clients/ts/scripts/gen-ts-types.mjs. Do not edit. +// GENERATED from schemas/envelope.schema.json ($defs) by clients/ts/scripts/gen-ts-types.mjs. Do not edit. export interface Truncation { truncated: boolean; truncation_reason: diff --git a/cmd/schemagen/main.go b/cmd/schemagen/main.go index 0a7e6a6e7..99715dcd5 100644 --- a/cmd/schemagen/main.go +++ b/cmd/schemagen/main.go @@ -1,6 +1,6 @@ // Command schemagen writes (or checks) the published schemas from the Go // shape types in internal/schemagen. Run it through `make schemas` or -// `go generate ./...`; never edit skills/verdict/schemas/*.schema.json by hand. +// `go generate ./...`; never edit schemas/*.schema.json by hand. // In check mode it also re-checks the additivity baseline under // internal/schemagen/testdata/baseline byte for byte. package main @@ -25,7 +25,7 @@ const storeDirMode = 0o755 // schemas, relative to the repository root, each with the target that rewrites // it. const ( - shippedDir = "skills/verdict/schemas" + shippedDir = "schemas" baselineDir = "internal/schemagen/testdata/baseline" shippedHint = "run `make schemas` from the repo root" baselineHint = "run `make schemas-baseline` from the repo root" @@ -141,8 +141,8 @@ func samePath(a, b string) bool { func parseFlags(args []string, stderr io.Writer) (options, error) { flags := flag.NewFlagSet("schemagen", flag.ContinueOnError) flags.SetOutput(stderr) - write := flags.Bool("write", false, "rewrite skills/verdict/schemas/*.schema.json instead of checking them") - dir := flags.String("dir", "", "schemas directory (default: /skills/verdict/schemas)") + write := flags.Bool("write", false, "rewrite schemas/*.schema.json instead of checking them") + dir := flags.String("dir", "", "schemas directory (default: /schemas)") if err := flags.Parse(args); err != nil { return options{}, wrapError("parse flags", err) } diff --git a/docs/adding-a-verb.md b/docs/adding-a-verb.md index 03860b498..ed6145a29 100644 --- a/docs/adding-a-verb.md +++ b/docs/adding-a-verb.md @@ -50,7 +50,7 @@ A verb served before argument parsing (`mcp`) belongs in `run` and in the (`model.go`, `overlay.json` descriptions) and pin it in `conformance_verbs_test.go`; the envelope's `data` stays free-form for a verb that adds no contract. -- `make schemas` rewrites `skills/verdict/schemas/*.schema.json`; +- `make schemas` rewrites `schemas/*.schema.json`; `make schemas-check` proves no drift. Any shape the generator emits, additive or breaking, also needs `make schemas-baseline` and a reviewed baseline diff. - `make tsgen` rewrites the Go-derived `clients/ts/src/refusal-codes.gen.ts`; diff --git a/docs/benchmark.md b/docs/benchmark.md index e742de9fd..794dc9f6e 100644 --- a/docs/benchmark.md +++ b/docs/benchmark.md @@ -87,7 +87,7 @@ attributable per-model rates. ## Corpus format One case, one manifest, published as -[`schemas/corpus.schema.json`](../skills/verdict/schemas/corpus.schema.json): +[`schemas/corpus.schema.json`](../schemas/corpus.schema.json): ```json { diff --git a/docs/go-rules.md b/docs/go-rules.md index 99b19abc3..ce19ebde0 100644 --- a/docs/go-rules.md +++ b/docs/go-rules.md @@ -86,7 +86,7 @@ this repo, and the repo files stay the truth for what is gated: - `os.Root` confinement; `crypto/rand` secrets; validated edge input (GO-SEC-01/02/04). — partly: `lint:depguard` (`math/rand`), `lint:gosec`, `lint:nosprintfhostport`; `os.Root` is review-only, and operator-supplied bundle paths are exempt by decision. - Exit-code contract; `--json/--jq` exporters; generated completions/manpages (GO-CLI-02/06/07). — partly: exit codes are frozen constants in `internal/cli` with tests; no generated completions or manpages. - Start std-`flag` under a zero-dep policy; graduate to cobra when justified (GO-CLI-08). — partly: `go.mod` carries no third-party requirements; argv parsing is hand-rolled in `internal/cli` to keep the frozen contract byte-identical. -- `embed` prompts; stamped `--version` + `-trimpath` builds (GO-CLI-09). — partly: `skillfs.go` embeds `skills/verdict/` (`SKILL.md`, `prompts`, `schemas`, `scripts/verdict`); `make build` and goreleaser pass `-trimpath`. +- `embed` prompts; stamped `--version` + `-trimpath` builds (GO-CLI-09). — partly: `skillfs.go` embeds `skills/verdict/` (`SKILL.md`, `prompts`, `scripts/verdict`) and the root `schemas/`, serving both at payload paths; `make build` and goreleaser pass `-trimpath`. - flags > env > file > defaults; report secret sources; lenient config reads (GO-CONFIG-01/02/03). — partly: `internal/cli` precedence + `internal/cli/flags_test.go`. - Advisory `flock` across read-modify-write; JSON schema libs where beyond `DisallowUnknownFields` (GO-ATOMIC-02, GO-JSON-04); tag linters apply to new types only, legacy wire fields frozen (GO-JSON-03). — partly: `lint:musttag,tagalign`; the rest is review-only. - Progress as stderr attrs + JSON error shapes; log after flag parsing (GO-OBS-01/02). — partly: envelope error-shape goldens. diff --git a/docs/manual.md b/docs/manual.md index f5a3899f7..543365234 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -288,7 +288,7 @@ whole store — plugins read it instead of sniffing shapes. GitHub bundles keep unversioned); the other hosts reshape `reviews.json`/`inline.json` per host and normalize `PR.json` to one schema. Every provider bundle also writes `threads.json` (`schema_version: "1"`, published as -[`schemas/threads.schema.json`](https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/threads.schema.json)): the raw +[`schemas/threads.schema.json`](https://github.com/stainless-code/verdict/blob/main/schemas/threads.schema.json)): the raw files stay as-is, and the feed is the authoritative PR conversation. Review threads come from each host's native source — GitHub GraphQL `reviewThreads` (REST has no resolution), GitLab discussions (`resolved`/`resolvable`), Azure @@ -867,7 +867,7 @@ posture and never gate alone. ## Typed repository configuration `.verdict/config.json` is the only repository configuration file: -one strict document (schema `skills/verdict/schemas/config.schema.json`) for +one strict document (schema `schemas/config.schema.json`) for defaults (`panel`, `budget_usd`, `max_bytes`, `chunk`, `kb_policy`, `effort`, the two severity floors), the local `index` caps (`files`, `file_bytes`, `tree_bytes`, `shards_bytes`, `keep_trees`, `refs_per_file`), blocking @@ -2767,12 +2767,12 @@ platform package. A plain `verdict` call consults neither variable. `install-skill.sh` refuses outside a git checkout. `hooks/pre-commit` wiring applies to the checkout only. - **Embedded skill** (`verdict skill`): the binary carries its own `SKILL.md`, - `prompts/`, `schemas/`, `packs/`, and `scripts/verdict`, so the served skill can - never skew from the binary. In the repository they are the one - `skills/verdict/` directory, which holds nothing else. The skills CLI - (`npx skills add stainless-code/verdict`) copies that directory and no - more, so the registry install and `verdict skill install` write the same - files. `verdict skill` prints `SKILL.md` (default + `prompts/`, `packs/`, and `scripts/verdict` from `skills/verdict/`, plus + `schemas/` from the repository root, so the served skill can never skew from + the binary. The skills CLI + (`npx skills add stainless-code/verdict`) copies only `skills/verdict/`; + `verdict skill install` writes that payload and the served `schemas/` files. + `verdict skill` prints `SKILL.md` (default `--format md`); `--format json` is one standard envelope with `name`/`version`/`files`; `verdict skill files` lists every embedded path. `verdict skill show ` prints one inventory file byte-identical (a @@ -3122,7 +3122,7 @@ live ground truth. Static-analysis ingestion: `ingest owner/repo N --sarif ` maps SARIF 2.1.0 results into `.verdict/state//findings.json` with `source: "tool"`, sharing one store, one dedupe path, and one suppression/withheld path with model -reviews. Severity is mapped via `skills/verdict/schemas/sarif-map.json` +reviews. Severity is mapped via `schemas/sarif-map.json` (`security-severity` threshold or SARIF `level`), anchors are resolved against the bundle diff (`anchored: false` when outside hunks so out-of-diff results never fail inline posting), excluded paths land withheld with `source: "exclusion"`, @@ -4641,7 +4641,7 @@ The metrics: `--json` `data` is `{schema_version, run, mode, prs, not_replayed, bugs, reported, matched, unclassified, catch_rate, off_target_per_pr, cost_per_review_usd, spend, signals}` — and `report.json` is that same object, -so [`schemas/backtest.schema.json`](../skills/verdict/schemas/backtest.schema.json) +so [`schemas/backtest.schema.json`](../schemas/backtest.schema.json) describes both. `spend` is `{usd, priced_reviews, unpriced_reviews}`; a signal row is `{signal, bugs, matched, catch_rate}`. Human output is the scope header, the catch rate, the off-target rate, the cost line, the unclassified count, one diff --git a/evals/cases/bench-corpus.sh b/evals/cases/bench-corpus.sh index 86509053f..da04a3a40 100755 --- a/evals/cases/bench-corpus.sh +++ b/evals/cases/bench-corpus.sh @@ -40,7 +40,7 @@ stub_before="$(wc -l <"$EVAL_STUBLOG" | tr -d ' ')" schema_bad=0 for case_dir in "$EVAL_ROOT"/bench/corpus/*/; do [ -f "$case_dir/case.json" ] || continue - if ! "$EVAL_SKILL/schemas/validate.sh" "$EVAL_SKILL/schemas/corpus.schema.json" "$case_dir/case.json" >/dev/null 2>&1; then + if ! "$EVAL_ROOT/schemas/validate.sh" "$EVAL_ROOT/schemas/corpus.schema.json" "$case_dir/case.json" >/dev/null 2>&1; then bad "corpus.schema.json rejects $case_dir/case.json" schema_bad=$((schema_bad + 1)) fi diff --git a/evals/cases/drain-plan.sh b/evals/cases/drain-plan.sh index d68be8262..f6e8600b2 100755 --- a/evals/cases/drain-plan.sh +++ b/evals/cases/drain-plan.sh @@ -105,10 +105,10 @@ if jq -e --arg sig "$SIG" ' else bad "P2 plan: $(jq -c '{pending,skipped,other_threads}' "$PLAN" 2>/dev/null | head -c 600)" fi -if "$EVAL_SKILL/schemas/validate.sh" "$EVAL_SKILL/schemas/drain.schema.json" "$PLAN" >/dev/null 2>&1; then +if "$EVAL_ROOT/schemas/validate.sh" "$EVAL_ROOT/schemas/drain.schema.json" "$PLAN" >/dev/null 2>&1; then good "P3 the plan validates against schemas/drain.schema.json" else - bad "P3 schema: $("$EVAL_SKILL/schemas/validate.sh" "$EVAL_SKILL/schemas/drain.schema.json" "$PLAN" 2>&1 | head -3)" + bad "P3 schema: $("$EVAL_ROOT/schemas/validate.sh" "$EVAL_ROOT/schemas/drain.schema.json" "$PLAN" 2>&1 | head -3)" fi assert_stream_nogrep "P4 zero host writes on the stub log" "$EVAL_STUBLOG" \ 'POST|PATCH|mutation|method[[:space:]]+:([[:space:]]*)?"(POST|PATCH|DELETE)' -Eqi diff --git a/evals/cases/install-routes.sh b/evals/cases/install-routes.sh index f684fd5b5..31edb30e7 100755 --- a/evals/cases/install-routes.sh +++ b/evals/cases/install-routes.sh @@ -70,7 +70,11 @@ done for root in "$TARGET/.agents/skills" "$HOME/.agents/skills"; do while IFS= read -r rel; do [ -n "$rel" ] || continue - cmp -s "$PKG/skills/verdict/$rel" "$root/verdict/$rel" || copy_ok="false" + case "$rel" in + schemas/*) src="$PKG/$rel" ;; + *) src="$PKG/skills/verdict/$rel" ;; + esac + cmp -s "$src" "$root/verdict/$rel" || copy_ok="false" done <<<"$inventory" [ "$(jq -r '.tool // empty' "$root/verdict/.verdict-managed" 2>/dev/null)" = "verdict" ] || copy_ok="false" [ "$(jq -r '.version // empty' "$root/verdict/.verdict-managed" 2>/dev/null)" = "$(jq -r .version "$EVAL_ROOT/package.json")" ] || copy_ok="false" diff --git a/evals/cases/resolution.sh b/evals/cases/resolution.sh index b176d0500..ec2350b6e 100755 --- a/evals/cases/resolution.sh +++ b/evals/cases/resolution.sh @@ -48,7 +48,7 @@ assert_json_field "fixed" 3 '.data.precision.fixed' assert_json_field "judged" 5 '.data.precision.judged' assert_json_field "sample size" 6 '.data.precision.sample_size' assert_json_field "resolution rate" 0.6 '.data.precision.resolution_rate' -if "$EVAL_SKILL/schemas/validate.sh" "$EVAL_SKILL/schemas/calibration.schema.json" "$DIR/calibration.json" >/dev/null 2>&1; then +if "$EVAL_ROOT/schemas/validate.sh" "$EVAL_ROOT/schemas/calibration.schema.json" "$DIR/calibration.json" >/dev/null 2>&1; then good "saved receipt validates" else bad "saved receipt fails calibration schema" @@ -79,7 +79,7 @@ run_review calibrate acme/app 7 --json assert_exit "zero denominator calibration" 0 assert_json_field "zero judged" 0 '.data.precision.judged' assert_json_field "zero denominator is null" null '.data.precision.resolution_rate' -if "$EVAL_SKILL/schemas/validate.sh" "$EVAL_SKILL/schemas/calibration.schema.json" "$DIR/calibration.json" >/dev/null 2>&1; then +if "$EVAL_ROOT/schemas/validate.sh" "$EVAL_ROOT/schemas/calibration.schema.json" "$DIR/calibration.json" >/dev/null 2>&1; then good "null resolution rate validates" else bad "null resolution rate fails calibration schema" diff --git a/evals/cases/schema-contract.sh b/evals/cases/schema-contract.sh index ced67b7e5..923e808df 100755 --- a/evals/cases/schema-contract.sh +++ b/evals/cases/schema-contract.sh @@ -5,8 +5,8 @@ HERE="$(cd "$(dirname "$0")" && pwd)" # shellcheck source=../lib/common.sh . "$HERE/../lib/common.sh" -VAL="$EVAL_SKILL/schemas/validate.sh" -SCH="$EVAL_SKILL/schemas" +VAL="$EVAL_ROOT/schemas/validate.sh" +SCH="$EVAL_ROOT/schemas" ENV="$SCH/envelope.schema.json" DATA="$EVAL_SANDBOX/schema-data.json" diff --git a/evals/cases/tarball-contract.sh b/evals/cases/tarball-contract.sh index fa0895677..894b5e0ad 100755 --- a/evals/cases/tarball-contract.sh +++ b/evals/cases/tarball-contract.sh @@ -45,7 +45,7 @@ fi echo "package.json" for f in "$EVAL_SKILL"/prompts/*.md; do echo "skills/verdict/prompts/$(basename "$f")"; done for f in "$EVAL_ROOT"/scripts/*.sh; do echo "scripts/$(basename "$f")"; done - for f in "$EVAL_SKILL"/schemas/*.schema.json; do echo "skills/verdict/schemas/$(basename "$f")"; done + for f in "$EVAL_ROOT"/schemas/*.schema.json; do echo "schemas/$(basename "$f")"; done } | LC_ALL=C sort -u > "$REQUIRED" missing_from() { # $1 = packed-list file; prints required entries absent there diff --git a/evals/cases/threads.sh b/evals/cases/threads.sh index 96ec744c1..c2b647a80 100755 --- a/evals/cases/threads.sh +++ b/evals/cases/threads.sh @@ -107,10 +107,10 @@ if jq -e --arg head "$HEAD" --arg sig "$SIG" ' else bad "T2 feed shape: $(jq -c '.threads[0]' "$FEED" 2>/dev/null | head -c 400)" fi -if "$EVAL_SKILL/schemas/validate.sh" "$EVAL_SKILL/schemas/threads.schema.json" "$FEED" >/dev/null 2>&1; then +if "$EVAL_ROOT/schemas/validate.sh" "$EVAL_ROOT/schemas/threads.schema.json" "$FEED" >/dev/null 2>&1; then good "T3 feed validates against schemas/threads.schema.json" else - bad "T3 feed fails schema validation: $("$EVAL_SKILL/schemas/validate.sh" "$EVAL_SKILL/schemas/threads.schema.json" "$FEED" 2>&1 | head -3)" + bad "T3 feed fails schema validation: $("$EVAL_ROOT/schemas/validate.sh" "$EVAL_ROOT/schemas/threads.schema.json" "$FEED" 2>&1 | head -3)" fi run_review threads acme/app 7 diff --git a/evals/cases/usage-adapters.sh b/evals/cases/usage-adapters.sh index d06d5a535..56acdb301 100755 --- a/evals/cases/usage-adapters.sh +++ b/evals/cases/usage-adapters.sh @@ -9,8 +9,8 @@ HERE="$(cd "$(dirname "$0")" && pwd)" command -v jq >/dev/null 2>&1 || skip_case "jq missing — the converters need jq" AD="$EVAL_ROOT/examples/usage-adapters" -VAL="$EVAL_SKILL/schemas/validate.sh" -SCH="$EVAL_SKILL/schemas/usage.schema.json" +VAL="$EVAL_ROOT/schemas/validate.sh" +SCH="$EVAL_ROOT/schemas/usage.schema.json" WORK="$EVAL_SANDBOX/adapter-out" mkdir -p "$WORK" diff --git a/examples/python-client/README.md b/examples/python-client/README.md index ab05c8324..34a72711a 100644 --- a/examples/python-client/README.md +++ b/examples/python-client/README.md @@ -41,7 +41,7 @@ absent and never runs pip or the network: ## Generate the models `models.py` is generated from -[`skills/verdict/schemas/envelope.schema.json`](../../skills/verdict/schemas/envelope.schema.json) with a +[`schemas/envelope.schema.json`](../../schemas/envelope.schema.json) with a pinned [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator). The envelope schema's `$defs` carry the pinned `report`, `post`, and `record` data shapes, so one input file covers the envelope and all three profiles. @@ -59,7 +59,7 @@ The exact generator invocation is in `generate_models.sh`: ```sh datamodel-codegen \ - --input skills/verdict/schemas/envelope.schema.json \ + --input schemas/envelope.schema.json \ --input-file-type jsonschema \ --output examples/python-client/models.py \ --output-model-type dataclasses.dataclass \ diff --git a/examples/python-client/generate_models.sh b/examples/python-client/generate_models.sh index 4272b7e20..04878f2ce 100755 --- a/examples/python-client/generate_models.sh +++ b/examples/python-client/generate_models.sh @@ -23,7 +23,7 @@ fi gen() { datamodel-codegen \ - --input "$ROOT/skills/verdict/schemas/envelope.schema.json" \ + --input "$ROOT/schemas/envelope.schema.json" \ --input-file-type jsonschema \ --output "$1" \ --output-model-type dataclasses.dataclass \ diff --git a/examples/usage-adapters/README.md b/examples/usage-adapters/README.md index fe1650732..bb562a960 100644 --- a/examples/usage-adapters/README.md +++ b/examples/usage-adapters/README.md @@ -59,7 +59,7 @@ line, so it never breaks the session. ## Validate a converted file ```bash -skills/verdict/schemas/validate.sh skills/verdict/schemas/usage.schema.json +schemas/validate.sh schemas/usage.schema.json ``` ## Adding a harness diff --git a/internal/archtest/problemcodes_test.go b/internal/archtest/problemcodes_test.go index 112187b97..c3f6ee905 100644 --- a/internal/archtest/problemcodes_test.go +++ b/internal/archtest/problemcodes_test.go @@ -48,7 +48,7 @@ func TestProblemCodesMatchPublishedEnum(t *testing.T) { // checkProblemSchemaEnum compares the generated schema enum with the registry. func checkProblemSchemaEnum(t *testing.T, root string, codes []string) { t.Helper() - raw, err := os.ReadFile(filepath.Join(root, "skills", "verdict", "schemas", "envelope.schema.json")) + raw, err := os.ReadFile(filepath.Join(root, "schemas", "envelope.schema.json")) if err != nil { t.Fatal(err) } diff --git a/internal/archtest/prompt_schema_test.go b/internal/archtest/prompt_schema_test.go index 33c0644f0..230e717fb 100644 --- a/internal/archtest/prompt_schema_test.go +++ b/internal/archtest/prompt_schema_test.go @@ -63,11 +63,21 @@ func readSkillFile(t *testing.T, name string) []byte { return raw } +// readSchemaFile reads one published schema from the repository root. +func readSchemaFile(t *testing.T, name string) []byte { + t.Helper() + raw, err := os.ReadFile(filepath.Join(moduleRoot(t), "schemas", filepath.FromSlash(name))) + if err != nil { + t.Fatalf("read schemas/%s: %v", name, err) + } + return raw +} + // schemaBranch returns the schema object at path, failing on a missing branch. func schemaBranch(t *testing.T, path ...string) map[string]any { t.Helper() var doc any - if err := json.Unmarshal(readSkillFile(t, "schemas/review.schema.json"), &doc); err != nil { + if err := json.Unmarshal(readSchemaFile(t, "review.schema.json"), &doc); err != nil { t.Fatalf("decode review.schema.json: %v", err) } node, ok := doc.(map[string]any) @@ -87,7 +97,7 @@ func schemaBranch(t *testing.T, path ...string) map[string]any { func schemaHas(t *testing.T, path ...string) bool { t.Helper() var doc any - if err := json.Unmarshal(readSkillFile(t, "schemas/review.schema.json"), &doc); err != nil { + if err := json.Unmarshal(readSchemaFile(t, "review.schema.json"), &doc); err != nil { t.Fatalf("decode review.schema.json: %v", err) } node := doc diff --git a/internal/core/pack/lock_test.go b/internal/core/pack/lock_test.go index 5bc570097..45f234534 100644 --- a/internal/core/pack/lock_test.go +++ b/internal/core/pack/lock_test.go @@ -67,7 +67,7 @@ func lockSourceBody(source string) string { func TestLockSourceSchemaMatchesLoader(t *testing.T) { t.Parallel() checker, err := schemacheck.Load( - filepath.Join("..", "..", "..", "skills", "verdict", "schemas", "lock.schema.json"), "") + filepath.Join("..", "..", "..", "schemas", "lock.schema.json"), "") if err != nil { t.Fatalf("load lock schema: %v", err) } diff --git a/internal/core/pack/pack_test.go b/internal/core/pack/pack_test.go index 1b587ad2b..9fd8d2a0d 100644 --- a/internal/core/pack/pack_test.go +++ b/internal/core/pack/pack_test.go @@ -371,7 +371,7 @@ func TestPackNoteLabelsBodies(t *testing.T) { func TestRefusedManifestsFailPublishedSchema(t *testing.T) { t.Parallel() checker, err := schemacheck.Load( - filepath.Join("..", "..", "..", "skills", "verdict", "schemas", "pack.schema.json"), "") + filepath.Join("..", "..", "..", "schemas", "pack.schema.json"), "") if err != nil { t.Fatalf("load pack schema: %v", err) } diff --git a/internal/core/threads/fuzz_test.go b/internal/core/threads/fuzz_test.go index 6ed4aedee..0544e2531 100644 --- a/internal/core/threads/fuzz_test.go +++ b/internal/core/threads/fuzz_test.go @@ -45,7 +45,7 @@ func FuzzProviderMappers(f *testing.F) { f.Add([]byte(s)) } seedThreadFixtures(f) - checker, err := schemacheck.Load("../../../skills/verdict/schemas/threads.schema.json", "") + checker, err := schemacheck.Load("../../../schemas/threads.schema.json", "") if err != nil { f.Fatal(err) } diff --git a/internal/schemacheck/schemacheck_test.go b/internal/schemacheck/schemacheck_test.go index dd7833d80..75ca6322f 100644 --- a/internal/schemacheck/schemacheck_test.go +++ b/internal/schemacheck/schemacheck_test.go @@ -276,7 +276,7 @@ func writeSchema(t *testing.T, dir, name, body string) { // and no fewer (a missing keyword reads as unsupported). One list, in // Subset(); the shim only spells it. func TestShippedShimListsTheSubset(t *testing.T) { - const shimPath = "../../skills/verdict/schemas/validate.sh" + const shimPath = "../../schemas/validate.sh" raw, err := os.ReadFile(shimPath) if err != nil { t.Fatalf("read %s: %v", shimPath, err) diff --git a/internal/schemagen/build.go b/internal/schemagen/build.go index 3462bd531..cabdb339e 100644 --- a/internal/schemagen/build.go +++ b/internal/schemagen/build.go @@ -54,7 +54,7 @@ const ( typeNull = "null" defsPrefix = "#/$defs/" draft2020 = "https://json-schema.org/draft/2020-12/schema" - idBase = "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/" + idBase = "https://github.com/stainless-code/verdict/blob/main/schemas/" inlineTag = "inline" inlineTrue = "true" defsBrief = "brief" diff --git a/internal/schemagen/conformance_test.go b/internal/schemagen/conformance_test.go index dfd57bdb4..751a730bb 100644 --- a/internal/schemagen/conformance_test.go +++ b/internal/schemagen/conformance_test.go @@ -147,7 +147,7 @@ func loadSchemaDocument(t *testing.T, name string) map[string]any { if err != nil { t.Fatalf("RepoRoot: %v", err) } - raw, err := os.ReadFile(filepath.Join(root, "skills", "verdict", "schemas", name)) + raw, err := os.ReadFile(filepath.Join(root, "schemas", name)) if err != nil { t.Fatalf("read %s: %v", name, err) } diff --git a/internal/schemagen/drift_test.go b/internal/schemagen/drift_test.go index 4b6542609..b211f2cbf 100644 --- a/internal/schemagen/drift_test.go +++ b/internal/schemagen/drift_test.go @@ -20,7 +20,7 @@ func TestSchemasMatchGenerated(t *testing.T) { if err != nil { t.Fatalf("RepoRoot: %v", err) } - dir := filepath.Join(root, "skills", "verdict", "schemas") + dir := filepath.Join(root, "schemas") generated := make(map[string]bool, len(files)) for _, file := range files { generated[file.Name] = true diff --git a/internal/schemagen/semantics_test.go b/internal/schemagen/semantics_test.go index 19e000d8d..1078723c0 100644 --- a/internal/schemagen/semantics_test.go +++ b/internal/schemagen/semantics_test.go @@ -13,24 +13,23 @@ import ( // hand-written files was a re-serialization: every key, type, required list, // enum and description had to stay identical. An intentional published-schema // change updates this map in its own change, with the reason recorded; a mere -// reformat of schemas/*.schema.json must not change it. The relocation of the -// schemas to skills/verdict/schemas/ (so the registry install ships only the -// skill) re-pinned all ten hashes: only each $id URL moved; no property, -// required key, enum, or type changed. +// reformat of schemas/*.schema.json must not change it. Moving the schemas +// out of the installed skill to schemas/ re-pinned every hash: only each $id +// URL moved; no property, required key, enum, or type changed. var publishedSemantics = map[string]string{ // additive author.schema.json (new bundle document; the advisory author // fingerprint fetch detects). No existing schema property, required key, // enum, or type changed. - "author.schema.json": "f7d48bf8cc56baf70899b6e02caceae111838bb7ee3ed707eb7e4a9e7b809a70", - "excluded.schema.json": "da38e86c8f27bc41b8255f7fc12cbf0a81fa181eee2be172c46b4ae015b041ac", - "panel-plan.schema.json": "c4ac13bb03fb5918bc5b60ff9eba10776f10b999fdc88049409792439b1c043a", - "panel.schema.json": "60fee20b395837e41c0bb8044dcaed55fa7a38d8d8a504a9f228be95b28319ef", - "calibration.schema.json": "9e061b60ab7c2252b86146af16742a3e59c64a28e9f6441fd0f30f1f5e2f9581", + "author.schema.json": "0773058075a17e2d53e2d8c6a1bdfad2150bcb41a64c76e24ef4cc88cf4ef6d9", + "excluded.schema.json": "0d2646d108ddc5d13c2718b4e5d7f66084e5f5f2ee29883cf375d29ef8b112c4", + "panel-plan.schema.json": "a1030d14b80c28e98003ec8f1cbaffc75c5588f19fd2e68c38a23d0547b4bcde", + "panel.schema.json": "0899c9570bb2286c9375ba3af82f54caf457d2a9b95fdf2c48860cda5fa559c3", + "calibration.schema.json": "053bb6495d947663278044fa75308c89e0b72a93b8dbc0c0e84710cf17357f85", // additive backtest.schema.json (new run-artifact document for the backtest // score report; no existing schema property, required key, or type changed). // The catch_rate description now calls the rate a match rate over // blame-derived candidates instead of a lower bound on catch. - "backtest.schema.json": "23ea7e2b720c097bf41cdbebf9a4d828ec69d738c916deb475df1c1bc8216b89", + "backtest.schema.json": "9d61c62abb2d6cfc0310dd56bf266f1b7119d3c82a7077e034a0a712ff388d1c", // additive config.schema.json (new typed-repository-configuration // document; no existing schema property, required key, or type // changed). The scope $def now carries the presence contract the @@ -46,7 +45,7 @@ var publishedSemantics = map[string]string{ // recall character budget. // trigger: additive optional top-level predicate object with seven closed // optional keys; no existing property, required key, or type changed. - "config.schema.json": "cb41b8b05baa14d1236da1d8a3d69a06913dfac560c17a95b71e71b21a65af38", + "config.schema.json": "416293a853aeb457a2c20cd7b13b3fde7278f7537ce179c2c66278827159943f", // additive controls.schema.json (new bundle document; no existing schema // property, required key, or type changed). // strict_input: an optional controls.json field (default off) that lets @@ -55,7 +54,7 @@ var publishedSemantics = map[string]string{ // typed state: the strict_input description names REVIEW_STRICT_INPUT // as its only source and the inventory path description names // .verdict/. Prose only; no property, required key, or type changed. - "controls.schema.json": "c98231d08509db237d0622839407995e50f74428a55c1cbad5d03f0d2fc1503e", + "controls.schema.json": "aedf565818ff8e7b5522a55cbf7a4087929b8637574d54c8435bea8d880f596b", // additive corpus.schema.json (new document; no existing schema property, // required key, or type changed). // additive corpus bug keywords (optional string array naming the defect in @@ -72,7 +71,7 @@ var publishedSemantics = map[string]string{ // additive corpus.schema.json: provenance gains base_sha and head_sha, the // commits a real case's diff spans and its bundle stamps. Two new optional // string properties; no existing property, required key, or type changed. - "corpus.schema.json": "e1206318dc186aa479ae702384edba263ce229f921e68858e142efb16b4e5785", + "corpus.schema.json": "2dadbf27e8e690bbe43ba60d0f38173aadb02773dc9c737f3e41818509c057e4", // intentional pre-v1 break: lenses items become per-group // {group,labels[]} entries (an empty labels list is that group's explicit // zero) and schema_version pins 2. No other property, required key, or @@ -92,7 +91,7 @@ var publishedSemantics = map[string]string{ // while the rollup sums one total. The models array accepts one shape // only; the reader dropped its object-form coercion in the same change. // No property, required key, enum, or type changed. - "cost.schema.json": "c6e712e91b587b6f0d5c5f74548f46f37f0ed996a8530f637e985576163507d6", + "cost.schema.json": "96a8b137f3294e790438a755331a2a7975f11cb1187352ae5151891cd38a0d17", // additive fetchEstimate $defs entry (measured-usage basis fields). // The additive showData/showFix/verifyHint $defs entries (show --json // data.fix). Neither change touched an existing property, required key, @@ -274,9 +273,9 @@ var publishedSemantics = map[string]string{ // additive drain-replies.schema.json (new bundle document; no existing // schema property, required key, enum, or type changed). It pins the // agent's single output: the plan digest and one disposition per reply. - "drain-replies.schema.json": "d9e8cc9410edc85da2d1380d67dfbcb415563a1c30f8b3901f2516a3a98135c5", - "drain.schema.json": "189c041aab4f4d6f261dd62ceb9a225d36079874d9d0c521d189713d063173f4", - "envelope.schema.json": "27103488dcbcb9966b36d5f4f78241832b63f304d4710cb7d745afbbc20cc255", + "drain-replies.schema.json": "601cfd36687dab68e858aed5484fa2f654c5d2265da944fc1428753029eb8362", + "drain.schema.json": "1fcf8437ef91b1b130923e3600f489559be29ce9f3a5b1d2de52641db945af80", + "envelope.schema.json": "b5f49f876d3f600ce6ced697b27a4bb343c516bbbaf21b698995cf8e3ac87cd7", // Repair brief: additive $defs/brief + $defs/briefSite and a nullable // entry.brief (optional; no existing property, required key, or type // changed). @@ -288,7 +287,7 @@ var publishedSemantics = map[string]string{ // sarif ingest: additive optional entry.source enum (model|tool) and // optional tool, rule_id, and fingerprint strings on findings entries. No // existing property, required key, or type changed. - "findings.schema.json": "273c22cb1804ca71acc28ca2f7912d8ec60f9efeb5c3772feb8b33286f107207", + "findings.schema.json": "6cbc56ac84b2e3b957259589e512ab2acb2d515e6eb6814df49daeddf830a4f0", // post_floor_scoped: additive optional per-path posting floor list with its // $defs/floorScope entry (required path, enum floor). No existing // property, required key, or type changed. @@ -310,10 +309,10 @@ var publishedSemantics = map[string]string{ // comment. No existing property, required key, enum, or type changed. // risk score: additive optional nullable risk claim ($defs/riskClaim). No // existing property, required key, enum, or type changed. - "post.schema.json": "0e6fcf560007fd66da8605a73e5a2df912d5334d8b999341e850a7b9c1a1e0f2", + "post.schema.json": "33a2d4cb9ada3c553df93cf70df10fc85eac62811c223fc133135cd71e55ac1d", // patch identity: additive $defs/identity root (new bundle document) — // no existing property, required key, or type changed. - "identity.schema.json": "efe9a7b331e41715bc55b8824e95154add584c2d63f670811ef03c350d2e5bdb", + "identity.schema.json": "993b01b4c6891f2dc2e78454aac8bd2abaa8740c073bd5fc8124d4b47f7e68c9", // additive pack.schema.json (new document; no existing schema property, // required key, or type changed). The lens-pack manifest fetch resolves // from skills/verdict/packs/builtin: a closed object plus one closed lens @@ -327,7 +326,7 @@ var publishedSemantics = map[string]string{ // scanned languages: additive optional file.language enum, so a stored tree // names the scanner that read each file. No existing property, required // key, enum, or type changed. - "index.schema.json": "2104f9b00c2909f29e5cbd155931ba4765f4b6647f8bd602199a8761c57b9126", + "index.schema.json": "6a107567d0432b17571099abf1aad24b53d80581fa3fda357eca6ad0abd49ec7", // rules and layering: additive replace[], severity map, rules[] with a // closed $defs/rule. No existing property, required key, enum, or type // changed; the loader's exact-key, regular-file, and bounded-read rules @@ -366,12 +365,12 @@ var publishedSemantics = map[string]string{ // (the maxHostLabel cap the loader enforces) and refuses a "://" inside an // scp path (the loader's scheme guard). One pattern narrowed to the // loader's own grammar; no property, required key, enum, or type changed. - "lock.schema.json": "c88951e4ac18781f93881f6654493ad8a7345ea990fca44bbd1149c7eefc4714", + "lock.schema.json": "da19e41786cc9ff295a88a68929a8c76b5fbd44a7cbd9c5579fd57b316b16db2", // findings cap: the lens max_findings description now says the built-in // pack declares none, so a shipped lens states no return cap and returns // what its evidence supports. Prose only; no property, required key, enum, // or type changed. - "pack.schema.json": "c02a0dfcfc2355c5a4d61d91a662c73a6188e20ab5c36f725cde0e6768b69af3", + "pack.schema.json": "48ce9ee6123e74aa3dd2eab0a92b3998ecfb519d79b60b87827321735df75314", // additive recipes.schema.json (new control document: the declared review // pipelines a run resolves by name at the PR base). No existing schema // property, required key, enum, or type changed. @@ -398,7 +397,7 @@ var publishedSemantics = map[string]string{ // run --print --stage render fills, positioned into the plan's stages. A // new definition only: no existing property, required key, enum, or type // changed. - "recipes.schema.json": "4ccac4c5b2e8b92fdab6778870dcdfb1578b2fcaf83b86373bb9c43dfc6c7c4a", + "recipes.schema.json": "de52a643fb93073e167e9ee23d7bac3b113ce3e58c3e57a2378b9a850929f072", // patch identity: additive optional patch_id/patch_id_kind plus the // optional forced[] audit with $defs/forcedPost. No existing property, // required key, or type changed. @@ -417,7 +416,7 @@ var publishedSemantics = map[string]string{ // property, enum, or type changed; older stores simply carry neither key. // The validation pass adds required-nullable validation_hash and required // validation_counts/validation_mode/rigor_floors after chunk_coverage. - "record.schema.json": "37628cfde409c8b33bf7a9a23dba5f2875a4d43a63e0589b2134323385edd384", + "record.schema.json": "f9465a6e4607e2189c9344beeae95d9c99c274c6d1d4a6ff01855a95fb1b67a8", // Repair brief: additive $defs/brief + $defs/briefSite and a nullable comment.brief // (optional; no existing property, required key, or type changed). The @@ -434,31 +433,31 @@ var publishedSemantics = map[string]string{ // existing property, required key, enum, or type changed. // schema_version optional: descriptions drop the missing-key warning. No // property, required key, enum, or type changed. - "review.schema.json": "76232c7a9f815c81f2e2115778ebba6f55cc3bdfb9548b6f734effb0ef0cd768", + "review.schema.json": "6768f8c558f9f587cfdf82d75c10f6a463d2b10be6769b6ebc952878802cd004", // additive selected.schema.json (new bundle document: the reaction-scoped // fix selection fetch writes and fix --selected reads). A new document // only: no existing schema property, required key, enum, or type changed. - "selected.schema.json": "40bcc26a3e73ea2a17ad02cbba06548215f9ee5b1aad04d16885275842e88021", + "selected.schema.json": "3a9edd147d5a55e19b6910a18deccb6147a8bef262bab0b109d4938746bdbfce", // additive threads.schema.json (new bundle document; no existing schema // property, required key, or type changed). The PR-conversation // contract extends the first cut with the thread's host id, PR/head/time // envelope, root author kind, finding_sig, and the comments[] array: all // additions to the new document, no previously published shape changed. - "threads.schema.json": "e24857002ee5c60fb38a3a2a0867eb453526dd35c075b4b4adde33f41ebe69dc", + "threads.schema.json": "bf08d8d1d0d0445dab86134f7128bd990a5d399c56155b664ca01289b20212a4", // additive threads-resolve.schema.json (new bundle document; no existing // schema property, required key, or type changed). The receipt proves the // resolve mutation: provider, repo, pr, head, timestamp, dry_run, the // closed ids, and the skipped candidates with their reasons. - "threads-resolve.schema.json": "e550441f9990bf2109f4f078b42e4a86728582e45f661745e725c8d06012c1d4", + "threads-resolve.schema.json": "fa2df4b546008c43a251c6eb480b2b6cf6b80d10785920286398426ad7343521", // additive usage.schema.json (new handoff document; no existing schema // property, required key, or type changed — the envelope fetchEstimate entry // from f3a22047 is untouched). - "usage.schema.json": "143473d20d0e0d140432356d9254554b969b9c71290d61ec3f5ab821e2b6bc69", + "usage.schema.json": "95da162703b04193308f8c55cef95affefb4ecd278cc09e5ea3801e061be999e", // additive validation.schema.json (new bundle document; no existing schema // property, required key, or type changed). It pins the trusted pass: one // result per finding sig with its verdict, reason, optional one-rank // downgrade pair, and checks. - "validation.schema.json": "c018104ce060fdaa7d45b5cc5a02d3b0046a4d5c5c121b7d5b64f8eb02bd58f0", + "validation.schema.json": "1a86ff6e84d7c0c9ef7b524f51105b50e1154feeb22e34cace42877bb87b41bb", } // TestGeneratedSchemasPreservePublishedSemantics proves the generated files diff --git a/internal/schemagen/testdata/baseline/author.schema.json b/internal/schemagen/testdata/baseline/author.schema.json index 96381fdaa..f6bb173e5 100644 --- a/internal/schemagen/testdata/baseline/author.schema.json +++ b/internal/schemagen/testdata/baseline/author.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/author.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/author.schema.json", "title": "author.json — advisory author fingerprint", "description": "The advisory author fingerprint fetch detected in the bundle's PR text. It never blocks a review, never changes what is reviewed, and never pins a model; an unknown author writes no file at all rather than guessing, so absent means unknown, not human.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/backtest.schema.json b/internal/schemagen/testdata/baseline/backtest.schema.json index a47898645..be06aa0cd 100644 --- a/internal/schemagen/testdata/baseline/backtest.schema.json +++ b/internal/schemagen/testdata/baseline/backtest.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/backtest.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/backtest.schema.json", "title": "report.json — backtest score report", "description": "The backtest score report, written to .verdict/backtest//report.json and echoed as the score envelope's data object: the same object, so one schema covers both. It grades each replayed PR's recorded findings against the bug lines the run's own SZZ candidate records, through the corpus matcher (+/-1 line, one finding per bug, text that names the defect kind). catch_rate is a match rate over blame-derived candidates, not a measured catch rate: a line a later fix deleted is a hypothesis about where a defect was, a deleted cleanup line beside the real bug is a candidate that was never defective, and an unmatched finding is not proven false.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/calibration.schema.json b/internal/schemagen/testdata/baseline/calibration.schema.json index 530ca7100..978767a99 100644 --- a/internal/schemagen/testdata/baseline/calibration.schema.json +++ b/internal/schemagen/testdata/baseline/calibration.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/calibration.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/calibration.schema.json", "title": "calibration.json — live outcome audit", "description": "Saved live calibration audit. Unknown outcomes are excluded from judged; resolution_rate is null without a judged denominator.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/config.schema.json b/internal/schemagen/testdata/baseline/config.schema.json index 436374ee0..a8ee27655 100644 --- a/internal/schemagen/testdata/baseline/config.schema.json +++ b/internal/schemagen/testdata/baseline/config.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/config.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/config.schema.json", "title": "config.json — typed repository configuration", "description": "The typed repository configuration at .verdict/config.json: versioned shared defaults and review requirements with path scopes, named work profiles, and the default profile. Structural validation comes from this schema; the hand-written parser in internal/config owns the semantic checks the schema cannot express (duplicate keys, credential keys, glob portability, clause-name uniqueness, per-group clause coverage).", "type": "object", diff --git a/internal/schemagen/testdata/baseline/controls.schema.json b/internal/schemagen/testdata/baseline/controls.schema.json index be752f1e3..79482d4ba 100644 --- a/internal/schemagen/testdata/baseline/controls.schema.json +++ b/internal/schemagen/testdata/baseline/controls.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/controls.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/controls.schema.json", "title": "controls.json — resolved review controls snapshot", "description": "The bundle's resolved review controls: fetch snapshots every control file at the PR base commit, and post/record refuse to trust the snapshot when its base or any used-file hash drifted. policy 'base' is the default; 'head' is the explicit --allow-head-controls opt-out.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/corpus.schema.json b/internal/schemagen/testdata/baseline/corpus.schema.json index 56785dac5..81be1fbfb 100644 --- a/internal/schemagen/testdata/baseline/corpus.schema.json +++ b/internal/schemagen/testdata/baseline/corpus.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/corpus.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/corpus.schema.json", "title": "corpus.json — benchmark corpus case manifest", "description": "One benchmark corpus manifest, checked in as bench/corpus//case.json and copied into a run bundle as .verdict/state/corpus-*/corpus.json. The case records the ground truth a review output is graded against: a real PR that later needed a bug-fix commit, or a seeded defect with what was injected. calibrate and trend join findings.json against these bugs offline; a true positive needs the bug's path, a line inside the +/- line_tolerance window, and text that names the defect (kind, category, or keywords), one finding per bug. additionalProperties stays closed so a typo fails validation instead of silently grading a different field.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/cost.schema.json b/internal/schemagen/testdata/baseline/cost.schema.json index 81389a494..125e772a6 100644 --- a/internal/schemagen/testdata/baseline/cost.schema.json +++ b/internal/schemagen/testdata/baseline/cost.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/cost.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/cost.schema.json", "title": "cost.json — agent self-reported spend record", "description": "What the agent writes per prompts/review.md and report --cost rolls up. One object per run, or an array when a bundle was reviewed more than once. The script only sums — it never prices: effort defaults to standard when missing or unknown, records without models still count as runs but not as runs_with_cost, every `models[]` entry must name its model — the name is what attribution reads, and the rollup sums all of them into one total rather than reporting per model, absent/unreadable records contribute zeros and never fail. Per-chunk records (chunks/.cost.json) share this shape. Two readers treat unknown keys differently, and this schema allows them for both. Aggregators — the rollup, the group estimate, the receipt — read the fields they know and ignore the rest, so a newer writer's extra field never voids history. Certification of lens evidence is version-scoped: a record offered as schema_version \"2\" may carry only the top-level fields v2 defines, and an extra one refuses that record by name until it is removed or a version that defines it is declared. A record bound to the run at a different version refuses as unsupported rather than being re-read as v2.", "anyOf": [ diff --git a/internal/schemagen/testdata/baseline/drain-replies.schema.json b/internal/schemagen/testdata/baseline/drain-replies.schema.json index 4b5026015..4ad6b1b9d 100644 --- a/internal/schemagen/testdata/baseline/drain-replies.schema.json +++ b/internal/schemagen/testdata/baseline/drain-replies.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/drain-replies.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/drain-replies.schema.json", "title": "drain.replies.json — drafted thread replies", "description": "The single artifact the drafting agent writes: one answer per pending thread, pinned to the plan digest. Verdict validates every site before any later step reads it; there is no host write in this build.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/drain.schema.json b/internal/schemagen/testdata/baseline/drain.schema.json index a3d4da6ac..d4c398721 100644 --- a/internal/schemagen/testdata/baseline/drain.schema.json +++ b/internal/schemagen/testdata/baseline/drain.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/drain.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/drain.schema.json", "title": "drain.json — drain plan and receipt", "description": "The plan a drain run writes before drafting and the receipt it updates after posting. The plan pins one canonical pending list with a digest, typed skips for threads verdict authored but did not draft, and a count of other people's threads. The agent writes drain.replies.json against that digest; no host write happens in this build.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/envelope.schema.json b/internal/schemagen/testdata/baseline/envelope.schema.json index f8434e301..89c3f0be4 100644 --- a/internal/schemagen/testdata/baseline/envelope.schema.json +++ b/internal/schemagen/testdata/baseline/envelope.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/envelope.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/envelope.schema.json", "title": "verdict --json envelope", "description": "Every --json stdout is exactly one envelope with these nine keys (schema_version \"1\"): error null on success with a data object, data null with a typed error object on refusal. Derived from the Go envelope renderer (RenderEnvelope) in the verdict CLI. data is additive per verb (chunk summaries, prompt_dump, cost, completeness ride inside data, never as new top-level keys), so data objects allow additional properties; every verb publishes its data profile here as a single Data $defs entry (reportData, postData, validationData, recordData, showData, fetchData, fetchLocalData, threadsData, verifyData, triageData, readyData, adoptData, ingestData, nextData, fixData, handoffData, learnData, packData, packTestData, initData, doctorData, checkTreeData, trendData, calibrateData, configData), each validated against the runtime writer and the committed goldens.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/excluded.schema.json b/internal/schemagen/testdata/baseline/excluded.schema.json index 2d24d6756..73aec4692 100644 --- a/internal/schemagen/testdata/baseline/excluded.schema.json +++ b/internal/schemagen/testdata/baseline/excluded.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/excluded.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/excluded.schema.json", "title": "excluded.json — excluded diff bytes", "description": "Byte-accounted exclusion receipt. Paths and rule ids identify removed raw diff sections; both hashes bind the reviewed subset to its raw input.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/findings.schema.json b/internal/schemagen/testdata/baseline/findings.schema.json index 1bee9f6b0..402680180 100644 --- a/internal/schemagen/testdata/baseline/findings.schema.json +++ b/internal/schemagen/testdata/baseline/findings.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/findings.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/findings.schema.json", "title": "findings.json — merged findings store", "description": "What post/record write per bundle. Derived from validate_and_merge in the verdict CLI: stable line-number-free sigs, append-only history, re-post merges that keep prior fields ($prev + new, so unknown keys pass through — this schema allows them). rigor is always normalized to the enum, severity and category to the enum-or-null (unknown category values warn and read null), kb defaults to []. Section entries carry anchored:\"body\" instead of a boolean.", "type": "array", diff --git a/internal/schemagen/testdata/baseline/identity.schema.json b/internal/schemagen/testdata/baseline/identity.schema.json index 2b757c63b..85ce12af5 100644 --- a/internal/schemagen/testdata/baseline/identity.schema.json +++ b/internal/schemagen/testdata/baseline/identity.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/identity.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/identity.schema.json", "title": "identity.json — bundle patch identity", "description": "Bundle patch identity written by fetch/fetch-local beside the diff: the stable diff id (git patch-id --stable, labeled diff-sha256 fallback) with the head/base SHAs it was computed at. A patch id is a dedupe key, never an authorization token.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/index.schema.json b/internal/schemagen/testdata/baseline/index.schema.json index 6bc028cb7..a5506a1cb 100644 --- a/internal/schemagen/testdata/baseline/index.schema.json +++ b/internal/schemagen/testdata/baseline/index.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/index.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/index.schema.json", "title": "index tree — .verdict/index/trees/.json", "description": "One stored per-tree index under .verdict/index/trees/.json. Files are sorted by path, declarations and references stay in source order, and no timestamp or commit id lands here, so the same tree always writes the same bytes.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/lock.schema.json b/internal/schemagen/testdata/baseline/lock.schema.json index 4bda12ce9..f491eebb9 100644 --- a/internal/schemagen/testdata/baseline/lock.schema.json +++ b/internal/schemagen/testdata/baseline/lock.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/lock.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/lock.schema.json", "title": "verdict.lock — pinned repo lens packs", "description": "The repo layer's pin file at .verdict/verdict.lock: strict JSON with exactly one row per pack vendored under .verdict/packs/, sorted by name. The lock covers only the repo layer — the built-in pack is pinned by the binary and org packs live in per-operator settings. source is dir: or git:@<40-hex sha>; hash is the pack's canonical tree hash; sig is sha256 over name, source, version, and hash, so a hand edit is caught. fetch, post, and record refuse pack-lock-missing or pack-lock-drift from the trusted-base snapshot, and the file joins the controls inventory so an edited snapshot copy refuses controls-stale.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/pack.schema.json b/internal/schemagen/testdata/baseline/pack.schema.json index a759e4578..1828e5905 100644 --- a/internal/schemagen/testdata/baseline/pack.schema.json +++ b/internal/schemagen/testdata/baseline/pack.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/pack.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/pack.schema.json", "title": "pack.json — a lens pack manifest", "description": "A lens pack manifest at skills/verdict/packs/builtin/pack.json: the published format fetch resolves into the bundle. The schema closes the shape; the loader also enforces the caps (64 KiB/file, 1 MiB/pack, 256 files, 64 lenses) and the rule that every lens and rule id names its own markdown file. A file no manifest row names is counted but never loaded. Manifest keys must be spelled exactly as published: the loader refuses any other case.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/panel-plan.schema.json b/internal/schemagen/testdata/baseline/panel-plan.schema.json index cc561f443..598795d02 100644 --- a/internal/schemagen/testdata/baseline/panel-plan.schema.json +++ b/internal/schemagen/testdata/baseline/panel-plan.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/panel-plan.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/panel-plan.schema.json", "title": "verification/plan.json — independent dispatch plan", "description": "Local planner output at verification/plan.json; verifiers follow the synthesizer in the pinned panel roster. No model or network call occurs.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/panel.schema.json b/internal/schemagen/testdata/baseline/panel.schema.json index 6a416f489..6033938e6 100644 --- a/internal/schemagen/testdata/baseline/panel.schema.json +++ b/internal/schemagen/testdata/baseline/panel.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/panel.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/panel.schema.json", "title": "verification/verdicts.json — independent verifier receipts", "description": "Invoker-written verification/verdicts.json: head-bound independent opinions. Duplicate (sig, model) and unknown or ambiguous signatures are refused by the runtime; a refutation never deletes a finding.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/post.schema.json b/internal/schemagen/testdata/baseline/post.schema.json index 1603c9edd..212f3015a 100644 --- a/internal/schemagen/testdata/baseline/post.schema.json +++ b/internal/schemagen/testdata/baseline/post.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/post.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/post.schema.json", "title": "post.json — completed-post record (PR bundles)", "description": "Written only by the real-post path in the verdict CLI (dry runs, attempts and failures write nothing), so a present head matching the bundle HEAD proves a completed post. review is raw GitHub output (GitHub's schema, unversioned) — this schema passes it through. confidence/security_summary are absent-stays-absent: null when the review carried none. additionalProperties stays open for additive provenance fields.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/recipes.schema.json b/internal/schemagen/testdata/baseline/recipes.schema.json index cedd3ee47..2e755dfdc 100644 --- a/internal/schemagen/testdata/baseline/recipes.schema.json +++ b/internal/schemagen/testdata/baseline/recipes.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/recipes.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/recipes.schema.json", "title": "recipes.json — declared review pipelines", "description": "The declared review pipelines a run resolves by name from .verdict/recipes.json at the PR base: lenses, synthesizer hint, and budget, compiled into the four-stage plan data.recipe and launcher.json record, whose shape is published here as $defs/plan. The file is a review control, read from the base snapshot and hash-gated like the typed configuration, so a head edit never steers the pipeline it is judged by. Positions are declarations, not selections: run launches one process and never chooses a model. Every key is spelled exactly as published; the loader refuses any other case, an unknown key, and a duplicate key with bad-recipe.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/record.schema.json b/internal/schemagen/testdata/baseline/record.schema.json index 4b71324ae..49b121c4d 100644 --- a/internal/schemagen/testdata/baseline/record.schema.json +++ b/internal/schemagen/testdata/baseline/record.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/record.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/record.schema.json", "title": "record.json — completed-record (local bundles)", "description": "Written by the record verb in the verdict CLI for local and provider-PR bundles (GitHub PRs use post). findings/open are recomputed from the merged store every run; confidence/security_summary are null when the review carried none. additionalProperties stays open for additive provenance fields.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/review.schema.json b/internal/schemagen/testdata/baseline/review.schema.json index 55a7d5a50..94498e991 100644 --- a/internal/schemagen/testdata/baseline/review.schema.json +++ b/internal/schemagen/testdata/baseline/review.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/review.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/review.schema.json", "title": "review.json — agent-written review input", "description": "What the agent writes and post/record validate. One checker reports every problem: error refuses; warning lets record proceed and is promoted by --strict/strict_input. An absent schema_version reads as 1; any other value refuses. Errors: schema_version other than 1, missing/non-string/degenerate body, non-boolean approved, non-array comments or non-object items, comment path missing/non-string/not in diff, line/start_line wrong type, side wrong type or not RIGHT/LEFT, missing body, non-string suggestion, brief outcome/site/approach/question shape or range failures, rigor/severity wrong type or unknown, non-boolean in-bounds, kb non-array/non-string, resolved/triage/sections shape and enums, confidence non-integer or outside 1-5, non-string security_summary, malformed or partial chunks, and malformed verification claims. Warnings: missing comments, no line/start_line, anchor outside hunks, unknown fields, unset rigor, an unknown or non-string category (warns once, stores null), brief site outside hunks, fenced suggestion, malformed kb id, and unknown or unattested chunks. Unknown top-level keys are allowed by the schema but still warn.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/selected.schema.json b/internal/schemagen/testdata/baseline/selected.schema.json index c9b32875d..15212602a 100644 --- a/internal/schemagen/testdata/baseline/selected.schema.json +++ b/internal/schemagen/testdata/baseline/selected.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/selected.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/selected.schema.json", "title": "selected.json — reaction-scoped fix selection", "description": "The reaction-scoped fix selection: the finding sigs whose posted root review comment carries at least one human 👍, written by a GitHub fetch (the only host whose reactions verdict reads) and read by fix --selected. No reaction leaves no file at all, because an empty selection would claim a scope nobody asked for.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/threads-resolve.schema.json b/internal/schemagen/testdata/baseline/threads-resolve.schema.json index 35f35c7b7..622f45e01 100644 --- a/internal/schemagen/testdata/baseline/threads-resolve.schema.json +++ b/internal/schemagen/testdata/baseline/threads-resolve.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/threads-resolve.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/threads-resolve.schema.json", "title": "threads-resolve.json — thread-resolve receipt", "description": "The receipt `threads resolve` writes beside threads.json: the host, head, and timestamp of the mutation, the ids it closed, and the candidates it skipped with a machine-readable reason. A real run writes one host resolve call per id in resolved[]; a dry run writes no receipt and carries the plan in the envelope only. GitHub and GitLab carry the mutation; a host without a resolve endpoint refuses before this document is written.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/threads.schema.json b/internal/schemagen/testdata/baseline/threads.schema.json index cf26b423f..b8915490c 100644 --- a/internal/schemagen/testdata/baseline/threads.schema.json +++ b/internal/schemagen/testdata/baseline/threads.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/threads.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/threads.schema.json", "title": "threads.json — normalized provider review threads", "description": "One provider bundle's normalized PR-conversation feed, written beside the raw host files (inline.json/reviews.json keep their exact bytes). Each host's native review data is filtered the way its review surface expects (system/deleted/pending comments dropped, host resolution and stale-anchor state read from the host's own fields) and flattened to one shape, so re-review, address-reviews, merge readiness, and calibration read prior feedback without parsing six formats. Review threads are authoritative: GitHub comes from GraphQL reviewThreads (REST has no resolution), GitLab from discussions (resolved/resolvable), Azure from thread status, Forgejo from review-comment resolver/position, Bitbucket from comment resolution + inline.outdated, GitCafe from its comment flags. Unknown root keys are rejected: a new field is a contract change.", "type": "object", diff --git a/internal/schemagen/testdata/baseline/usage.schema.json b/internal/schemagen/testdata/baseline/usage.schema.json index 4cabcf4bc..5227fd6c4 100644 --- a/internal/schemagen/testdata/baseline/usage.schema.json +++ b/internal/schemagen/testdata/baseline/usage.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/usage.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/usage.schema.json", "title": "usage.json — explicitly handed spend record", "description": "What the agent or a usage adapter hands the budget gate through VERDICT_USAGE: one measured run per record (a single object) or a run log (an array). The gate joins each record against past cost records by its window and prices comparable runs from usd, preferring it over the self-reported est_usd; records without usd never become a measured claim. verdict never discovers these files — the operator names them explicitly. Unknown keys are ignored, so newer writers stay readable.", "anyOf": [ diff --git a/internal/schemagen/testdata/baseline/validation.schema.json b/internal/schemagen/testdata/baseline/validation.schema.json index b704611bf..ec50069b3 100644 --- a/internal/schemagen/testdata/baseline/validation.schema.json +++ b/internal/schemagen/testdata/baseline/validation.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/validation.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/validation.schema.json", "title": "validation.json — trusted validator pass results", "description": "One trusted `prompts/validate.md` pass over a review's candidate findings, written beside review.json. The invoker runs the pass; verdict only reads the file, so a review never spawns a model. A CONFIRMED result changes nothing, a DOWNGRADED one moves the severity exactly one rank with a history event, and a REJECTED one warns in advisory mode or withholds the finding in gate mode. The validator's reason is stored and never quoted as a finding's evidence. post.json and record.json record the SHA-256 of these exact bytes.", "type": "object", diff --git a/notice_test.go b/notice_test.go index e0c7122b6..44f067913 100644 --- a/notice_test.go +++ b/notice_test.go @@ -174,11 +174,15 @@ func promptFiles(files []string) []string { return prompts } -// topLevel is the distinct first path segment of every shipped file, so a new -// artifact cannot arrive without a notice line. +// topLevel is the distinct first path segment of every shipped skill file, +// so a new artifact cannot arrive without a notice line. The published +// schemas are served from the repository root, not copied with the skill. func topLevel(files []string) []string { var names []string for _, file := range files { + if file == skillfs.SchemasDir || strings.HasPrefix(file, skillfs.SchemasDir+"/") { + continue + } name, _, _ := strings.Cut(file, "/") if !slices.Contains(names, name) { names = append(names, name) diff --git a/package.json b/package.json index aff922431..78c6c97aa 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "README.md", "LICENSE", "CHANGELOG.md", - "scripts/" + "scripts/", + "schemas/" ], "scripts": { "changeset": "changeset", diff --git a/skills/verdict/schemas/README.md b/schemas/README.md similarity index 100% rename from skills/verdict/schemas/README.md rename to schemas/README.md diff --git a/skills/verdict/schemas/author.schema.json b/schemas/author.schema.json similarity index 95% rename from skills/verdict/schemas/author.schema.json rename to schemas/author.schema.json index 96381fdaa..f6bb173e5 100644 --- a/skills/verdict/schemas/author.schema.json +++ b/schemas/author.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/author.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/author.schema.json", "title": "author.json — advisory author fingerprint", "description": "The advisory author fingerprint fetch detected in the bundle's PR text. It never blocks a review, never changes what is reviewed, and never pins a model; an unknown author writes no file at all rather than guessing, so absent means unknown, not human.", "type": "object", diff --git a/skills/verdict/schemas/backtest.schema.json b/schemas/backtest.schema.json similarity index 97% rename from skills/verdict/schemas/backtest.schema.json rename to schemas/backtest.schema.json index a47898645..be06aa0cd 100644 --- a/skills/verdict/schemas/backtest.schema.json +++ b/schemas/backtest.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/backtest.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/backtest.schema.json", "title": "report.json — backtest score report", "description": "The backtest score report, written to .verdict/backtest//report.json and echoed as the score envelope's data object: the same object, so one schema covers both. It grades each replayed PR's recorded findings against the bug lines the run's own SZZ candidate records, through the corpus matcher (+/-1 line, one finding per bug, text that names the defect kind). catch_rate is a match rate over blame-derived candidates, not a measured catch rate: a line a later fix deleted is a hypothesis about where a defect was, a deleted cleanup line beside the real bug is a candidate that was never defective, and an unmatched finding is not proven false.", "type": "object", diff --git a/skills/verdict/schemas/calibration.schema.json b/schemas/calibration.schema.json similarity index 96% rename from skills/verdict/schemas/calibration.schema.json rename to schemas/calibration.schema.json index 530ca7100..978767a99 100644 --- a/skills/verdict/schemas/calibration.schema.json +++ b/schemas/calibration.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/calibration.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/calibration.schema.json", "title": "calibration.json — live outcome audit", "description": "Saved live calibration audit. Unknown outcomes are excluded from judged; resolution_rate is null without a judged denominator.", "type": "object", diff --git a/skills/verdict/schemas/config.schema.json b/schemas/config.schema.json similarity index 98% rename from skills/verdict/schemas/config.schema.json rename to schemas/config.schema.json index 436374ee0..a8ee27655 100644 --- a/skills/verdict/schemas/config.schema.json +++ b/schemas/config.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/config.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/config.schema.json", "title": "config.json — typed repository configuration", "description": "The typed repository configuration at .verdict/config.json: versioned shared defaults and review requirements with path scopes, named work profiles, and the default profile. Structural validation comes from this schema; the hand-written parser in internal/config owns the semantic checks the schema cannot express (duplicate keys, credential keys, glob portability, clause-name uniqueness, per-group clause coverage).", "type": "object", diff --git a/skills/verdict/schemas/controls.schema.json b/schemas/controls.schema.json similarity index 95% rename from skills/verdict/schemas/controls.schema.json rename to schemas/controls.schema.json index be752f1e3..79482d4ba 100644 --- a/skills/verdict/schemas/controls.schema.json +++ b/schemas/controls.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/controls.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/controls.schema.json", "title": "controls.json — resolved review controls snapshot", "description": "The bundle's resolved review controls: fetch snapshots every control file at the PR base commit, and post/record refuse to trust the snapshot when its base or any used-file hash drifted. policy 'base' is the default; 'head' is the explicit --allow-head-controls opt-out.", "type": "object", diff --git a/skills/verdict/schemas/corpus.schema.json b/schemas/corpus.schema.json similarity index 97% rename from skills/verdict/schemas/corpus.schema.json rename to schemas/corpus.schema.json index 56785dac5..81be1fbfb 100644 --- a/skills/verdict/schemas/corpus.schema.json +++ b/schemas/corpus.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/corpus.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/corpus.schema.json", "title": "corpus.json — benchmark corpus case manifest", "description": "One benchmark corpus manifest, checked in as bench/corpus//case.json and copied into a run bundle as .verdict/state/corpus-*/corpus.json. The case records the ground truth a review output is graded against: a real PR that later needed a bug-fix commit, or a seeded defect with what was injected. calibrate and trend join findings.json against these bugs offline; a true positive needs the bug's path, a line inside the +/- line_tolerance window, and text that names the defect (kind, category, or keywords), one finding per bug. additionalProperties stays closed so a typo fails validation instead of silently grading a different field.", "type": "object", diff --git a/skills/verdict/schemas/cost.schema.json b/schemas/cost.schema.json similarity index 97% rename from skills/verdict/schemas/cost.schema.json rename to schemas/cost.schema.json index 81389a494..125e772a6 100644 --- a/skills/verdict/schemas/cost.schema.json +++ b/schemas/cost.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/cost.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/cost.schema.json", "title": "cost.json — agent self-reported spend record", "description": "What the agent writes per prompts/review.md and report --cost rolls up. One object per run, or an array when a bundle was reviewed more than once. The script only sums — it never prices: effort defaults to standard when missing or unknown, records without models still count as runs but not as runs_with_cost, every `models[]` entry must name its model — the name is what attribution reads, and the rollup sums all of them into one total rather than reporting per model, absent/unreadable records contribute zeros and never fail. Per-chunk records (chunks/.cost.json) share this shape. Two readers treat unknown keys differently, and this schema allows them for both. Aggregators — the rollup, the group estimate, the receipt — read the fields they know and ignore the rest, so a newer writer's extra field never voids history. Certification of lens evidence is version-scoped: a record offered as schema_version \"2\" may carry only the top-level fields v2 defines, and an extra one refuses that record by name until it is removed or a version that defines it is declared. A record bound to the run at a different version refuses as unsupported rather than being re-read as v2.", "anyOf": [ diff --git a/skills/verdict/schemas/drain-replies.schema.json b/schemas/drain-replies.schema.json similarity index 94% rename from skills/verdict/schemas/drain-replies.schema.json rename to schemas/drain-replies.schema.json index 4b5026015..4ad6b1b9d 100644 --- a/skills/verdict/schemas/drain-replies.schema.json +++ b/schemas/drain-replies.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/drain-replies.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/drain-replies.schema.json", "title": "drain.replies.json — drafted thread replies", "description": "The single artifact the drafting agent writes: one answer per pending thread, pinned to the plan digest. Verdict validates every site before any later step reads it; there is no host write in this build.", "type": "object", diff --git a/skills/verdict/schemas/drain.schema.json b/schemas/drain.schema.json similarity index 98% rename from skills/verdict/schemas/drain.schema.json rename to schemas/drain.schema.json index a3d4da6ac..d4c398721 100644 --- a/skills/verdict/schemas/drain.schema.json +++ b/schemas/drain.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/drain.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/drain.schema.json", "title": "drain.json — drain plan and receipt", "description": "The plan a drain run writes before drafting and the receipt it updates after posting. The plan pins one canonical pending list with a digest, typed skips for threads verdict authored but did not draft, and a count of other people's threads. The agent writes drain.replies.json against that digest; no host write happens in this build.", "type": "object", diff --git a/skills/verdict/schemas/envelope.schema.json b/schemas/envelope.schema.json similarity index 99% rename from skills/verdict/schemas/envelope.schema.json rename to schemas/envelope.schema.json index f8434e301..89c3f0be4 100644 --- a/skills/verdict/schemas/envelope.schema.json +++ b/schemas/envelope.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/envelope.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/envelope.schema.json", "title": "verdict --json envelope", "description": "Every --json stdout is exactly one envelope with these nine keys (schema_version \"1\"): error null on success with a data object, data null with a typed error object on refusal. Derived from the Go envelope renderer (RenderEnvelope) in the verdict CLI. data is additive per verb (chunk summaries, prompt_dump, cost, completeness ride inside data, never as new top-level keys), so data objects allow additional properties; every verb publishes its data profile here as a single Data $defs entry (reportData, postData, validationData, recordData, showData, fetchData, fetchLocalData, threadsData, verifyData, triageData, readyData, adoptData, ingestData, nextData, fixData, handoffData, learnData, packData, packTestData, initData, doctorData, checkTreeData, trendData, calibrateData, configData), each validated against the runtime writer and the committed goldens.", "type": "object", diff --git a/skills/verdict/schemas/excluded.schema.json b/schemas/excluded.schema.json similarity index 93% rename from skills/verdict/schemas/excluded.schema.json rename to schemas/excluded.schema.json index 2d24d6756..73aec4692 100644 --- a/skills/verdict/schemas/excluded.schema.json +++ b/schemas/excluded.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/excluded.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/excluded.schema.json", "title": "excluded.json — excluded diff bytes", "description": "Byte-accounted exclusion receipt. Paths and rule ids identify removed raw diff sections; both hashes bind the reviewed subset to its raw input.", "type": "object", diff --git a/skills/verdict/schemas/findings.schema.json b/schemas/findings.schema.json similarity index 98% rename from skills/verdict/schemas/findings.schema.json rename to schemas/findings.schema.json index 1bee9f6b0..402680180 100644 --- a/skills/verdict/schemas/findings.schema.json +++ b/schemas/findings.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/findings.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/findings.schema.json", "title": "findings.json — merged findings store", "description": "What post/record write per bundle. Derived from validate_and_merge in the verdict CLI: stable line-number-free sigs, append-only history, re-post merges that keep prior fields ($prev + new, so unknown keys pass through — this schema allows them). rigor is always normalized to the enum, severity and category to the enum-or-null (unknown category values warn and read null), kb defaults to []. Section entries carry anchored:\"body\" instead of a boolean.", "type": "array", diff --git a/skills/verdict/schemas/identity.schema.json b/schemas/identity.schema.json similarity index 93% rename from skills/verdict/schemas/identity.schema.json rename to schemas/identity.schema.json index 2b757c63b..85ce12af5 100644 --- a/skills/verdict/schemas/identity.schema.json +++ b/schemas/identity.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/identity.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/identity.schema.json", "title": "identity.json — bundle patch identity", "description": "Bundle patch identity written by fetch/fetch-local beside the diff: the stable diff id (git patch-id --stable, labeled diff-sha256 fallback) with the head/base SHAs it was computed at. A patch id is a dedupe key, never an authorization token.", "type": "object", diff --git a/skills/verdict/schemas/index.schema.json b/schemas/index.schema.json similarity index 96% rename from skills/verdict/schemas/index.schema.json rename to schemas/index.schema.json index 6bc028cb7..a5506a1cb 100644 --- a/skills/verdict/schemas/index.schema.json +++ b/schemas/index.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/index.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/index.schema.json", "title": "index tree — .verdict/index/trees/.json", "description": "One stored per-tree index under .verdict/index/trees/.json. Files are sorted by path, declarations and references stay in source order, and no timestamp or commit id lands here, so the same tree always writes the same bytes.", "type": "object", diff --git a/skills/verdict/schemas/lock.schema.json b/schemas/lock.schema.json similarity index 97% rename from skills/verdict/schemas/lock.schema.json rename to schemas/lock.schema.json index 4bda12ce9..f491eebb9 100644 --- a/skills/verdict/schemas/lock.schema.json +++ b/schemas/lock.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/lock.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/lock.schema.json", "title": "verdict.lock — pinned repo lens packs", "description": "The repo layer's pin file at .verdict/verdict.lock: strict JSON with exactly one row per pack vendored under .verdict/packs/, sorted by name. The lock covers only the repo layer — the built-in pack is pinned by the binary and org packs live in per-operator settings. source is dir: or git:@<40-hex sha>; hash is the pack's canonical tree hash; sig is sha256 over name, source, version, and hash, so a hand edit is caught. fetch, post, and record refuse pack-lock-missing or pack-lock-drift from the trusted-base snapshot, and the file joins the controls inventory so an edited snapshot copy refuses controls-stale.", "type": "object", diff --git a/skills/verdict/schemas/pack.schema.json b/schemas/pack.schema.json similarity index 97% rename from skills/verdict/schemas/pack.schema.json rename to schemas/pack.schema.json index a759e4578..1828e5905 100644 --- a/skills/verdict/schemas/pack.schema.json +++ b/schemas/pack.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/pack.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/pack.schema.json", "title": "pack.json — a lens pack manifest", "description": "A lens pack manifest at skills/verdict/packs/builtin/pack.json: the published format fetch resolves into the bundle. The schema closes the shape; the loader also enforces the caps (64 KiB/file, 1 MiB/pack, 256 files, 64 lenses) and the rule that every lens and rule id names its own markdown file. A file no manifest row names is counted but never loaded. Manifest keys must be spelled exactly as published: the loader refuses any other case.", "type": "object", diff --git a/skills/verdict/schemas/panel-plan.schema.json b/schemas/panel-plan.schema.json similarity index 95% rename from skills/verdict/schemas/panel-plan.schema.json rename to schemas/panel-plan.schema.json index cc561f443..598795d02 100644 --- a/skills/verdict/schemas/panel-plan.schema.json +++ b/schemas/panel-plan.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/panel-plan.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/panel-plan.schema.json", "title": "verification/plan.json — independent dispatch plan", "description": "Local planner output at verification/plan.json; verifiers follow the synthesizer in the pinned panel roster. No model or network call occurs.", "type": "object", diff --git a/skills/verdict/schemas/panel.schema.json b/schemas/panel.schema.json similarity index 91% rename from skills/verdict/schemas/panel.schema.json rename to schemas/panel.schema.json index 6a416f489..6033938e6 100644 --- a/skills/verdict/schemas/panel.schema.json +++ b/schemas/panel.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/panel.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/panel.schema.json", "title": "verification/verdicts.json — independent verifier receipts", "description": "Invoker-written verification/verdicts.json: head-bound independent opinions. Duplicate (sig, model) and unknown or ambiguous signatures are refused by the runtime; a refutation never deletes a finding.", "type": "object", diff --git a/skills/verdict/schemas/post.schema.json b/schemas/post.schema.json similarity index 98% rename from skills/verdict/schemas/post.schema.json rename to schemas/post.schema.json index 1603c9edd..212f3015a 100644 --- a/skills/verdict/schemas/post.schema.json +++ b/schemas/post.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/post.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/post.schema.json", "title": "post.json — completed-post record (PR bundles)", "description": "Written only by the real-post path in the verdict CLI (dry runs, attempts and failures write nothing), so a present head matching the bundle HEAD proves a completed post. review is raw GitHub output (GitHub's schema, unversioned) — this schema passes it through. confidence/security_summary are absent-stays-absent: null when the review carried none. additionalProperties stays open for additive provenance fields.", "type": "object", diff --git a/skills/verdict/schemas/recipes.schema.json b/schemas/recipes.schema.json similarity index 98% rename from skills/verdict/schemas/recipes.schema.json rename to schemas/recipes.schema.json index cedd3ee47..2e755dfdc 100644 --- a/skills/verdict/schemas/recipes.schema.json +++ b/schemas/recipes.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/recipes.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/recipes.schema.json", "title": "recipes.json — declared review pipelines", "description": "The declared review pipelines a run resolves by name from .verdict/recipes.json at the PR base: lenses, synthesizer hint, and budget, compiled into the four-stage plan data.recipe and launcher.json record, whose shape is published here as $defs/plan. The file is a review control, read from the base snapshot and hash-gated like the typed configuration, so a head edit never steers the pipeline it is judged by. Positions are declarations, not selections: run launches one process and never chooses a model. Every key is spelled exactly as published; the loader refuses any other case, an unknown key, and a duplicate key with bad-recipe.", "type": "object", diff --git a/skills/verdict/schemas/record.schema.json b/schemas/record.schema.json similarity index 98% rename from skills/verdict/schemas/record.schema.json rename to schemas/record.schema.json index 4b71324ae..49b121c4d 100644 --- a/skills/verdict/schemas/record.schema.json +++ b/schemas/record.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/record.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/record.schema.json", "title": "record.json — completed-record (local bundles)", "description": "Written by the record verb in the verdict CLI for local and provider-PR bundles (GitHub PRs use post). findings/open are recomputed from the merged store every run; confidence/security_summary are null when the review carried none. additionalProperties stays open for additive provenance fields.", "type": "object", diff --git a/skills/verdict/schemas/review.schema.json b/schemas/review.schema.json similarity index 98% rename from skills/verdict/schemas/review.schema.json rename to schemas/review.schema.json index 55a7d5a50..94498e991 100644 --- a/skills/verdict/schemas/review.schema.json +++ b/schemas/review.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/review.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/review.schema.json", "title": "review.json — agent-written review input", "description": "What the agent writes and post/record validate. One checker reports every problem: error refuses; warning lets record proceed and is promoted by --strict/strict_input. An absent schema_version reads as 1; any other value refuses. Errors: schema_version other than 1, missing/non-string/degenerate body, non-boolean approved, non-array comments or non-object items, comment path missing/non-string/not in diff, line/start_line wrong type, side wrong type or not RIGHT/LEFT, missing body, non-string suggestion, brief outcome/site/approach/question shape or range failures, rigor/severity wrong type or unknown, non-boolean in-bounds, kb non-array/non-string, resolved/triage/sections shape and enums, confidence non-integer or outside 1-5, non-string security_summary, malformed or partial chunks, and malformed verification claims. Warnings: missing comments, no line/start_line, anchor outside hunks, unknown fields, unset rigor, an unknown or non-string category (warns once, stores null), brief site outside hunks, fenced suggestion, malformed kb id, and unknown or unattested chunks. Unknown top-level keys are allowed by the schema but still warn.", "type": "object", diff --git a/skills/verdict/schemas/sarif-map.json b/schemas/sarif-map.json similarity index 100% rename from skills/verdict/schemas/sarif-map.json rename to schemas/sarif-map.json diff --git a/skills/verdict/schemas/selected.schema.json b/schemas/selected.schema.json similarity index 93% rename from skills/verdict/schemas/selected.schema.json rename to schemas/selected.schema.json index c9b32875d..15212602a 100644 --- a/skills/verdict/schemas/selected.schema.json +++ b/schemas/selected.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/selected.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/selected.schema.json", "title": "selected.json — reaction-scoped fix selection", "description": "The reaction-scoped fix selection: the finding sigs whose posted root review comment carries at least one human 👍, written by a GitHub fetch (the only host whose reactions verdict reads) and read by fix --selected. No reaction leaves no file at all, because an empty selection would claim a scope nobody asked for.", "type": "object", diff --git a/skills/verdict/schemas/threads-resolve.schema.json b/schemas/threads-resolve.schema.json similarity index 96% rename from skills/verdict/schemas/threads-resolve.schema.json rename to schemas/threads-resolve.schema.json index 35f35c7b7..622f45e01 100644 --- a/skills/verdict/schemas/threads-resolve.schema.json +++ b/schemas/threads-resolve.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/threads-resolve.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/threads-resolve.schema.json", "title": "threads-resolve.json — thread-resolve receipt", "description": "The receipt `threads resolve` writes beside threads.json: the host, head, and timestamp of the mutation, the ids it closed, and the candidates it skipped with a machine-readable reason. A real run writes one host resolve call per id in resolved[]; a dry run writes no receipt and carries the plan in the envelope only. GitHub and GitLab carry the mutation; a host without a resolve endpoint refuses before this document is written.", "type": "object", diff --git a/skills/verdict/schemas/threads.schema.json b/schemas/threads.schema.json similarity index 98% rename from skills/verdict/schemas/threads.schema.json rename to schemas/threads.schema.json index cf26b423f..b8915490c 100644 --- a/skills/verdict/schemas/threads.schema.json +++ b/schemas/threads.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/threads.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/threads.schema.json", "title": "threads.json — normalized provider review threads", "description": "One provider bundle's normalized PR-conversation feed, written beside the raw host files (inline.json/reviews.json keep their exact bytes). Each host's native review data is filtered the way its review surface expects (system/deleted/pending comments dropped, host resolution and stale-anchor state read from the host's own fields) and flattened to one shape, so re-review, address-reviews, merge readiness, and calibration read prior feedback without parsing six formats. Review threads are authoritative: GitHub comes from GraphQL reviewThreads (REST has no resolution), GitLab from discussions (resolved/resolvable), Azure from thread status, Forgejo from review-comment resolver/position, Bitbucket from comment resolution + inline.outdated, GitCafe from its comment flags. Unknown root keys are rejected: a new field is a contract change.", "type": "object", diff --git a/skills/verdict/schemas/usage.schema.json b/schemas/usage.schema.json similarity index 96% rename from skills/verdict/schemas/usage.schema.json rename to schemas/usage.schema.json index 4cabcf4bc..5227fd6c4 100644 --- a/skills/verdict/schemas/usage.schema.json +++ b/schemas/usage.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/usage.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/usage.schema.json", "title": "usage.json — explicitly handed spend record", "description": "What the agent or a usage adapter hands the budget gate through VERDICT_USAGE: one measured run per record (a single object) or a run log (an array). The gate joins each record against past cost records by its window and prices comparable runs from usd, preferring it over the self-reported est_usd; records without usd never become a measured claim. verdict never discovers these files — the operator names them explicitly. Unknown keys are ignored, so newer writers stay readable.", "anyOf": [ diff --git a/skills/verdict/schemas/validate.sh b/schemas/validate.sh similarity index 90% rename from skills/verdict/schemas/validate.sh rename to schemas/validate.sh index 1bd14a63e..515574328 100755 --- a/skills/verdict/schemas/validate.sh +++ b/schemas/validate.sh @@ -22,4 +22,6 @@ # (VERDICT_BIN, the skill's bin/verdict, then PATH) and needs no jq. set -eu HERE=$(cd -- "$(dirname -- "$0")" && pwd -P) -exec "$HERE/../scripts/verdict" __validate-schema "$@" +BIN="$HERE/../scripts/verdict" +[ -x "$BIN" ] || BIN="$HERE/../skills/verdict/scripts/verdict" +exec "$BIN" __validate-schema "$@" diff --git a/skills/verdict/schemas/validation.schema.json b/schemas/validation.schema.json similarity index 96% rename from skills/verdict/schemas/validation.schema.json rename to schemas/validation.schema.json index b704611bf..ec50069b3 100644 --- a/skills/verdict/schemas/validation.schema.json +++ b/schemas/validation.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/stainless-code/verdict/blob/main/skills/verdict/schemas/validation.schema.json", + "$id": "https://github.com/stainless-code/verdict/blob/main/schemas/validation.schema.json", "title": "validation.json — trusted validator pass results", "description": "One trusted `prompts/validate.md` pass over a review's candidate findings, written beside review.json. The invoker runs the pass; verdict only reads the file, so a review never spawns a model. A CONFIRMED result changes nothing, a DOWNGRADED one moves the severity exactly one rank with a history event, and a REJECTED one warns in advisory mode or withholds the finding in gate mode. The validator's reason is stored and never quoted as a finding's evidence. post.json and record.json record the SHA-256 of these exact bytes.", "type": "object", diff --git a/scripts/size-baseline.txt b/scripts/size-baseline.txt index 5c8d5d9ed..0d31c73be 100644 --- a/scripts/size-baseline.txt +++ b/scripts/size-baseline.txt @@ -1,6 +1,6 @@ deps 0 -darwin/amd64 17590000 -darwin/arm64 16000000 +darwin/amd64 17610000 +darwin/arm64 16010000 linux/amd64 17290000 linux/arm64 15600000 windows/amd64 17680000 diff --git a/skillfs.go b/skillfs.go index 13bb88d70..c35b8a3f6 100644 --- a/skillfs.go +++ b/skillfs.go @@ -1,50 +1,166 @@ -// Package skillfs embeds the shipped skill payload from skills/verdict/, the -// one directory that holds it: go:embed cannot reach parent directories, so -// this root package embeds it in place instead of a generated copy. The -// skills CLI installs that same directory from the registry, so the binary, -// the served skill, and `npx skills add` are byte-identical by construction -// and `verdict skill` can never serve a version that differs from the binary -// that built it. +// Package skillfs embeds the shipped skill payload from skills/verdict/ and +// the published schemas from schemas/. Go embed cannot reach parent +// directories, so this root package embeds both in place instead of generating +// copies. The binary serves both under the paths an installed skill uses: +// "prompts/review.md" and "schemas/review.schema.json". package skillfs import ( "embed" "fmt" + "io" "io/fs" "slices" + "strings" ) // SkillMD is the skill entry point, relative to the payload root. const SkillMD = "SKILL.md" -// Dir is the checkout directory that holds the payload: the one directory the -// skills CLI discovers and copies, so it carries nothing but the payload — -// including NOTICE.md, so an installed copy carries the adapted prompts' -// upstream license rather than depending on the repository root. +// Dir is the checkout directory that holds the skill payload: the one +// directory the skills CLI discovers and copies, so it carries nothing but +// that payload. const Dir = "skills/verdict" +// SchemasDir is the checkout directory that holds the published schemas. It +// is embedded separately but served under the same name in the payload. +const SchemasDir = "schemas" + // payload is the embedded skill directory: SKILL.md, NOTICE.md (the -// upstream license the adapted prompts travel with), prompts/, schemas/, -// packs/ (the built-in lens pack), and the POSIX shim that resolves the +// upstream license the adapted prompts travel with), prompts/, packs/ (the +// built-in lens pack), references/, and the POSIX shim that resolves the // binary from a skill copy. Patterns name files and subtrees, never the bare // directory, so a stray file beside them is not embedded (and // TestEmbedMatchesRepo fails on it). // //go:embed skills/verdict/SKILL.md skills/verdict/NOTICE.md skills/verdict/prompts -//go:embed skills/verdict/schemas skills/verdict/packs skills/verdict/scripts/verdict -//go:embed skills/verdict/references +//go:embed skills/verdict/packs skills/verdict/scripts/verdict skills/verdict/references var payload embed.FS -// FS is the payload rooted at the skill directory: paths read "SKILL.md", -// "prompts/review.md", never "skills/verdict/...". -var FS = mustSub() +// published is the repository's published schemas, served at "schemas/...". +// +//go:embed schemas +var published embed.FS + +// FS serves the skill payload and the published schemas under one root. +var FS = newFS() + +const rootPath = "." + +const ( + verbOpen = "open" + verbRead = "read" + verbStat = "stat" +) + +type embeddedError struct { + cause error + verb string + name string +} + +func (e *embeddedError) Error() string { return e.verb + " " + e.name + ": " + e.cause.Error() } + +func (e *embeddedError) Unwrap() error { return e.cause } + +func wrapEmbedded(verb, name string, cause error) error { + return &embeddedError{verb: verb, name: name, cause: cause} +} + +type embeddedFS struct { + skill fs.FS + schemas fs.FS +} -func mustSub() fs.FS { +func newFS() fs.FS { sub, err := fs.Sub(payload, Dir) if err != nil { panic("skillfs: " + err.Error()) } - return sub + return embeddedFS{skill: sub, schemas: published} +} + +func (f embeddedFS) Open(name string) (fs.File, error) { + if name == rootPath { + return openRoot(f) + } + if name == SchemasDir || strings.HasPrefix(name, SchemasDir+"/") { + file, err := f.schemas.Open(name) + if err != nil { + return nil, wrapEmbedded(verbOpen, name, err) + } + return file, nil + } + file, err := f.skill.Open(name) + if err != nil { + return nil, wrapEmbedded(verbOpen, name, err) + } + return file, nil +} + +func openRoot(f embeddedFS) (fs.File, error) { + skillRoot, err := f.skill.Open(rootPath) + if err != nil { + return nil, wrapEmbedded(verbOpen, Dir, err) + } + defer skillRoot.Close() + info, err := skillRoot.Stat() + if err != nil { + return nil, wrapEmbedded(verbStat, Dir, err) + } + skillDir, ok := skillRoot.(fs.ReadDirFile) + if !ok { + return nil, wrapEmbedded(verbOpen, Dir+" is not a directory", fs.ErrInvalid) + } + skillEntries, err := skillDir.ReadDir(-1) + if err != nil { + return nil, wrapEmbedded(verbRead, Dir, err) + } + schemaRoot, err := f.schemas.Open(rootPath) + if err != nil { + return nil, wrapEmbedded(verbOpen, SchemasDir, err) + } + defer schemaRoot.Close() + schemaDir, ok := schemaRoot.(fs.ReadDirFile) + if !ok { + return nil, wrapEmbedded(verbOpen, SchemasDir+" is not a directory", fs.ErrInvalid) + } + schemaEntries, err := schemaDir.ReadDir(-1) + if err != nil { + return nil, wrapEmbedded(verbRead, SchemasDir, err) + } + entries := make([]fs.DirEntry, 0, len(skillEntries)+len(schemaEntries)) + entries = append(entries, skillEntries...) + entries = append(entries, schemaEntries...) + slices.SortFunc(entries, func(a, b fs.DirEntry) int { + return strings.Compare(a.Name(), b.Name()) + }) + return &rootDir{info: info, entries: entries}, nil +} + +type rootDir struct { + info fs.FileInfo + entries []fs.DirEntry + read bool +} + +func (d *rootDir) Stat() (fs.FileInfo, error) { return d.info, nil } + +func (d *rootDir) Read([]byte) (int, error) { return 0, io.EOF } + +func (d *rootDir) Close() error { return nil } + +func (d *rootDir) ReadDir(n int) ([]fs.DirEntry, error) { + if d.read { + return nil, io.EOF + } + if n > 0 && n < len(d.entries) { + out := d.entries[:n] + d.entries = d.entries[n:] + return out, nil + } + d.read = true + return d.entries, nil } const ( @@ -60,7 +176,7 @@ var executable = map[string]bool{ // Paths lists every embedded payload path in slash form, sorted. func Paths() ([]string, error) { var out []string - err := fs.WalkDir(FS, ".", func(path string, entry fs.DirEntry, err error) error { + err := fs.WalkDir(FS, rootPath, func(path string, entry fs.DirEntry, err error) error { if err != nil { return err } diff --git a/skillfs_test.go b/skillfs_test.go index f5b61b406..4a278bde3 100644 --- a/skillfs_test.go +++ b/skillfs_test.go @@ -14,41 +14,40 @@ import ( skillfs "github.com/stainless-code/verdict" ) -// repoFiles lists every file the repository would ship under the skill -// directory — tracked plus untracked-but-not-ignored, dotfiles included, no -// matter whether it is embedded — as slash paths relative to it. This is what -// the skills CLI copies to an agent from a clone, so it must equal the -// embedded payload. Ignored dev state (a bootstrapped bin/) is not shipped -// and not listed. Without git it falls back to every file on disk. -func repoFiles(t *testing.T) []string { +// repoFiles lists every file the repository would ship under dir — tracked +// plus untracked-but-not-ignored, dotfiles included — as slash paths relative +// to it. This is what a clone carries, so it must equal what is embedded. +// Ignored dev state (a bootstrapped bin/) is not shipped and not listed. +// Without git it falls back to every file on disk. +func repoFiles(t *testing.T, dir string) []string { t.Helper() - out, err := exec.CommandContext(t.Context(), "git", "ls-files", "-z", "--cached", "--others", "--exclude-standard", "--", skillfs.Dir).Output() + out, err := exec.CommandContext(t.Context(), "git", "ls-files", "-z", "--cached", "--others", "--exclude-standard", "--", dir).Output() if err != nil { - return diskFiles(t) + return diskFiles(t, dir) } var files []string for name := range strings.SplitSeq(string(out), "\x00") { if name == "" { continue } - files = append(files, strings.TrimPrefix(name, skillfs.Dir+"/")) + files = append(files, strings.TrimPrefix(name, dir+"/")) } slices.Sort(files) return files } -// diskFiles lists every file under the skill directory, relative to it. -func diskFiles(t *testing.T) []string { +// diskFiles lists every file under dir, relative to it. +func diskFiles(t *testing.T, dir string) []string { t.Helper() var files []string - err := filepath.WalkDir(filepath.FromSlash(skillfs.Dir), func(path string, entry fs.DirEntry, err error) error { + err := filepath.WalkDir(filepath.FromSlash(dir), func(path string, entry fs.DirEntry, err error) error { if err != nil { return err } if entry.IsDir() { return nil } - rel, err := filepath.Rel(filepath.FromSlash(skillfs.Dir), path) + rel, err := filepath.Rel(filepath.FromSlash(dir), path) if err != nil { return err } @@ -62,24 +61,39 @@ func diskFiles(t *testing.T) []string { return files } -// onDisk is the checkout path of one payload file. +// servedFiles is the checkout files served under payload paths: the skill +// directory plus the repository's published schemas. +func servedFiles(t *testing.T) []string { + t.Helper() + files := repoFiles(t, skillfs.Dir) + for _, name := range repoFiles(t, skillfs.SchemasDir) { + files = append(files, skillfs.SchemasDir+"/"+name) + } + slices.Sort(files) + return files +} + +// onDisk is the checkout path of one served payload file. func onDisk(path string) string { + if path == skillfs.SchemasDir || strings.HasPrefix(path, skillfs.SchemasDir+"/") { + return filepath.FromSlash(path) + } return filepath.Join(filepath.FromSlash(skillfs.Dir), filepath.FromSlash(path)) } // TestEmbedMatchesRepo is the drift guard: every embedded payload path has a -// byte-identical checked-in file, every file in the skill directory is -// embedded (so nothing else would reach `npx skills add`), and the -// executable bits agree. +// byte-identical checked-in file, every file in the skill directory and the +// published schemas directory is embedded (so nothing else would reach +// `npx skills add`), and the executable bits agree. func TestEmbedMatchesRepo(t *testing.T) { t.Parallel() - want := repoFiles(t) + want := servedFiles(t) got, err := skillfs.Paths() if err != nil { t.Fatal(err) } if !slices.Equal(got, want) { - t.Fatalf("embedded paths = %v, want the files in %s: %v", got, skillfs.Dir, want) + t.Fatalf("embedded paths = %v, want the files in %s and %s: %v", got, skillfs.Dir, skillfs.SchemasDir, want) } for _, path := range want { assertEmbeddedFile(t, path)