Skip to content

feat(provider): add Upstash Redis REST actions - #210

Merged
BlackHole1 merged 2 commits into
oomol-lab:mainfrom
vinkiYu:codex/add-upstash-redis-provider
Jul 27, 2026
Merged

feat(provider): add Upstash Redis REST actions#210
BlackHole1 merged 2 commits into
oomol-lab:mainfrom
vinkiYu:codex/add-upstash-redis-provider

Conversation

@vinkiYu

@vinkiYu vinkiYu commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary / 概要

  • Add a locally executable Upstash Redis provider backed by the official REST API.
  • 新增基于 Upstash 官方 REST API 的本地可执行 Redis Provider。

Changes / 改动内容

  • Add custom credentials with
    estUrl and secret
    estToken, validated through PING.

  • 新增
    estUrl 与敏感
    estToken 凭据,并使用 PING 校验连接。

  • Add seven string-key actions: get, set, delete, exists, expire, tl, and single-page scan.

  • 新增 7 个字符串键操作:get、set、delete、exists、expire、 tl 和单页 scan。

  • Support atomic SET key value [EX seconds] [NX|XX] writes and preserve Redis TTL semantics.

  • 支持原子 SET key value [EX seconds] [NX|XX] 写入,并保留 Redis TTL 语义。

  • Restrict REST URLs to public https://*.upstash.io root endpoints and route requests through the injected SSRF-protected fetcher.

  • REST URL 仅允许公网 https://*.upstash.io 根路径端点,所有请求均使用注入的 SSRF 防护 Fetch。

  • Handle timeouts, cancellation, JSON response envelopes, upstream errors, and non-JSON error bodies while preserving relevant HTTP status codes.

  • 处理超时、取消、JSON 响应包络、上游错误和非 JSON 错误响应,并保留关键 HTTP 状态码。

Validation / 验证

  • scripts/generate-catalog.ts

pm run typecheck

  • �itest run - 57 files and 548 tests passed
  • Mock Fetch smoke tests for credential validation, command encoding, output normalization, URL validation, and non-JSON upstream errors

Notes / 说明

  • No npm dependencies or shared runtime changes were added.

  • 未新增 npm 依赖,也未修改共享运行时。

  • package-lock.json is intentionally excluded because it is unrelated local user work.

  • package-lock.json 为无关的本地用户修改,未包含在本 PR 中。

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 30a4b47c-f7fc-4a3b-ba26-924aa91b9ac6

📥 Commits

Reviewing files that changed from the base of the PR and between 36a677e and 91574f8.

📒 Files selected for processing (4)
  • src/providers/upstash_redis/actions.ts
  • src/providers/upstash_redis/definition.ts
  • src/providers/upstash_redis/executors.ts
  • src/providers/upstash_redis/runtime.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/providers/upstash_redis/definition.ts
  • src/providers/upstash_redis/actions.ts
  • src/providers/upstash_redis/executors.ts
  • src/providers/upstash_redis/runtime.ts

Summary by CodeRabbit

  • New Features
    • Added an Upstash Redis integration using Upstash’s official REST API.
    • Enables Redis-like operations: get, set, delete, exists, expire, ttl, and scan (with cursor-based pagination).
    • Added support for configuring credentials (REST URL and token) and validating connectivity via a ping-style check.
    • Provides consistent error handling for invalid inputs, timeouts, cancellations, and Upstash service failures.

Walkthrough

Adds a complete Upstash Redis provider integration. It defines Redis actions for get, set, delete, exists, expire, ttl, and scan, registers provider metadata and custom credentials, wires runtime executors, validates credentials through PING, and executes authenticated REST commands. The runtime validates URLs, inputs, response shapes, timeouts, cancellations, HTTP errors, and Upstash API errors.

Sequence Diagram(s)

sequenceDiagram
  participant ProviderExecutor
  participant RedisActionHandler
  participant UpstashCommandExecutor
  participant UpstashRESTAPI
  ProviderExecutor->>RedisActionHandler: action input and context
  RedisActionHandler->>UpstashCommandExecutor: Redis command array
  UpstashCommandExecutor->>UpstashRESTAPI: authenticated POST request
  UpstashRESTAPI-->>UpstashCommandExecutor: command result or error
  UpstashCommandExecutor-->>RedisActionHandler: parsed and validated result
  RedisActionHandler-->>ProviderExecutor: action output
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required type(scope): subject format and accurately summarizes the Upstash Redis provider changes.
Description check ✅ Passed The description is clearly related to the new Upstash Redis provider, its actions, validation, and runtime behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BlackHole1 BlackHole1 self-assigned this Jul 27, 2026
Reading the SET payload with requiredString ran it through optionalString,
which trims and rejects whitespace-only input. Redis strings are opaque, so
a value such as a JSON document with a trailing newline was silently stored
without it while get read the stored bytes back untouched — set/get did not
round-trip inside the same provider. Read the payload with optionalRawString
so what reaches Redis is exactly what the caller sent.

Upstash reports quota and throttling as Redis errors inside a 400 response
("ERR max daily request limit exceeded", "ERR max concurrent connections
exceeded"), so those surfaced as invalid_input and no client backed off.
Detect them from the message and map them to 429/rate_limited.

Also drop three unreachable branches in createUpstashError (the documented
status set is 200/400/401/405, and the general return already yields the
same status for every 4xx), drop the dead hostname === "upstash.io" operand
that the ".upstash.io" suffix check already covers, name the createContext
return type, correct the read-only token description (Upstash blocks SCAN
for read-only tokens), and document that non-UTF-8 bytes come back as U+FFFD.
@BlackHole1
BlackHole1 merged commit 97ca60a into oomol-lab:main Jul 27, 2026
3 checks 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.

2 participants