fix(review): 对齐 round3-F 改动的测试和边界规则

- tool-stubs.test.ts: 旧 cpp.cmake.configure/static.cppcheck/clangd.query
  名字已删,改为验证 CppToolRegistrar 独立注册
- release-critical-gates.test.ts: cpp.detect 不再由 BuiltInToolRegistrar
  注册,从 built-in envelope 测试移除
- .dependency-cruiser.js: 允许 runtime → toolchain-cpp (capability
  registration boundary, INV-4 compliant)

e2e: 14/14 gates passed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
AirCoding
2026-06-09 17:53:29 +08:00
parent 0de71e7a1c
commit 8476d5c96f
3 changed files with 32 additions and 18 deletions

View File

@@ -25,7 +25,6 @@ describe('Release critical gates', () => {
for (const [name, args] of [
['fs.stat', { path: 'sample.txt' }],
['project.scan', { root: '.' }],
['cpp.detect', { project_root: projectRoot }],
['doctor.run', { scope: 'all' }],
] as Array<[string, Record<string, unknown>]>) {
const result = await registry.call({ call_id: `call-${name}`, name, arguments: args }, ctx)

View File

@@ -1,7 +1,7 @@
/**
* C7 regression: All 28 MVP tools registered
* Validates that BuiltInToolRegistrar registers all 28 tool-registry-v1 MVP tools
* plus extra built-in tools, with stub executors for Alpha-scope tools.
* C7 regression: All MVP tools registered
* Validates that BuiltInToolRegistrar registers built-in tools (non-cpp)
* and that CppToolRegistrar registers cpp.* tools separately.
*
* Tests actual ToolRegistry state rather than source text inspection.
*/
@@ -15,22 +15,26 @@ const registrar = new BuiltInToolRegistrar(registry)
registrar.register_all('/tmp/test-air')
const tools = registry.list()
// 28 MVP tools from tool-registry-v1 §11
const MVP_TOOLS = [
// Built-in tools (non-cpp, registered by BuiltInToolRegistrar)
const BUILTIN_TOOLS = [
'fs.list', 'fs.read', 'fs.write', 'fs.edit', 'fs.patch', 'fs.stat',
'shell.run', 'process.kill',
'git.status', 'git.diff', 'git.worktree.create', 'git.merge_workspace',
'project.scan', 'project.profile.write',
'cpp.detect', 'cpp.cmake.configure', 'cpp.build', 'cpp.test',
'cpp.static.cppcheck', 'cpp.clangd.query',
'debug.run', 'debug.parse_logs',
'gui.screenshot', 'network.capture',
'artifact.create', 'context.assemble',
'permission.request', 'doctor.run',
]
// cpp tools registered by CppToolRegistrar (tested via RuntimeApp integration)
const CPP_TOOLS = [
'cpp.detect', 'cpp.configure', 'cpp.build', 'cpp.test',
'cpp.cppcheck', 'cpp.clangd',
]
describe('C7: MVP tool registrations', () => {
for (const tool_name of MVP_TOOLS) {
for (const tool_name of BUILTIN_TOOLS) {
it(`registers ${tool_name}`, () => {
const found = tools.find(t => t.name === tool_name)
expect(found).toBeDefined()
@@ -38,19 +42,30 @@ describe('C7: MVP tool registrations', () => {
})
}
it('has at least 28 tools registered', () => {
expect(tools.length).toBeGreaterThanOrEqual(28)
it('has at least 22 built-in tools registered', () => {
expect(tools.length).toBeGreaterThanOrEqual(22)
})
it('stub tools produce text envelope with alpha_stub metadata', async () => {
// Pick a stub tool and verify its executor returns structured envelope
const stub_names = ['process.kill', 'cpp.clangd.query', 'gui.screenshot', 'network.capture']
it('stub tools produce structured envelope', async () => {
const stub_names = ['process.kill', 'gui.screenshot', 'network.capture']
for (const name of stub_names) {
const tool = tools.find(t => t.name === name)
expect(tool).toBeDefined()
}
})
it('cpp tools registered via CppToolRegistrar (not BuiltInToolRegistrar)', async () => {
const { CppToolRegistrar } = await import('@aircoding/toolchain-cpp')
const cppRegistry = new ToolRegistry('/tmp/test-air-cpp')
const cppRegistrar = new CppToolRegistrar()
cppRegistrar.register(cppRegistry, '/tmp/test-air-cpp')
const cppTools = cppRegistry.list()
for (const name of CPP_TOOLS) {
const found = cppTools.find((t: any) => t.name === name)
expect(found).toBeDefined()
}
})
it('create_stub_definitions and create_real_executor exist', () => {
expect(typeof (BuiltInToolRegistrar.prototype as any).create_stub_definitions).toBe('function')
expect(typeof (BuiltInToolRegistrar.prototype as any).create_real_executor).toBe('function')