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.
This commit is contained in:
Your Name
2026-05-11 13:09:50 +08:00
parent dbbf2a52de
commit 22384d155b
8 changed files with 64 additions and 96 deletions

View File

@@ -68,12 +68,11 @@ func TestWorker_ShouldDeliverPendingEventToCallbackServer(t *testing.T) {
now := time.Now().UTC().Truncate(time.Second)
store := &stubEventStore{
events: []platformevent.Event{{
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
CallbackTarget: "default",
Payload: map[string]any{"reply": "好的"},
Status: platformevent.StatusPending,
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
Payload: map[string]any{"reply": "好的"},
Status: platformevent.StatusPending,
NextAttemptAt: now,
OccurredAt: now,
CreatedAt: now,
@@ -113,12 +112,11 @@ func TestWorker_ShouldRetryWhenCallbackReturns5xx(t *testing.T) {
now := time.Now().UTC().Truncate(time.Second)
store := &stubEventStore{
events: []platformevent.Event{{
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
CallbackTarget: "default",
Payload: map[string]any{"reply": "好的"},
Status: platformevent.StatusPending,
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
Payload: map[string]any{"reply": "好的"},
Status: platformevent.StatusPending,
NextAttemptAt: now,
OccurredAt: now,
CreatedAt: now,
@@ -152,12 +150,11 @@ func TestWorker_ShouldMoveEventToDeadLetterAfterMaxRetries(t *testing.T) {
now := time.Now().UTC().Truncate(time.Second)
store := &stubEventStore{
events: []platformevent.Event{{
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
CallbackTarget: "default",
Payload: map[string]any{"reply": "失败"},
Status: platformevent.StatusRetrying,
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
Payload: map[string]any{"reply": "失败"},
Status: platformevent.StatusRetrying,
AttemptCount: 1,
NextAttemptAt: now,
OccurredAt: now,
@@ -185,12 +182,11 @@ func TestWorker_ShouldPersistDeliveryAttemptAudit(t *testing.T) {
now := time.Now().UTC().Truncate(time.Second)
store := &stubEventStore{
events: []platformevent.Event{{
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
CallbackTarget: "default",
Payload: map[string]any{"reply": "失败"},
Status: platformevent.StatusPending,
ID: "evt-1",
Platform: "sub2api",
EventType: platformevent.TypeReplyGenerated,
Payload: map[string]any{"reply": "失败"},
Status: platformevent.StatusPending,
NextAttemptAt: now,
OccurredAt: now,
CreatedAt: now,