Skip to content

Commit d652996

Browse files
fix(scenarios): make every skill-evals arm directory under the system temp directory (#34949)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_ Fixes #34934 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:skill-evals 的每个 arm 工作目录固定建在系统临时目录下(`mkdtempSync(join(tmpdir(), 'skill-eval-'))`),去掉内部的 `base` 参数。 - 为什么改:#34841 落地后 `base` 是带默认值的函数参数,dispatch-gates 的临时目录扫描读不出它,慢档自测判 UNRESOLVED,main 的 `Lint · PM dispatch-gates` 一直是红的。 - 风险与回滚:极低;一轮评测的行为不变(原本就只用默认值),只有包内两处测试改为自行删除目录。回滚即 revert 本 PR。 - 先看:`packages/qa/scenarios/src/skill-evals/arms.ts`(唯一的行为改动处),再看 `test/skill-evals/skill-evals.test.ts` 的清理。 - 两分钟验证:`node scripts/pm/check-dispatch-gates.mjs --slow`,预期 `no mkdtempSync site in this tree takes a base the scan cannot read` 为 ✓、退出码 0。 - 需要你做的:无,席位落地。 ## What changes - `prepareArmWorkdir(arm, bundle, skillsRoot)` makes its root with `mkdtempSync(join(tmpdir(), 'skill-eval-'))`. The defaulted `base` parameter is removed. The scratch scan in `scripts/pm/dispatch-gates.mjs` cannot bind a parameter default, and it fails the build on any `mkdtempSync` site whose base it cannot read. The only production caller (`run.ts`) never passed a base, so a round behaves exactly as before. - The two test callers stop passing a scratch base. The `--self-test` rows already removed `d.root`. The vitest case now removes both roots in a `finally` and checks that the root lands under the system temp directory. - The scan and its self-test are not touched. - A patch changeset is included: `arms.ts` and `self-test.ts` ship inside the published `dist/` (the `skill-evals` command line). No export changes. ## Tests Run at head `8f7facaa`. - `pnpm --filter @objectstack/scenarios typecheck`: exit 0. - `pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/skill-evals/skill-evals.test.ts`: Test Files 1 passed (1), Tests 26 passed (26). The lock printed `VERDICT command-exit 0`. - `pnpm skill-evals --self-test`: `✓ skill-evals self-test: 21 rows pass.`, exit 0. - `node scripts/check-nul-bytes.mjs`: OK, exit 0. - `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0`. The branch merges cleanly onto origin/main `d576509c80`. ## Acceptance notes - The failing case is in the battery's slow tier. A plain local `pnpm check:pm-dispatch-gates` runs only the fast tier, and so does CI on `pull_request` and `merge_group`. That run was green on the unfixed tree: `2249 cases pass; 9 slow section(s) deferred`, `GATE_EXIT=0`. So the before and after readings below come from the scan itself and from `--slow`. This PR's own check-runs cannot show the fix. The next push to main or the next schedule run shows it. ## Verification <details><summary>Before: unfixed tree at origin/main 189358f</summary> - Direct read of the scan (`exposedScratchDirs({})` from `scripts/pm/dispatch-gates.mjs`, the function the failing case calls): `sites=3078 files=22703 inTree=93 exposed=0 unresolvedMkdtemp=1`, then `UNRESOLVED packages/qa/scenarios/src/skill-evals/arms.ts:83 (base is not bound in this file)`. This is the main red. - `pnpm check:pm-dispatch-gates` with the default tier (fast): `2249 cases pass; 9 slow section(s) deferred`, `GATE_EXIT=0`. This reading is green because the failing case is deferred, see Acceptance notes. </details> <details><summary>After: head 8f7faca</summary> - The same direct read: `sites=3078 files=22703 inTree=93 exposed=0 unresolvedMkdtemp=0`. - `node scripts/pm/check-dispatch-gates.mjs --self-test`: green. Then `pnpm check:pm-dispatch-gates` (fast tier): `2249 cases pass`, `GATE_EXIT=0`. - `node scripts/pm/check-dispatch-gates.mjs --slow` (both tiers): `✓ no mkdtempSync site in this tree takes a base the scan cannot read`, `✓ dispatch-gates self-test: 2564 cases pass.`, `the battery (both tiers) took 1651.8s`, `GATE_EXIT=0`. </details> <details><summary>Derived gate families (`dispatch-gates.mjs --commands`, 61)</summary> - 57 exit 0. - NOT MEASURED, prerequisite not met (exit 3), left to CI: `node scripts/check-plugin-teardown-shape.mjs --self-test` (shallow clone, the fixture is pinned to a commit) and `pnpm check:dual-build-cjs-loads` (needs a full `pnpm build`). - `pnpm check:query-options-erasure`: exit 0 on a rerun with a longer budget. The first run hit the 240 s cap. - `pnpm check:type-check-debt`: in progress when this PR was opened. CI covers it. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzg1NmbJpZhtiWQkTir)_ repo:objectstack#3 · os-support-ai · session_01WGufzg1NmbJpZhtiWQkTir Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 3f5ffe7 commit d652996

4 files changed

Lines changed: 31 additions & 11 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/scenarios': patch
3+
---
4+
5+
fix(scenarios): a skill-evals arm directory is always made under the system temp directory
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skill-evals` made each turn's directory under a base its caller could pass, defaulting to the system temp directory. Every turn of a round already used that default; only the package's own tests passed a scratch base. The base is now spelled at the call, `join(tmpdir(), 'skill-eval-')`, so the repository's scratch-directory scan can read where it lands, and the internal `base` argument is gone. A round behaves exactly as before.

‎packages/qa/scenarios/src/skill-evals/arms.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,13 @@ export interface ArmWorkdir {
7878
* Make one turn's directory: `ROOT/project` as the working directory, holding
7979
* `.claude/skills/BUNDLE/` (without `evals/`) on the with-skill arm and
8080
* nothing on the no-skill arm, and `ROOT/mcp.json` beside it.
81+
*
82+
* `ROOT` is always under the system temp directory, spelled at the call so the
83+
* dispatch-gates scratch scan reads it as outside the tree; a caller that
84+
* wants it gone removes `root` itself.
8185
*/
82-
export function prepareArmWorkdir(arm: Arm, bundle: string, skillsRoot: string, base: string = tmpdir()): ArmWorkdir {
83-
const root = mkdtempSync(join(base, 'skill-eval-'));
86+
export function prepareArmWorkdir(arm: Arm, bundle: string, skillsRoot: string): ArmWorkdir {
87+
const root = mkdtempSync(join(tmpdir(), 'skill-eval-'));
8488
const cwd = join(root, 'project');
8589
mkdirSync(cwd);
8690
const mcpConfigPath = join(root, 'mcp.json');

‎packages/qa/scenarios/src/skill-evals/self-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export function runSelfTest(deps: SelfTestDeps): SelfTestResult {
164164
{
165165
label: 'arms: the with-skill project holds the bundle without its evals/',
166166
run: () => {
167-
const d = prepareArmWorkdir('with-skill', 'demo-skill', fixtureRoot, scratch);
167+
const d = prepareArmWorkdir('with-skill', 'demo-skill', fixtureRoot);
168168
const skill = join(d.cwd, '.claude', 'skills', 'demo-skill');
169169
const ok = existsSync(join(skill, 'SKILL.md')) && existsSync(join(skill, 'rules', 'filters.md')) && !existsSync(join(skill, 'evals'));
170170
rmSync(d.root, { recursive: true, force: true });
@@ -174,7 +174,7 @@ export function runSelfTest(deps: SelfTestDeps): SelfTestResult {
174174
{
175175
label: 'arms: the no-skill project holds no skill',
176176
run: () => {
177-
const d = prepareArmWorkdir('no-skill', 'demo-skill', fixtureRoot, scratch);
177+
const d = prepareArmWorkdir('no-skill', 'demo-skill', fixtureRoot);
178178
const ok = !existsSync(join(d.cwd, '.claude'));
179179
rmSync(d.root, { recursive: true, force: true });
180180
return ok ? true : 'the no-skill project has a .claude/ directory';

‎packages/qa/scenarios/test/skill-evals/skill-evals.test.ts‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,19 @@ describe('the arms: one fresh directory per turn, differing only in the bundle',
173173

174174
it('with-skill holds the bundle without evals/; no-skill holds nothing; the MCP config is empty and outside the project', () => {
175175
const root = writeCatalog();
176-
const w = prepareArmWorkdir('with-skill', 'alpha-skill', root, scratch);
177-
expect(readdirSync(join(w.cwd, '.claude', 'skills'))).toEqual(['alpha-skill']);
178-
expect(readdirSync(join(w.cwd, '.claude', 'skills', 'alpha-skill')).sort()).toEqual(['SKILL.md', 'rules']);
179-
expect(JSON.parse(readFileSync(w.mcpConfigPath, 'utf8'))).toEqual({ mcpServers: {} });
180-
expect(w.mcpConfigPath.startsWith(w.cwd)).toBe(false);
181-
const n = prepareArmWorkdir('no-skill', 'alpha-skill', root, scratch);
182-
expect(readdirSync(n.cwd)).toEqual([]);
176+
const w = prepareArmWorkdir('with-skill', 'alpha-skill', root);
177+
const n = prepareArmWorkdir('no-skill', 'alpha-skill', root);
178+
try {
179+
expect(w.root.startsWith(join(tmpdir(), 'skill-eval-'))).toBe(true);
180+
expect(readdirSync(join(w.cwd, '.claude', 'skills'))).toEqual(['alpha-skill']);
181+
expect(readdirSync(join(w.cwd, '.claude', 'skills', 'alpha-skill')).sort()).toEqual(['SKILL.md', 'rules']);
182+
expect(JSON.parse(readFileSync(w.mcpConfigPath, 'utf8'))).toEqual({ mcpServers: {} });
183+
expect(w.mcpConfigPath.startsWith(w.cwd)).toBe(false);
184+
expect(readdirSync(n.cwd)).toEqual([]);
185+
} finally {
186+
rmSync(w.root, { recursive: true, force: true });
187+
rmSync(n.root, { recursive: true, force: true });
188+
}
183189
});
184190

185191
it('a round hands each turn its arm\'s directory, the prompt on stdin and an environment with no API key or effort override; records land and directories go', async () => {

0 commit comments

Comments
 (0)