Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#248 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bhushan4work ci sta già lavorando.

Dal 20/10/2026.

  • #256 di @bhushan4work — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
TypeScript
Stelle
13
Fork
7
Merge medio
4h 11m
PR unite (30g)
122

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codercops/chatcops

Tutte le issue di codercops/chatcops

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.