Skip to content

feat: persist permanent webhook delivery failures - #388

Merged
Miracle656 merged 1 commit into
Divinity-Labs:mainfrom
Herikcool:fix/issue-342
Oct 22, 2026
Merged

Miracle656 merged 1 commit into
Divinity-Labs:mainfrom
Herikcool:fix/issue-342

Conversation

@Herikcool

Copy link
Copy Markdown
Contributor

Summary

  • Persist permanent webhook failures with a redacted endpoint origin, payload, attempt count, status/category, and timestamps.
  • Expose recent records through an admin-token protected endpoint and count failures with bounded metric labels.
  • Retain records for 30 days; document that replay is not automatic.

Closes #342

@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@Herikcool 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

@Miracle656

Copy link
Copy Markdown
Collaborator

Needs a rebase — main has moved several times this morning (#379, #382, #380, #392, #401 all landed) and this now conflicts. Push a rebase and I will pick it straight up; nothing is queued ahead of it.

@Miracle656

Copy link
Copy Markdown
Collaborator

Needs a rebase — main has moved a lot today (#306, #309, #252, #256, #355, #381, #390, #402 all landed) and this now conflicts.

Worth knowing before you rebase: #402 replaced every console.* call with a pino logger, so if this PR adds logging, express it as logger.* on a component child rather than console.* — there is a test that fails the build on a stray console call in non-test source.

Push the rebase and I will pick it up; nothing is queued ahead of it.

@Herikcool

Copy link
Copy Markdown
Contributor Author

@Miracle656 The branch has been rebased onto the latest main and the conflicts are resolved. Please review and merge when ready.

@Miracle656
Miracle656 merged commit c5e3180 into Divinity-Labs:main Oct 22, 2026
Miracle656 added a commit that referenced this pull request Oct 22, 2026
  tsc --noEmit   clean
  vitest         91 files, 1052 passing (up from 86 / 962 on main)

  #251  read and scale token decimals from the chain
  #307  standardise empty-result vs not-found status codes
  #318  validate the live service against the published OpenAPI
  #324  content-derived strong ETag and honour conditional requests
  #326  cover vwap and the aggregator
  #388  persist permanent webhook delivery failures

BREAKING, and deliberate: #307 changes routes that returned 404 for "no data"
to 200 with an explicit reason. The rule is now 404 = the resource does not
exist (pair not watched, key not found), 200 + empty = the query matched
nothing. Our dropped-test guard surfaced it as

  - src/__tests__/basket.test.ts :: returns 404 when an asset has no price data

which turned out to be renamed rather than deleted, to
"returns 200 with error and reason when an asset has no price data". That is
the guard working as intended: it made a behaviour change a decision instead
of an accident. Any client branching on 404 for empty results needs updating;
#427 (API versioning) is open and is where this belongs long-term.

Three fixes applied on merge:

  - #388 and #318 each added a console.* call to non-test source, which the
    repo's own logging-hygiene test forbids. Both now use createLogger, which
    is what delivery.ts was already doing two lines above the offending call.
  - #326's test asserted CONFIDENCE_HIGH/MEDIUM_THRESHOLD_SECONDS, which do
    not exist. The constants are real and the values match, but the shipped
    names are HIGH_/MEDIUM_CONFIDENCE_MAX_AGE_SECONDS, from #545. Updated the
    test to the shipped names rather than renaming source to fit a stale test.
  - npx prisma generate, for #388's WebhookDeliveryFailure model.

NOT merged: #384 (periodic WebSocket ping) does not compile -- it reads
config.ws and never adds it to src/config.ts, and it drops a fanout test.
#254 conflicts.

Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
Miracle656 added a commit that referenced this pull request Oct 22, 2026
  tsc --noEmit   clean
  vitest         97 files, 1127 passing (up from 93 / 1068)
  dropped-tests  none

  #325  GET /movers for market gainers and losers
  #327  GET /correlation for basket construction
  #485  net arbitrage spread against fees
  #494  declare the resources capability and expose pages over MCP

Two fixes on merge.

#325 shipped the route file and the OpenAPI entry but never registered it.
The repo's own guard caught it:

  AssertionError: Documented but unregistered: ["GET /movers"]

So the endpoint was documented, generated into clients, and did not exist.
registerMoversRoutes already followed the house signature, so wiring it was an
import and a call next to registerScreenerRoutes. That guard is worth its
weight -- a documented route that 404s is worse than an undocumented one,
because a client is generated against it.

#327 added a console.error to src/routes/correlation.ts, which the logging
hygiene test forbids. Now createLogger, the same change #388 and #318 needed
in the previous batch. Three PRs in two batches have tripped that test, which
suggests the rule is not discoverable enough from the outside -- worth a line
in CONTRIBUTING rather than catching it per-PR.

NOT merged, each failing on its own branch rather than from merge order:
  #460  Phoenix AMM adapter -- 5 failures alone, including its own
        networkVenueConfig and venues/registry tests
  #353  1 tsc error     #354  1 tsc error     #482  4 tsc errors
  #393 #431 #434 #472 conflict

Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
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.

A webhook that fails three times disappears

2 participants