Skip to content

feat: add retry mechanism and observer for HTTP requests - #1

Merged
patrickatrender merged 7 commits into
mainfrom
logs-metrics
Sep 22, 2026
Merged

patrickatrender merged 7 commits into
mainfrom
logs-metrics

Conversation

@patrickatrender

Copy link
Copy Markdown
Collaborator
  • Introduced MaxRetries option to the Client for configurable retry behavior.
  • Implemented exponential backoff with jitter for retries on network errors and specific HTTP status codes.
  • Added an observer callback to log attempts and their outcomes.
  • Updated the Classify method to utilize the new retry logic.
  • Enhanced error handling to differentiate between retryable and non-retryable errors.
  • Added tests to verify retry behavior and observer functionality.

chore: add .gitignore and golangci-lint configuration

  • Added .gitignore to exclude coverage output files.
  • Created .golangci.yml for linting configuration with a comprehensive set of linters.

docs: update README with retries and logging details

  • Documented the retry mechanism and logging capabilities in the README.

style: format code and improve readability

  • Reformatted code in various files for consistency and clarity.
  • Adjusted spacing and alignment in maps and structs for better readability.

chore: update go.mod and go.sum for dependencies

  • Updated Go version to 1.26.0.
  • Added new dependencies for linting and code analysis tools.
  • Updated indirect dependencies to their latest versions.

feat: add mise.toml for task automation

  • Created mise.toml to define tasks for testing, coverage, linting, and formatting.

patrickatrender and others added 4 commits September 22, 2026 11:52
- Introduced MaxRetries option to the Client for configurable retry behavior.
- Implemented exponential backoff with jitter for retries on network errors and specific HTTP status codes.
- Added an observer callback to log attempts and their outcomes.
- Updated the Classify method to utilize the new retry logic.
- Enhanced error handling to differentiate between retryable and non-retryable errors.
- Added tests to verify retry behavior and observer functionality.

chore: add .gitignore and golangci-lint configuration

- Added .gitignore to exclude coverage output files.
- Created .golangci.yml for linting configuration with a comprehensive set of linters.

docs: update README with retries and logging details

- Documented the retry mechanism and logging capabilities in the README.

style: format code and improve readability

- Reformatted code in various files for consistency and clarity.
- Adjusted spacing and alignment in maps and structs for better readability.

chore: update go.mod and go.sum for dependencies

- Updated Go version to 1.26.0.
- Added new dependencies for linting and code analysis tools.
- Updated indirect dependencies to their latest versions.

feat: add mise.toml for task automation

- Created mise.toml to define tasks for testing, coverage, linting, and formatting.
The vulnerability step in .github/workflows/test.yml calls
`go tool govulncheck`, but govulncheck was never listed in go.mod's tool
block, so the step failed with `go: no such tool "govulncheck"`.

Add golang.org/x/vuln/cmd/govulncheck alongside nilaway and gofumpt, and
add a `mise vulncheck` task so the check is reachable locally instead of
only from CI. The task reports plain text rather than mirroring CI's JSON
and jq pipeline; that pipeline exists only so CI can ignore stdlib
findings, which need a toolchain bump rather than an in-repo fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@patrickatrender

Copy link
Copy Markdown
Collaborator Author

/nit

@prerender-ai-reviewer

prerender-ai-reviewer Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🤖 Review posted: 5 inline comments ⤴

AI Reviewer commands

You can ask for another review by commenting on this PR:

  • /caveman — Ultra-compressed findings — one line each, no throat-clearing
  • /grumpy — Critical senior-dev pass focused on bugs, edge cases, and security
  • /nit — Fine-grained style, naming, and structure polish linters miss
  • /quality — Multi-axis pass across correctness, readability, architecture, security, and performance

The command must be the first thing in the comment, and only repository owners, members, and collaborators can trigger one.

Or tell me to stay out of the way:

  • @prerenderbot ignore this PR — no automatic review, fix, or rebase on this PR (undo with unignore)
  • @prerenderbot ignore me — the same, for every PR you open in this repository (undo with unignore)

An explicit request — a slash command above, or requesting a review from me — still runs either way.

You can also ask for a specific model on any review — append it after the command, or use /model on its own for the default review:

  • /nit claude-fable-5
  • /model gpt-3.5-turbo

Available models:

  • anthropic: claude-fable-5, claude-fable-5-1, claude-haiku-4-5-20251001, claude-opus-4-5-20251101, claude-opus-4-6, claude-opus-4-7, claude-opus-4-8, claude-opus-5, claude-sonnet-4-5-20250929, claude-sonnet-4-6, claude-sonnet-5
  • openai: gpt-3.5-turbo, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo-16k, gpt-4, gpt-4-0613, gpt-4-turbo, gpt-4-turbo-2024-04-09, gpt-4.1, gpt-4.1-2025-04-14, gpt-4.1-mini, gpt-4.1-mini-2025-04-14, gpt-4.1-nano, gpt-4.1-nano-2025-04-14, gpt-4o, gpt-4o-2024-05-13, gpt-4o-2024-08-06, gpt-4o-2024-11-20, gpt-4o-mini, gpt-4o-mini-2024-07-18, gpt-5, gpt-5-2025-08-07, gpt-5-chat-latest, gpt-5-codex, gpt-5-mini, gpt-5-mini-2025-08-07, gpt-5-nano, gpt-5-nano-2025-08-07, gpt-5-pro, gpt-5-pro-2025-10-06, gpt-5.1, gpt-5.1-2025-11-13, gpt-5.1-chat-latest, gpt-5.1-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini, gpt-5.2, gpt-5.2-2025-12-11, gpt-5.2-chat-latest, gpt-5.2-codex, gpt-5.2-pro, gpt-5.2-pro-2025-12-11, gpt-5.3-chat-latest, gpt-5.3-codex, gpt-5.4, gpt-5.4-2026-03-05, gpt-5.4-mini, gpt-5.4-mini-2026-03-17, gpt-5.4-nano, gpt-5.4-nano-2026-03-17, gpt-5.4-pro, gpt-5.4-pro-2026-03-05, gpt-5.5, gpt-5.5-2026-04-23, gpt-5.5-pro, gpt-5.5-pro-2026-04-23, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, gpt-live-1, o1, o1-2024-12-17, o1-pro, o1-pro-2025-03-19, o3, o3-2025-04-16, o3-mini, o3-mini-2025-01-31, o3-pro, o3-pro-2025-06-10, o4-mini, o4-mini-2025-04-16

You can also ask me to rebase:

  • /rebase — rebase this PR onto its base branch, resolving merge conflicts

Or ask me for a merge verdict:

  • /verdict — review this PR and, if I am confident in it, approve it

Or let me approve your work without being asked:

  • @prerenderbot approve me — approve the pull requests you open here when I am confident in them (undo with unapprove)

Production

@patrickatrender

Copy link
Copy Markdown
Collaborator Author

/verdict

@prerender-ai-reviewer

Copy link
Copy Markdown

🤖 Working out a verdict…

AI Reviewer commands

You can ask for another review by commenting on this PR:

  • /caveman — Ultra-compressed findings — one line each, no throat-clearing
  • /grumpy — Critical senior-dev pass focused on bugs, edge cases, and security
  • /nit — Fine-grained style, naming, and structure polish linters miss
  • /quality — Multi-axis pass across correctness, readability, architecture, security, and performance

The command must be the first thing in the comment, and only repository owners, members, and collaborators can trigger one.

Or tell me to stay out of the way:

  • @prerenderbot ignore this PR — no automatic review, fix, or rebase on this PR (undo with unignore)
  • @prerenderbot ignore me — the same, for every PR you open in this repository (undo with unignore)

An explicit request — a slash command above, or requesting a review from me — still runs either way.

You can also ask for a specific model on any review — append it after the command, or use /model on its own for the default review:

  • /nit claude-fable-5
  • /model gpt-3.5-turbo

Available models:

  • anthropic: claude-fable-5, claude-fable-5-1, claude-haiku-4-5-20251001, claude-opus-4-5-20251101, claude-opus-4-6, claude-opus-4-7, claude-opus-4-8, claude-opus-5, claude-sonnet-4-5-20250929, claude-sonnet-4-6, claude-sonnet-5
  • openai: gpt-3.5-turbo, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo-16k, gpt-4, gpt-4-0613, gpt-4-turbo, gpt-4-turbo-2024-04-09, gpt-4.1, gpt-4.1-2025-04-14, gpt-4.1-mini, gpt-4.1-mini-2025-04-14, gpt-4.1-nano, gpt-4.1-nano-2025-04-14, gpt-4o, gpt-4o-2024-05-13, gpt-4o-2024-08-06, gpt-4o-2024-11-20, gpt-4o-mini, gpt-4o-mini-2024-07-18, gpt-5, gpt-5-2025-08-07, gpt-5-chat-latest, gpt-5-codex, gpt-5-mini, gpt-5-mini-2025-08-07, gpt-5-nano, gpt-5-nano-2025-08-07, gpt-5-pro, gpt-5-pro-2025-10-06, gpt-5.1, gpt-5.1-2025-11-13, gpt-5.1-chat-latest, gpt-5.1-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini, gpt-5.2, gpt-5.2-2025-12-11, gpt-5.2-chat-latest, gpt-5.2-codex, gpt-5.2-pro, gpt-5.2-pro-2025-12-11, gpt-5.3-chat-latest, gpt-5.3-codex, gpt-5.4, gpt-5.4-2026-03-05, gpt-5.4-mini, gpt-5.4-mini-2026-03-17, gpt-5.4-nano, gpt-5.4-nano-2026-03-17, gpt-5.4-pro, gpt-5.4-pro-2026-03-05, gpt-5.5, gpt-5.5-2026-04-23, gpt-5.5-pro, gpt-5.5-pro-2026-04-23, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, gpt-live-1, o1, o1-2024-12-17, o1-pro, o1-pro-2025-03-19, o3, o3-2025-04-16, o3-mini, o3-mini-2025-01-31, o3-pro, o3-pro-2025-06-10, o4-mini, o4-mini-2025-04-16

You can also ask me to rebase:

  • /rebase — rebase this PR onto its base branch, resolving merge conflicts

Or ask me for a merge verdict:

  • /verdict — review this PR and, if I am confident in it, approve it

Or let me approve your work without being asked:

  • @prerenderbot approve me — approve the pull requests you open here when I am confident in them (undo with unapprove)

Production

@prerender-ai-reviewer prerender-ai-reviewer Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry logic reads cleanly and the exponential backoff with Retry-After handling is sensible. My notes are small polish items, mostly in the new CI workflow.

The main thing to check is .github/workflows/test.yml: it references a frontend-checks job that this workflow never defines, which suggests it was copied from another repo. Nothing here blocks merge."

AI Reviewer commands

You can ask for another review by commenting on this PR:

  • /caveman — Ultra-compressed findings — one line each, no throat-clearing
  • /grumpy — Critical senior-dev pass focused on bugs, edge cases, and security
  • /nit — Fine-grained style, naming, and structure polish linters miss
  • /quality — Multi-axis pass across correctness, readability, architecture, security, and performance

The command must be the first thing in the comment, and only repository owners, members, and collaborators can trigger one.

Or tell me to stay out of the way:

  • @prerenderbot ignore this PR — no automatic review, fix, or rebase on this PR (undo with unignore)
  • @prerenderbot ignore me — the same, for every PR you open in this repository (undo with unignore)

An explicit request — a slash command above, or requesting a review from me — still runs either way.

You can also ask for a specific model on any review — append it after the command, or use /model on its own for the default review:

  • /nit claude-fable-5
  • /model gpt-3.5-turbo

Available models:

  • anthropic: claude-fable-5, claude-fable-5-1, claude-haiku-4-5-20251001, claude-opus-4-5-20251101, claude-opus-4-6, claude-opus-4-7, claude-opus-4-8, claude-opus-5, claude-sonnet-4-5-20250929, claude-sonnet-4-6, claude-sonnet-5
  • openai: gpt-3.5-turbo, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo-16k, gpt-4, gpt-4-0613, gpt-4-turbo, gpt-4-turbo-2024-04-09, gpt-4.1, gpt-4.1-2025-04-14, gpt-4.1-mini, gpt-4.1-mini-2025-04-14, gpt-4.1-nano, gpt-4.1-nano-2025-04-14, gpt-4o, gpt-4o-2024-05-13, gpt-4o-2024-08-06, gpt-4o-2024-11-20, gpt-4o-mini, gpt-4o-mini-2024-07-18, gpt-5, gpt-5-2025-08-07, gpt-5-chat-latest, gpt-5-codex, gpt-5-mini, gpt-5-mini-2025-08-07, gpt-5-nano, gpt-5-nano-2025-08-07, gpt-5-pro, gpt-5-pro-2025-10-06, gpt-5.1, gpt-5.1-2025-11-13, gpt-5.1-chat-latest, gpt-5.1-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini, gpt-5.2, gpt-5.2-2025-12-11, gpt-5.2-chat-latest, gpt-5.2-codex, gpt-5.2-pro, gpt-5.2-pro-2025-12-11, gpt-5.3-chat-latest, gpt-5.3-codex, gpt-5.4, gpt-5.4-2026-03-05, gpt-5.4-mini, gpt-5.4-mini-2026-03-17, gpt-5.4-nano, gpt-5.4-nano-2026-03-17, gpt-5.4-pro, gpt-5.4-pro-2026-03-05, gpt-5.5, gpt-5.5-2026-04-23, gpt-5.5-pro, gpt-5.5-pro-2026-04-23, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, gpt-live-1, o1, o1-2024-12-17, o1-pro, o1-pro-2025-03-19, o3, o3-2025-04-16, o3-mini, o3-mini-2025-01-31, o3-pro, o3-pro-2025-06-10, o4-mini, o4-mini-2025-04-16

You can also ask me to rebase:

  • /rebase — rebase this PR onto its base branch, resolving merge conflicts

Or ask me for a merge verdict:

  • /verdict — review this PR and, if I am confident in it, approve it

Or let me approve your work without being asked:

  • @prerenderbot approve me — approve the pull requests you open here when I am confident in them (undo with unapprove)

Requested review: Nitpicker Review (/nit)

Was this review helpful? 👍 Yes · 👎 No

Production

Comment thread .github/workflows/test.yml Outdated
Comment thread .github/workflows/test.yml Outdated
Comment thread .github/workflows/test.yml Outdated
Comment thread mise.toml
Comment thread typesafe/client.go Outdated
@socket-security

socket-security Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub.com/​stretchr/​testify@​v1.12.189100100100100

View full report

@patrickatrender
patrickatrender merged commit fd320f1 into main Sep 22, 2026
3 of 6 checks passed
@patrickatrender
patrickatrender deleted the logs-metrics branch September 22, 2026 16:34
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