Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Create @chatcops/store-redis for Upstash and other Redis clients

未关闭
#248 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@bhushan4work 已经在做这个了。

开始于 2026年10月20日。

  • #256 来自 @bhushan4work —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

enhancement hacktoberfest help wanted server

On Vercel and Workers each request can land on a different instance, so in-memory conversations and rate limits don't work there. Upstash Redis is the usual answer for those platforms, since it's reached over HTTP and works on every runtime. This package is the store for it, and for any other Redis client through a small interface.

This is a bigger one, for someone who has had a few PRs merged here. The interfaces and the tests it has to pass already exist: packages/core/src/storage/types.ts and runStorageConformance from @chatcops/core/testing. CONTRIBUTING.md has a "Writing a store package" section with the package layout.

What to do
Create packages/store-redis:

import { Redis } from '@upstash/redis';
import { redisStorage, fromIoRedis } from '@chatcops/store-redis';

storage: redisStorage({ redis: Redis.fromEnv() })
storage: redisStorage({ redis: fromIoRedis(new IORedis(url)) })
// options: prefix (default 'chatcops'), conversationTtlMs (default 30 days)
  • All four capabilities: conversations (with append, updateMessage, removeMessage, list, purge), counters, kv (with setIfAbsent) and events (with query).
  • Define a small RedisLike interface with the commands you need. @upstash/redis should fit it as is, and fromIoRedis adapts ioredis (its eval takes arguments differently). @upstash/redis is an optional peer dependency, and ioredis isn't a dependency at all.
  • Layout:
    • a hash per conversation (created_at, updated_at, version, metadata)
    • a list of JSON messages per conversation
    • a sorted set of conversation ids by updated_at, for list and purge
    • PEXPIRE on the conversation keys, so idle conversations expire on their own
  • Anything that reads and then writes runs as one Lua script (EVAL), so it's atomic: append with its version check, updateMessage, removeMessage, and counter increments that set the expiry only on a new key. Upstash supports EVAL.
  • kv: SET with PX, and NX for setIfAbsent. Values are JSON.
  • events: a capped stream (XADD with MAXLEN ~), or a hash of counts per hour bucket if that makes query simpler. Explain your choice in the PR.
  • "private": true in package.json. A maintainer publishes it for the first time.

Testing
CI runs Redis and the Upstash REST emulator. CHATCOPS_TEST_UPSTASH_URL with CHATCOPS_TEST_UPSTASH_TOKEN is for @upstash/redis, and CHATCOPS_TEST_REDIS_URL is for ioredis. Run the suite against both. Locally, docker run -p 6379:6379 redis:7-alpine is enough for the ioredis side.

Acceptance criteria

  • runStorageConformance passes with nothing skipped through @upstash/redis and through fromIoRedis
  • Two storages with different prefixes on one Redis don't see each other's data
  • A short README with the Vercel setup
  • Changeset for @chatcops/store-redis (minor)
  • pnpm -r build, pnpm test:coverage (90% lines, 80% branches for store packages), pnpm lint and pnpm publint pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.

主要语言
TypeScript
星标
13
派生
7
平均合并
4 小时 11 分钟
30 天内合并 PR
122

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codercops/chatcops 的其他 Issue

查看 codercops/chatcops 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。