Skip to content

test(api/e2e): retry transient D1 HTTP errors in seed helper#97

Merged
nocoo merged 1 commit into
mainfrom
agent/sde-01/87683609
Jun 10, 2026
Merged

test(api/e2e): retry transient D1 HTTP errors in seed helper#97
nocoo merged 1 commit into
mainfrom
agent/sde-01/87683609

Conversation

@nocoo

@nocoo nocoo commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • retry transient D1 HTTP fetch failures in the API E2E seed helper
  • mirror the production D1 retry window without changing HTTP/D1 semantic errors

Validation

  • SDE-01: pre-commit hooks passed locally
  • Reviewer-01: git diff --check HEAD^ HEAD; bun x eslint tests/api/helpers/seed.ts --max-warnings=0; bun run typecheck; bun x vitest run tests/unit/d1-client.test.ts
  • Local L2 API E2E was not run because this worktree lacks .env.local / D1 test credentials; GitHub CI is the merge gate

Multica: STU-404

Mirror the application-side retry policy from lib/db/d1-client.ts so
seed.ts executeD1/queryD1 survive a single ECONNRESET / dropped TCP
connection to api.cloudflare.com instead of aborting the whole vitest
run. CI run 27265783211 hit this in tests/api/v1/idempotency.test.ts
line 109 (queryD1 verifying link_tags row count), with the failure
recorded as TypeError: fetch failed -> Error: read ECONNRESET. The
application path already retries; only the test seed/query helper was
unprotected.

Retries are bounded (2 attempts on top of the original call) and only
triggered for known transient errors (ECONNRESET, ECONNREFUSED,
ETIMEDOUT, UND_ERR_SOCKET, fetch failed). The warning includes the
underlying syscall code so non-transient failures stay distinguishable
in CI logs.
@nocoo nocoo merged commit dabb1f5 into main Jun 10, 2026
7 checks passed
@nocoo nocoo deleted the agent/sde-01/87683609 branch June 10, 2026 23:07
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.

1 participant