Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/37980-skill-evals-case-filter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/scenarios': patch
---

feat(scenarios): `skill-evals --case BUNDLE/FILE_STEM#ID[,…]` plans the named eval cases alone, so a single-case acceptance round runs from the committed command

Clause-②: no
Metadata-protocol: none

The skill-evals runner selected whole bundles (`--skills`, `--skills-from`, `--triggers-only`) and never one case, so a round on one case needed a driver of its own. `--case` takes case keys as the summary and every run record print them (`objectstack-ai/skills-tools-knowledge#6`): ids repeat across a bundle's eval files, so a bundle and an id alone would not name one case. The round plans only those cases, a behaviour case on both arms and a trigger case on the with-skill arm. A key that names no case is refused with where it stopped matching (the bundle, the eval file or the id, and the ones that exist). Beside `--skills`, every named case must be of a `--skills` bundle, and `--skills` still sets what a trigger turn installs; the flag is refused beside `--triggers-only`, `--regrade` and `--self-test`. `round.json` gains `scope.selectedCases` (additive; absent on every other round), the summary header lists the keys, and `--regrade DIR` keeps that scope instead of reading the rest of the bundle as cases added since. The runner's header comment and README now name the `must_contain_any` form, and the README shows the summary's unmet-group form as the renderer prints it, each token in a code span.
14 changes: 13 additions & 1 deletion packages/qa/scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ pnpm --filter @objectstack/scenarios skill-evals --skills objectstack-query --re
pnpm --filter @objectstack/scenarios skill-evals --skills-from 18.5.0 # a published @objectstack/skills version's bundles and cases
pnpm --filter @objectstack/scenarios skill-evals --skills objectstack-query --triggers-only # its trigger cases alone
pnpm --filter @objectstack/scenarios skill-evals --skills objectstack-query,objectstack-ask --triggers-only # both installed in every trigger turn
pnpm --filter @objectstack/scenarios skill-evals --case objectstack-ai/skills-tools-knowledge#6 --repeats 10 # one case, both arms
pnpm --filter @objectstack/scenarios skill-evals --regrade DIR # re-draw a recorded round's verdicts from its records; no model call
pnpm --filter @objectstack/scenarios skill-evals --self-test # the runner's own fixtures; no model call
```
Expand All @@ -1031,7 +1032,8 @@ pnpm --filter @objectstack/scenarios skill-evals --self-test # the runner's o
share one literal: `[["ai:approve", "signed-in session"], ["refused", "403"]]` reads "(the first or the second) and
(the third or the fourth)". The reader refuses a group that is empty or holds an empty token, and a case with no
token in any of the three forms. A failing record names each unmet group whole in `unmetAny` (the key is absent when
every group is met), and the summary's missed column prints it as `(none of: a / b)`. A turn whose init line shows the wrong arm is `invalid`: the with-skill arm does not list the bundle, or
every group is met), and the summary's missed column prints it as ``(none of: `a` / `b`)``, each token in its own
code span like the all-of tokens beside it (`summary.github.md` spells angle brackets in them out as `(lt)` / `(gt)`). A turn whose init line shows the wrong arm is `invalid`: the with-skill arm does not list the bundle, or
the no-skill arm lists one or launches one. A bundle whose `SKILL.md` sets `user-invocable: false` (`objectui`) is
never in the init line's `skills` list, though the model can launch it. Its with-skill turns are graded, and each
record's `armEvidence` says whether the turn launched the bundle (`launched`) or nothing in the stream shows it
Expand Down Expand Up @@ -1060,6 +1062,16 @@ pnpm --filter @objectstack/scenarios skill-evals --self-test # the runner's o
installed as a competitor while another named bundle has one; alone, or under `--trigger-field own`, it is refused
(a published version before trigger cases has none). The flag is refused beside `--regrade` or `--self-test`.
`--dry-run` prints the reduced plan, and `--skills-from VERSION` runs it on the published bundles.
- **`--case KEY[,KEY]`**: the named cases alone, for an acceptance round on one or two cases. A key is the case's key
as the summary and each record print it, `BUNDLE/FILE_STEM#ID` (`objectstack-query/filters-pagination-search#3`):
ids repeat across a bundle's eval files, so a bundle and an id alone would not name one case. The flag repeats, and
the plan keeps catalog order. A behaviour case runs on both arms and a trigger case on the with-skill arm, as in a
whole round. A key that names no case is refused with where it stopped matching: the bundle, the eval file, or the
id, with the ones that exist. Beside `--skills`, every named case must be of a `--skills` bundle, and `--skills`
still sets what a trigger turn installs beside its bundle; without it, a trigger turn installs every bundle, as in
a whole round. It is refused beside `--triggers-only` (the keys already say which cases run), `--regrade` and
`--self-test`. `round.json` records the keys as `scope.selectedCases`, the summary header lists them, and
`--regrade DIR` keeps that scope. `--dry-run` prints the plan with only those cases.
- **Case files**: a case's `files` entries are paths under the bundle's `evals/files/` (anything else is refused, and
so is a path the bundle lacks or one with a `.claude` segment, since `.claude/` is where the runner places the skill). Each is copied, a directory whole, into both arms' directories at its path below
`evals/files/`, so the arms still differ only in the bundle. A case whose prompt states its context needs none.
Expand Down
32 changes: 32 additions & 0 deletions packages/qa/scenarios/src/skill-evals/cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,35 @@ export function selectBundles(catalog: SkillEvalCatalog, names: readonly string[
if (noCases.length && !(competing && picked.some((c) => c.shouldTrigger !== undefined))) throw new Error(`--skills names ${noCases.map((n) => `\`${n}\``).join(', ')}, a bundle with no ${kind} under ${catalog.root}`);
return picked;
}

/** A `--case` key's shape: `BUNDLE/FILE_STEM#ID`, the key the summary and every record print. */
export const CASE_KEY_SHAPE = /^[^/#\s]+\/[^\s]+#[^\s]+$/;

/**
* Narrow a selection (`selectBundles`' answer) to the cases `--case` names by
* key, kept in catalog order. A key that names no case of the selection is
* refused, never dropped, and the refusal says where it stopped matching: a
* bundle the catalog lacks, a bundle `--skills` leaves out, an eval file the
* bundle lacks, or an id that file does not hold. A misspelt case would
* otherwise plan nothing for it and read as a clean round. Pure.
*/
export function selectCases(catalog: SkillEvalCatalog, selection: readonly SkillEvalCase[], keys: readonly string[], skills?: readonly string[]): SkillEvalCase[] {
const list = (xs: readonly string[]) => xs.map((x) => `\`${x}\``).join(', ') || 'none';
for (const key of keys) {
if (selection.some((c) => c.key === key)) continue;
const slash = key.indexOf('/');
const hash = key.lastIndexOf('#');
const bundle = key.slice(0, slash);
const stem = key.slice(slash + 1, hash);
const id = key.slice(hash + 1);
if (!catalog.bundles.includes(bundle)) throw new Error(`--case names \`${key}\`: \`${bundle}\` is not a bundle under ${catalog.root} (bundles: ${catalog.bundles.join(', ')})`);
if (skills?.length && !skills.includes(bundle)) throw new Error(`--case names \`${key}\`, a case of \`${bundle}\`, which --skills leaves out (--skills: ${skills.join(', ')})`);
const inBundle = catalog.cases.filter((c) => c.bundle === bundle);
const stems = [...new Set(inBundle.map((c) => c.file.replace(/\.json$/, '')))];
if (!stems.includes(stem)) throw new Error(`--case names \`${key}\`: ${bundle}/evals/ holds no eval file \`${stem}.json\` with a case (files: ${list(stems.map((s) => `${s}.json`))})`);
const ids = inBundle.filter((c) => c.file.replace(/\.json$/, '') === stem).map((c) => String(c.id));
throw new Error(`--case names \`${key}\`: ${bundle}/evals/${stem}.json holds no case with id \`${id}\` (ids: ${ids.join(', ')})`);
}
const wanted = new Set(keys);
return selection.filter((c) => wanted.has(c.key));
}
Loading
Loading