Skip to content

test: raise coverage from 58% to 85% (+359 tests)#5

Open
Alphabaijinde wants to merge 21 commits into
mainfrom
codex-merge-feat-test-coverage-phase1-pr
Open

test: raise coverage from 58% to 85% (+359 tests)#5
Alphabaijinde wants to merge 21 commits into
mainfrom
codex-merge-feat-test-coverage-phase1-pr

Conversation

@Alphabaijinde

Copy link
Copy Markdown
Collaborator

This PR merges the current feat/test-coverage-phase1 work onto latest main in a clean merge branch.\n\nIncludes:\n- Test coverage expansion and related test infrastructure\n- CI compatibility fixes for Node 18/20 pipeline\n- CLI/performance gate fixes validated in recent CI runs\n\nValidation:\n- Latest CI on feat/test-coverage-phase1 passed before this merge PR\n- Branch is merged from origin/main with no conflicts

白晋德 and others added 21 commits January 14, 2026 08:02
Implements ADR-ARCH-004 Boundary-Driven Architecture with comprehensive
security hardening based on Claude + Codex collaborative review.

Core Components:
- CircuitBreaker: State machine (closed→open→half-open) for system stability
- ToolValidator: Path traversal, injection, and spec protection checks
- ContractLoader: Agent permission contracts from YAML
- BoundaryGuard: Main security controller coordinating all checks

Security Hardening (from Codex review):
- Add deepFreeze() for nested object freezing with circular ref handling
- Add hasSecurityConcerningProperties() to detect getters/toJSON bypass
- Add executeWithGuardSafe() API for TOCTOU-resistant execution
- Extend prototype chain getter detection
- Fail-closed for non-serializable input

SDK Integration:
- ToolExecutionContext for CLI/SDK environments
- PhaseController circuit breaker integration
- Security event logging and audit trail

Testing:
- 139 tests passing (unit + integration)
- Comprehensive coverage for circuit breaker, validator, guard, contracts

Documentation:
- CLAUDE.md updated with usage examples
- Security review automation via auto-review.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
P0-1 步骤1-2完成: 测试框架创建
- 创建可复用Mock工具库 (command-test-utils.ts, 306行)
- 创建4个测试脚手架 (74个用例框架):
  * workflow.test.ts (18测试): Phase-driven, Traditional, Output formatting
  * phase.test.ts (16测试): Phase transition, Gate validation
  * specify.test.ts (19测试): Interactive/Non-interactive, Spec generation
  * analyze.test.ts (20测试): Agent-based analysis, Python bridge
- 记录覆盖率基线 (39.13% statements, 26.27% branches)
- 生成接力文档: docs/handoff/20260210-test-coverage-phase1-progress.md
- 保存经验到CLAUDE.md: 测试覆盖率提升最佳实践

下一步: P0-1步骤4 - Codex评审测试框架和Mock工具

参考: .claude/plans/linked-cuddling-wozniak.md

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
P2 test coverage improvement targeting low-coverage core modules:
- Workflow (base, manager): 65 tests, 0%→80%+
- LLM clients (claude, openai): 54 tests, 17-30%→80%+
- Project status + Prompt engine: 50 tests, 7-27%→80%+
- Plugin system (base, manager): 66 tests, 39-46%→80%+
- Change manager: 34 tests, 5%→80%+
- Markdown merger: 7 tests, 1%→92%

Results: 1273/1273 tests passing, 85.58% statements, 70.39% branches
- Add tests for core workflow, LLM clients, project status, prompt engine,
  plugin system, change manager, and markdown merger
- Add tests for all commands (agents, bmm, config, deploy, export, etc.)
- Add tests for boundary modules, spec, verification, and plugins
- Fix source code bugs discovered during testing
- Add shared test utilities and mock factories
- Include docs, ADRs, architecture docs, and handoff documents
- Add UI remotion intro video and voiceover assets
- Add pnpm workspace config and boundary schemas

Coverage: 58.21% → 85.58% statements, 914 → 1273 tests, 80 test suites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant