Skip to content

fix: persist webhook attempt identity and stable operation keys - #772

Merged
0xNgoo merged 6 commits into
Anchor-kit:mainfrom
Bigtura:feat/issue-698-persist-webhook-execution-attempts-and-stable
Oct 23, 2026
Merged

0xNgoo merged 6 commits into
Anchor-kit:mainfrom
Bigtura:feat/issue-698-persist-webhook-execution-attempts-and-stable

Conversation

@Bigtura

@Bigtura Bigtura commented Oct 21, 2026

Copy link
Copy Markdown

Overview

This PR persists webhook execution attempt identity, a processing lease, and a stable operation key so that timed-out callbacks can be traced, claimed, and safely retried without repeating financial side effects. It adds the required fields through the existing versioned migration path, exposes them on the typed callback context, and wires them through the default webhook processor.

Related Issue

Changes

🔁 Webhook Attempt Identity & Operation Keys

  • [MODIFY] src/runtime/interfaces.ts

    • Extends the typed callback context with attempt identity, processing lease, and stable operation key fields.
    • Adds the corresponding typed shapes used by the processor and adapter.
  • [MODIFY] src/runtime/database/sql-database-adapter.ts

    • Adds the versioned migration for the new attempt/lease/operation-key columns.
    • Persists and reads back the new fields so attempts can be claimed and traced.
  • [MODIFY] src/runtime/webhooks/default-webhook-processor.ts

    • Generates and reuses a stable operation key across retries.
    • Claims an attempt with a processing lease before executing side effects, so an old callback cannot be confused with a new execution owner.
    • Records attempt identity on the callback context for tracing.
  • [MODIFY] tests/runtime/webhooks/default-webhook-processor.test.ts

    • Focused assertions covering attempt tracing, lease claiming, and operation-key reuse across retries.

Verification Results

npm test -- tests/runtime/webhooks/default-webhook-processor.test.ts
✅ focused webhook processor assertions passed
Acceptance Criteria Status
Each attempt can be traced and claimed ✅ Attempt identity + processing lease persisted and asserted in focused test
Retries reuse the operation key and cannot confuse an old callback with a new execution owner ✅ Stable operation key reused across retries; lease claim guards ownership
PR includes a reproducible focused check with command and expected result ✅ Command and expected result documented above

Closes #698

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@Bigtura Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Bigtura
Bigtura force-pushed the feat/issue-698-persist-webhook-execution-attempts-and-stable branch from 56799b2 to 54b4a40 Compare October 22, 2026 00:17
Strips the payload this branch picked up (deleted api.js, truncated eslint.config.mjs, unhooked package.json). No functional change to the branch's own work.
@0xNgoo

0xNgoo commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Correction: I verified maintainer edits are enabled for this PR. I’ll trigger the required checks on the existing branch as 0xNgoo, preserving your PR and issue attribution. Please disregard my request for you to push an update.

…t-webhook-execution-attempts-and-stable

# Conflicts:
#	src/runtime/database/sql-database-adapter.ts
#	src/runtime/webhooks/default-webhook-processor.ts
#	tests/runtime/webhooks/default-webhook-processor.test.ts
@0xNgoo
0xNgoo merged commit 152e7e3 into Anchor-kit:main Oct 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist webhook execution attempts and stable operation identities

2 participants