No test runs the Temporal activity or the boot step that keep webhook event partitions ahead of need #265

Open
opened 2026-10-24 06:52:46 +00:00 by cgalo5758 · 0 comments
Owner

What a contributor runs into

core.webhook_events is partitioned by month, and the webhook endpoints cannot record an event whose month has no partition. Two call sites keep the partitions ahead of need:

  • the boot step in ensureBootDataState (cmd/bootstate.go), which calls db.EnsureWebhookEventPartitions on every start and seed-demo and only logs a warning when it fails;
  • EnsureWebhookPartitionsActivity (internal/workflows/maintenance/activities.go), which the daily webhook-partition-ensure schedule runs through EnsureWebhookPartitionsWorkflow.

The tests in internal/db/partitions_test.go call db.EnsureWebhookEventPartitions and the function core.ensure_webhook_event_partitions directly. No test runs the activity, the workflow, the schedule's setup or ensureBootDataState, and internal/workflows/maintenance has no test file.

Why it costs

A change that breaks either call site passes make test: the activity or the boot step handed the wrong pool, the wrong window or a time other than now, or the activity's error dropped. The boot step's failure is a log line and the activity's is a failed workflow in the Temporal UI, so the break shows only when a month arrives with no partition and the webhook endpoints cannot record that month's events.

Where

internal/workflows/maintenance/activities.go, cmd/bootstate.go

Done when

  • A test runs EnsureWebhookPartitionsActivity against the test database as the runtime role and finds the partitions for the current month through db.DefaultWebhookPartitionMonthsAhead months ahead.
  • A test runs ensureBootDataState and finds the same partitions.
  • Each test fails when its call site no longer creates them.
### What a contributor runs into `core.webhook_events` is partitioned by month, and the webhook endpoints cannot record an event whose month has no partition. Two call sites keep the partitions ahead of need: - the boot step in `ensureBootDataState` (`cmd/bootstate.go`), which calls `db.EnsureWebhookEventPartitions` on every `start` and `seed-demo` and only logs a warning when it fails; - `EnsureWebhookPartitionsActivity` (`internal/workflows/maintenance/activities.go`), which the daily `webhook-partition-ensure` schedule runs through `EnsureWebhookPartitionsWorkflow`. The tests in `internal/db/partitions_test.go` call `db.EnsureWebhookEventPartitions` and the function `core.ensure_webhook_event_partitions` directly. No test runs the activity, the workflow, the schedule's setup or `ensureBootDataState`, and `internal/workflows/maintenance` has no test file. ### Why it costs A change that breaks either call site passes `make test`: the activity or the boot step handed the wrong pool, the wrong window or a time other than now, or the activity's error dropped. The boot step's failure is a log line and the activity's is a failed workflow in the Temporal UI, so the break shows only when a month arrives with no partition and the webhook endpoints cannot record that month's events. ### Where `internal/workflows/maintenance/activities.go`, `cmd/bootstate.go` ### Done when - A test runs `EnsureWebhookPartitionsActivity` against the test database as the runtime role and finds the partitions for the current month through `db.DefaultWebhookPartitionMonthsAhead` months ahead. - A test runs `ensureBootDataState` and finds the same partitions. - Each test fails when its call site no longer creates them.
cgalo5758 added the
kind
debt
area/opsarea/testing
labels 2026-10-24 06:52:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#265