Commit Graph

10 Commits

Author SHA1 Message Date
Your Name
135718836e fix(e2e,store,delivery): fix E2E stability - lifecycle ordering, event ordering, callback_target NOT NULL, worker ticker loop 2026-05-11 14:08:19 +08:00
Your Name
34b175b130 feat(outbox): implement concurrent claim mechanism with UPDATE RETURNING + SKIP LOCKED
- Add migration 0004 to introduce 'claiming' status and timeout index
- Add StatusClaiming to platformevent domain and allow it in Validate()
- Rewrite ListDue as transactional UPDATE ... RETURNING with FOR UPDATE SKIP LOCKED
- Add ReleaseStaleClaims to reset expired claiming events back to retrying
- Worker Start() now runs a 30s ticker for stale claim recovery (5m timeout)
- Update stubEventStore in tests to satisfy new EventStore interface

Refs: D-02
2026-05-11 13:16:28 +08:00
Your Name
22384d155b refactor(platformevent): remove CallbackTarget field and all usages
D-01: callback_target contract drift cleanup.

- Remove CallbackTarget from Event struct and Validate
- Remove CallbackTarget from PlatformInboundMeta
- Remove defaultCallbackTarget and assignment from builder
- Remove callback_target column from INSERT/SELECT/dead_letter SQL
- Clean up all test literals and assertions

DB migration left untouched; column remains empty until a future schema
cleanup migration.
2026-05-11 13:09:50 +08:00
Your Name
858a64880a test: skip postgres store tests when PostgreSQL is unavailable 2026-05-11 12:46:06 +08:00
Your Name
5beb002d2f fix: platform event store and builder drift 2026-05-11 12:19:20 +08:00
Your Name
cbbb553e9f feat(adapter): add sub2api platform adapter stack 2026-05-06 10:45:51 +08:00
Your Name
6c3474e23b feat(ai-customer-service): add gate readiness verification and handoff docs 2026-05-06 09:39:33 +08:00
Your Name
087de4e102 fix(audit): use uuid.New() for ticket workflow audit IDs
Fixes 'invalid input syntax for type uuid' error when writing ticket
workflow audit logs. The audit Event.ID field was using fmt.Sprintf
with nanoseconds ('wf-%d') which doesn't match PostgreSQL's uuid type.

Also adds uuid import to ticket_workflow.go.

Verified: full chain webhook→assign→resolve→close produces 3 audit
logs correctly, no more 'invalid uuid' errors in logs.
2026-05-04 13:44:39 +08:00
Your Name
cf46b27610 fix: P0-1 RateLimiter并发写安全 + P0-2工单操作错误码区分 + P1 rows.Close修复
P0-1 (limits.go): Allow()方法改为全程使用写锁保护counters map读写,避免RLock写入时的data race
P0-2 (ticket_workflow.go+ticket_handler.go): Assign/Resolve/Close操作先查询ticket存在性和状态,返回明确的CS_TICKET_4001/CS_TKT_4002/CS_TICKET_4092/CS_TICKET_4093错误码,handler根据错误前缀路由HTTP状态码
P1-1 (ticket_store.go): 移除GetStats中3处手动rows.Close(),只保留defer Close()
2026-05-01 20:56:25 +08:00
Your Name
4123cd9e1c test(P0-2): 补齐 postgres store ticket workflow 测试
新增 internal/store/postgres/ticket_workflow_test.go(8 个测试):
- TestTicketWorkflowStore_ListOpen: 开放工单查询
- TestTicketWorkflowStore_Assign: 工单分配(正常+已分配冲突)
- TestTicketWorkflowStore_Resolve: 工单解决
- TestTicketWorkflowStore_Close: 工单关闭(正常+非resolved错误)
- TestTicketWorkflowStore_NilDB: nil db 错误处理(4 个子测试)

**覆盖率提升**:
- internal/store/postgres: 43.1% → **62.0%** (+18.9%)
- 整体覆盖率: 66.2% → **71.3%** (+5.1%)

 Phase 2 目标 >70% 已达成

Ref: test/PHASE2_TEST_PLAN.md P0-2
2026-05-01 09:38:52 +08:00