Round2 主线:
- A: 事件落库地基 (RuntimeApp EventStore 单例 + 14 repo wiring)
- B: 执行体对齐 (read-before-edit, verification-before-completion)
- C: 界面对齐 (@opentui/solid, 删除 runtime 依赖)
- D: 经验闭环 (ExperienceMiner, DebuggerRole, CompactorRole)
Round2 补充修复:
- fail-on-missing 反作弊门禁
- projection-store-apply.test.ts 补写
- 3个空壳测试转行为 (evidence-store, recovery-impl, knowledge-store)
- ask 项目根支持 AIRCODING_PROJECT_ROOT
- Worker 事件契约修复 (task.attempt.started → checkpoint)
Round3-F: cpp 工具切换
- 删除 BuiltInToolRegistrar cpp.* 闭包
- 接入 toolchain-cpp 真实 CppToolRegistrar
- canonical envelope {status/output/metadata}
- ExecutorRole system prompt 对齐新工具名
Round3-H: Doctor 5 类报告
- toolchain (cmake/ninja/cppcheck/clangd/g++)
- display (X11/Wayland + ImageMagick)
- network (internet connectivity)
- provider (api_key/base_url/model/connectivity)
Secret 脱敏:
- 状态交接.md: sk- → \${OPENAI_API_KEY}
- .gitignore: 添加 .air/ .claude/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
2.4 KiB
TypeScript
Executable File
61 lines
2.4 KiB
TypeScript
Executable File
/**
|
|
* A5+A4 regression: ToolRegistry permission fixes
|
|
* A5: ACTION_BRANCHES was module-level const — `this` was undefined in read_only/sandbox.
|
|
* Fix: moved to instance method execute_branch().
|
|
* A4: build_permission_context passed undefined for task_scope/permission_profile.
|
|
* Fix: passes context.task_scope and context.permission_profile.
|
|
*/
|
|
|
|
import { describe, it, expect } from 'bun:test'
|
|
import { readFileSync } from 'fs'
|
|
import { join } from 'path'
|
|
|
|
describe('A5+A4: ToolRegistry permission fixes', () => {
|
|
const src = readFileSync(
|
|
join(import.meta.dir, '..', '..', 'src', 'tools', 'ToolRegistry.ts'),
|
|
'utf-8'
|
|
)
|
|
|
|
it('does not have module-level ACTION_BRANCHES constant', () => {
|
|
expect(src).not.toMatch(/^const ACTION_BRANCHES/m)
|
|
})
|
|
|
|
it('has execute_branch as instance method', () => {
|
|
expect(src).toMatch(/execute_branch\s*\(/)
|
|
})
|
|
|
|
it('ToolExecutionContext includes task_scope field', () => {
|
|
const ctx_match = src.match(/interface ToolExecutionContext[^}]+}/s)
|
|
expect(ctx_match).not.toBeNull()
|
|
expect(ctx_match![0]).toContain('task_scope')
|
|
})
|
|
|
|
it('ToolExecutionContext includes permission_profile field', () => {
|
|
const ctx_match = src.match(/interface ToolExecutionContext[^}]+}/s)
|
|
expect(ctx_match).not.toBeNull()
|
|
expect(ctx_match![0]).toContain('permission_profile')
|
|
})
|
|
|
|
it('build_permission_context passes context.task_scope instead of undefined', () => {
|
|
const build_match = src.match(/private build_permission_context[^{]+\{[^}]+}/s)
|
|
expect(build_match).not.toBeNull()
|
|
expect(build_match![0]).toContain('context.task_scope')
|
|
expect(build_match![0]).not.toMatch(/task_scope:\s*undefined/)
|
|
})
|
|
|
|
it('build_permission_context passes context.permission_profile instead of undefined', () => {
|
|
const build_match = src.match(/private build_permission_context[^{]+\{[^}]+}/s)
|
|
expect(build_match).not.toBeNull()
|
|
expect(build_match![0]).toContain('context.permission_profile')
|
|
expect(build_match![0]).not.toMatch(/permission_profile:\s*undefined/)
|
|
})
|
|
|
|
it('permission branches preserve original call_id', () => {
|
|
expect(src).toContain('permission.prompt.requested')
|
|
expect(src).toContain('request_ref: { call_id: call.call_id')
|
|
expect(src).toContain("create_error_result(call.call_id, 'permission_denied'")
|
|
expect(src).not.toContain("create_error_result('', 'user_prompt_required'")
|
|
expect(src).not.toContain("create_error_result('', 'permission_denied'")
|
|
})
|
|
})
|