Commit Graph
11 Commits
Author SHA1 Message Date
Claude e065b6d22f feat(integration-tests): add integration test suite for real agent sessions
Add a new integration test suite that verifies real agent (Claude Code, Codex,
Cursor, Gemini, OpenCode) interactions with a mock platform. Tests are gated
by //go:build integration tag so they're excluded from normal CI.

core/engine.go:
- Add public ReceiveMessage(p, msg) method to allow test callers to
  inject messages into the engine

tests/integration/agent_integration_test.go:
- mockPlatform implementing core.Platform interface for test verification
- agentPool for reusing agent instances across tests
- Session tests: new session, /list, /switch, /stop, /new context clear, /history
- Agent tests: claude code, codex, cursor, gemini (skip if quota), opencode (skip if no gitlab auth)
- Command tests: /shell (skip if admin_from not set), /provider list
- i18n: /lang zh language switch
- Concurrency: session isolation, long text chunking, empty message handling

docs/plans/2026-03-24-integration-tests.md:
- Test plan listing all implemented and planned integration test cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 15:56:18 +08:00
xxb ac34d94f05 feat(core): add shared workspace routing infrastructure
* feat(core): implement shared workspace routing and binding fallback

* fix(core): allow shared workspace commands for users

* fix(core): scope workspace bindings by platform
2026-03-24 08:03:18 +08:00
Claude b9af7ea7ba fix: handle errors and add error logging throughout codebase
The changes add error handling for previously ignored operations and introduce logging for critical errors and warnings. This includes:
- Adding error checks for file operations, JSON unmarshaling, system calls
- Logging warnings/errors for failed operations using slog
- Properly handling return values from functions that were previously ignored
- Adding context to error messages for better debugging
- Cleaning up unused code and variables

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-20 00:31:00 +08:00
Claude c4ebe6c39f ci: update golangci-lint install path and improve test mocks thread safety
Updated the GitHub CI workflow to use the correct golangci-lint installation path. Enhanced test mocks with proper mutex protection in TestMessageHandler and cleaned up FakeAgentSession implementation for better thread safety and performance.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-19 11:34:14 +08:00
Claude 47fef72b48 fix(tests): fix bugs in fake implementations
- session.go: Events() now correctly checks if last event
  already has Done=true before appending an extra Done event
- message.go: TestLongMessage now uses strings.Repeat instead
  of null bytes
- message.go: BatchTestMessages now uses fmt.Sprintf
  instead of rune overflow-prone string concatenation
- response.go: TestAgentSessionInfoList now uses fmt.Sprintf

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 11:17:27 +08:00
Claude 35f33429a1 feat(tests): add platform regression tests and cron cancel test
Add:
- T-241: Discord embed format regression test
- T-242: Telegram command parsing regression test
- T-243: DingTalk crypto/regression test
- T-252: Cron job cancellation regression test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 11:00:48 +08:00
Claude 417be88a4f feat(tests): add missing smoke and regression test cases
Add:
- T-111: Markdown rendering smoke test (TestSmoke_MarkdownRender)
- T-112: Webhook callback smoke test (TestSmoke_WebhookCallback)
- T-221: Error message formatting regression test (TestRegression_ErrorFormatting)
- T-234: Session persistence regression test (TestRegression_SessionPersistence)
- T-235: Multi-workspace isolation regression test (TestRegression_WorkspaceIsolation)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:57:56 +08:00
Claude db05dee804 feat(tests): add integration, performance tests and CI improvements
- Add 13 integration tests (T-300~T-313) covering engine-platform
  message flow, multi-agent coordination, session persistence,
  rate limiting, dedup, command registry, role manager, platform
  reply, agent permission flow, cron store, card rendering, env
  merge, and message attachments
- Add 14 performance benchmarks (T-400~T-413) for message latency,
  concurrent throughput, session switching, rate limiting,
  deduplication, command lookup, card rendering, cron store,
  role resolution, and multi-agent coordination
- Fix FakeAgentSession so NewFakeAgentWithSession properly
  preserves pre-configured session for first StartSession call
- Add performance-test Makefile target and update test-release
- Update CI to run performance benchmarks on release events

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:49:15 +08:00
Claude 7671660252 feat(tests): add P0 regression tests
Add regression tests for critical functionality paths:

Message Pipeline (R-200~R-205):
- TestRegression_FullMessagePipeline: end-to-end message flow
- TestRegression_ConcurrentAgents: multi-agent concurrency
- TestRegression_AgentTimeout: timeout and graceful shutdown
- TestRegression_AgentGracefulShutdown: clean session termination
- TestRegression_StreamingResponse: streaming event handling

Permission/Security (R-210~R-214):
- TestRegression_PermissionYOLO: auto-approve mode
- TestRegression_PermissionDefault: role-based access
- TestRegression_SecretRedaction: sensitive data masking (table-driven)
- TestRegression_TokenRedaction: token replacement
- TestRegression_CommandInjection: allowlist validation
- TestRegression_RateLimit: rate limiting per user

Additional Regression Tests:
- TestRegression_SessionCRUD: session create/switch/close
- TestRegression_SessionHistory: history retrieval
- TestRegression_FeishuCardRender: card rendering and text fallback
- TestRegression_CardButtons: button collection
- TestRegression_CronParse: cron job parsing
- TestRegression_CronJobLifecycle: add/enable/disable/remove
- TestRegression_ConfigReload: hot config reload
- TestRegression_AtomicWrite: atomic file write
- TestRegression_Deduplication: message deduplication
- TestRegression_DeduplicationTTL: deduplication time window

Total: 26 regression tests (build tag: regression)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:38:19 +08:00
Claude 0c84f83130 feat(tests): add P0 smoke tests
Add smoke tests for core functionality:
- TestSmoke_ConfigLoading: config file loading and parsing
- TestSmoke_ConfigLoadingInvalid: invalid config rejection
- TestSmoke_AllAgentsInit: agent factory registration
- TestSmoke_AllPlatformsInit: platform factory registration
- TestSmoke_SessionManagement: session create/switch/close
- TestSmoke_SessionMessageFlow: session message flow with events
- TestSmoke_CommandParsing: command registry and resolution
- TestSmoke_CommandRegistryList: command listing and clearing
- TestSmoke_MessageFlow: platform-agent message bridging
- TestSmoke_PlatformReply: platform reply functionality
- TestSmoke_EventTypes: all event types creation
- TestSmoke_WorkspaceSwitch: workspace isolation
- TestSmoke_RateLimiter: rate limiting functionality

Fix buffer size bug in fake session Events() channel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:31:33 +08:00
Claude ee985bf026 feat(tests): add testing infrastructure foundation
- Add testify and httpmock dependencies for testing
- Create tests/ directory structure with mocks and fakes
- Add mock_platform.go: mock for core.Platform interface
- Add mock_agent.go: mock for core.Agent/AgentSession interfaces
- Add fake/message.go: test message and event fixtures
- Add fake/session.go: fake agent session implementation
- Add fake/response.go: test helpers and fixtures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:18:30 +08:00