huanghuoguoguo
70ec75f9a2
feat(test): Phase 1.5 coverage expansion - COV-001 to COV-013
...
Coverage baseline raised from 13.65% to 26% (+12.35%)
Gate raised from 12% to 18%
Tasks completed:
- COV-001: Command system unit tests (100% coverage)
- COV-002: API service unit tests batch 1 (user/apikey/model/provider)
- COV-003: Provider model manager unit tests
- COV-004: Pipeline remaining stage tests (aggregator/cntfilter/longtext/msgtrun)
- COV-005: Storage and utils coverage pass
- COV-006: Gate ratchet 12%→15%
- COV-007: Gate ratchet 15%→18%
- COV-008: API service batch 2 (bot/pipeline/webhook/space/maintenance/mcp)
- COV-009: Blocked - API controller circular import issue documented
- COV-010: Plugin runtime unit tests (+0.08%)
- COV-011: RAG and vector unit tests (+0.68%)
- COV-012: Core boot and migration unit tests
- COV-013: Provider requester logic unit tests (+0.62%)
Key additions:
- tests/utils/import_isolation.py: sys.modules isolation for circular imports
- Provider requester mock tests: proved HTTP-dependent code can be tested locally
- Vector filter utilities: 100% coverage on pure functions
- API services: fake persistence pattern for unit testing
Blocked issue COV-009 documented in langbot-test-plan/1.5/issues/
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 10:12:48 +08:00
huanghuoguoguo
59871c3118
refactor(test): consolidate FakeApp and add sys.modules isolation utility
...
- Extract tests/utils/import_isolation.py with isolated_sys_modules context manager
- Extend tests/factories/app.py FakeApp with handler-specific attributes
- Refactor test_chat_handler.py to use centralized FakeApp and cached imports
- Refactor test_command_handler.py with mock_execute_factory fixture
- Refactor test_smoke.py to move import-time sys.modules manipulation into fixture
- Add SQLite migration integration tests (G-002)
- Add HTTP API smoke integration tests (G-005)
- Update CI workflow to call pytest for SQLite migrations (G-004)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 10:12:48 +08:00
huanghuoguoguo
66a0a7c9c8
fix(test): make test-quick reliable as developer gate
...
Fixes for D-001验收问题:
1. test-quick.sh: use set -euo pipefail, uv run ruff, no tail pipe
2. Remove unused imports in factories (app.py, platform.py, provider.py)
3. Fix unused variable in smoke test
4. Add noqa: E402 to test_n8nsvapi.py lazy imports
5. Update smoke test docs: "minimal fake flow" not full pipeline
Now test-quick is a reliable gate: lint failures exit 1, test failures propagate.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 10:12:48 +08:00
huanghuoguoguo
d38e3d9181
feat(test): add comprehensive message/query factories
...
Extend tests/factories/message.py with:
- file_query: file attachment query
- unsupported_query: unknown message segment
- voice_query: audio/voice query
- at_all_query: group @All mention
- query_with_session: query with session object
- query_with_config: query with custom pipeline config
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 10:12:48 +08:00
huanghuoguoguo
77be87ed40
feat(test): add fake platform factory
...
Add tests/factories/platform.py with:
- FakePlatform: simulated platform adapter
- Inbound message construction: friend/group/image
- Mention-bot flag simulation
- Outbound message capture for assertions
- Streaming output support simulation
- Send failure simulation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 10:12:48 +08:00
huanghuoguoguo
27227aa31f
feat(test): add fake provider factory
...
Add tests/factories/provider.py with:
- FakeProvider: deterministic fake LLM provider
- Error simulation: timeout, auth, rate-limit, malformed
- Request capture for assertions
- fake_model: mock model with attached provider
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 10:12:48 +08:00
huanghuoguoguo
1af2cb5bc2
feat(test): add shared test factories package
...
Create tests/factories/ with reusable test factories:
- FakeApp: mock application with all dependencies
- Message chains: text_chain, mention_chain, image_chain
- Query factories: text_query, group_text_query, command_query, etc.
No test changes - maintains backward compatibility.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 10:12:48 +08:00