Skip to content

Commit 714dda8

Browse files
test(lint): pin delete_package as an accepted platform tool name (#31219)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XKAC5tQPZVb9LXtmg8KGQm9)_ Fixes #31040 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`packages/lint/src/validate-ai-tool-references.test.ts` 新增一条用例(+18 行,仅测试):技能里写 `delete_package` 不被报为虚构工具;写近似名 `delete_packages` 仍被报出。 - 为什么改:#31037 把 `delete_package` 加进平台工具名单时没补这条固定用例(其合约复审 6693733275 的 should-fix);以往每次加名字都配一条(#16512、#27002、记录写入那对)。 - 风险与回滚:只加测试,不改名单也不改规则,`@objectstack/lint` 发布的 `files[]` 只含 `dist`/README/CHANGELOG,不发布任何东西;回滚即还原本 PR。 - 先看:`packages/lint/src/validate-ai-tool-references.test.ts` 新用例「resolves the service-ai-studio package removal」(紧随记录写入那对之后)。 - 两分钟验证:`pnpm --filter @objectstack/lint exec vitest run src/validate-ai-tool-references.test.ts`,预期 23 条全绿;从 spec 名单删掉 `delete_package` 并重建 spec,预期恰好这一条变红。 - 需要你做的:无,席位落地。 ## What changes One test case in `packages/lint/src/validate-ai-tool-references.test.ts`, placed after the record-write pair and shaped like the #16512 / #27002 pins: - a skill naming `delete_package` resolves (no findings); - the near-name control `delete_packages`, registered by nobody, is still reported: exactly one finding, at `skills[0].tools[1]`, naming `delete_packages`. Without the control the pin could not fail on a universe widened until everything resolves. No change to the registry (`packages/spec/src/system/constants/platform-tool-names.ts`) or to the rule. ## Tests - New file run on `ce48acb1`: Test Files 1 passed, Tests 23 passed (23). - Whole package, `pnpm --filter @objectstack/lint test`: Test Files 197 passed (197), Tests 8338 passed, 5 skipped; VERDICT command-exit 0. - `pnpm --filter @objectstack/lint typecheck` (`tsc --noEmit && check:test-typecheck`): VERDICT command-exit 0, test layer held at its 2 pinned debt signatures (unchanged). <details><summary>Ablation: the pin fails when delete_package leaves the registry</summary> The lint suite reads `@objectstack/spec` from `dist/` (no vitest alias), so each leg rebuilt spec and proved the state of `dist/` before reading the run. - **Mutate leg** (`node scripts/ablation-replace.mjs --file packages/spec/src/system/constants/platform-tool-names.ts --anchor " 'delete_package',\n" --delete`): anchor 1 -> 0, blob `66cd0267ea06` -> `1ed8917b09d8`; `pnpm --filter @objectstack/spec build` exit 0; `ablation-dist-preflight.mjs @objectstack/spec '"delete_package",' --absent --source-marker="'delete_package',"`: marker absent from all 594 built files, exit 0. Run: `× resolves the service-ai-studio package removal`, `AssertionError: expected [ { severity: 'warning', …(5) } ] to deeply equal []`; Tests 1 failed, 22 passed (23); exit 1. - **Restore leg**: blob after restore == HEAD (`66cd0267ea06`), `git diff HEAD` empty; spec rebuilt exit 0; preflight (present mode): marker present in 2 built files, tree clean against HEAD, exit 0. Run: Tests 23 passed (23), exit 0. </details> ## Acceptance notes - Card acceptance, "The pin fails if `delete_package` leaves the registry": measured above (red on exactly the new case, every other case green). - `skip-changeset`: `@objectstack/lint` `files[]` is `["dist", "README.md", "CHANGELOG.md"]`; a `*.test.ts` under `src/` ships nothing. ## Verification Gate union derived by `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` (50 families for this diff), run on head `ce48acb1`, reconciled with `--ran`: "50 derived famil(ies) accounted for — 48 run, 2 NOT-MEASURED". - **48 run, exit 0 each** (closure built first: `pnpm --filter '@objectstack/lint^...' build`, VERDICT command-exit 0). `pnpm check:docs-transcript-drift` first answered exit 3 (it reads `packages/lint/dist`, not yet built); after `pnpm --filter @objectstack/lint build` it ran exit 0. - **NOT MEASURED: `pnpm check:dual-build-cjs-loads`**, reason: exit 3 PREREQUISITE NOT MET, it loads every package's built `dist/` and only the lint closure was built. - **NOT MEASURED: `pnpm check:lean-entry-closure`**, reason: exit 3 PREREQUISITE NOT MET, it reads `packages/objectql/dist`, outside the lint closure. CI's `Lint & Repo Gates` runs both on a full build. - `node scripts/check-plugin-teardown-shape.mjs --self-test` needed `git fetch --depth=1 origin 621a487` for its pinned fixture on this shallow clone, then exit 0. - CI families (every required check) are read from this PR's check-runs, not re-run here. `pnpm lint` scoped: the package has no `lint` script, so the root eslint ran on it (`node --stack-size=4000 node_modules/eslint/bin/eslint.js packages/lint --no-inline-config`), exit 0. `skip-changeset`: `@objectstack/lint` `files[]` ships `dist`, `README.md` and `CHANGELOG.md` only; the diff is one `src/*.test.ts`. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5m4G8BbYuRmH2Ts8G4)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2b752f1 commit 714dda8

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎packages/lint/src/validate-ai-tool-references.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,24 @@ describe('validate-ai-tool-references', () => {
245245
expect(control[1].message).toContain('draft_record');
246246
});
247247

248+
/**
249+
* The build agent's package removal (cloud#3656), which only stages the
250+
* removal of a package built in the environment: a skill naming
251+
* `delete_package` resolves; a near name nobody registers does not.
252+
*/
253+
it('resolves the service-ai-studio package removal', () => {
254+
expect(validateAiToolReferences({ skills: [{ name: 's', tools: ['delete_package'] }] })).toEqual([]);
255+
256+
// The control: the plural registered by nobody is still reported, so this
257+
// pin fails on a universe widened too far.
258+
const control = validateAiToolReferences({
259+
skills: [{ name: 's', tools: ['delete_package', 'delete_packages'] }],
260+
});
261+
expect(control).toHaveLength(1);
262+
expect(control[0].path).toBe('skills[0].tools[1]');
263+
expect(control[0].message).toContain('delete_packages');
264+
});
265+
248266
it('reports stable paths and tolerates junk shapes', () => {
249267
const stack = {
250268
skills: [{ name: 's', tools: ['query_records', 'nope_tool'] }],

0 commit comments

Comments
 (0)