Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- postgresql, typescript
- Área
- backend, database, distributed-systems
Línea de trabajo
Start with packages/core/src/storage/types.ts, runStorageConformance from @chatcops/core/testing, and CONTRIBUTING.md’s “Writing a store package” section; inspect the SQLite store and its tables in issue #247. Use Miniflare from a normal Node test and run conformance against D1 + KV + DO and D1 alone as specified. Done means the acceptance checks pass, including 50 exact Durable Object increments, README Wrangler configuration, a minor changeset, and the listed build, coverage, lint, and publint commands.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
A ChatCops server on Cloudflare Workers keeps everything in memory today, and Workers isolates come and go all the time, so conversations and rate limits barely last. This package stores them in Cloudflare's own services.
This is a bigger one, for someone who has had a few PRs merged here and knows Workers. 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-cloudflare:
import { cloudflareStorage, ChatCopsCounter } from '@chatcops/store-cloudflare';
export { ChatCopsCounter }; // the Durable Object class, exported from the Worker
storage: cloudflareStorage({ d1: env.DB, kv: env.CHATCOPS_KV, counters: env.CHATCOPS_COUNTERS })
d1is required:- It stores
conversations(withappend,updateMessage,removeMessage,list,purge) andevents(withquery). - Use the same tables as the SQLite store (see #247). D1 is SQLite, so the schema can be shared later.
- D1 has no interactive transactions, so make
appendatomic withdb.batch(). The version check has to be part of the statements themselves, for exampleUPDATE ... SET version = version + 1 WHERE id = ? AND version = ?, with the inserts conditional on it.
- It stores
counters: a Durable Object namespace when given. Durable Objects run one request at a time, so increments are exact; ship theChatCopsCounterclass. Without one, fall back to a D1UPSERT ... RETURNING. Never use KV for counters: it's eventually consistent.kv: Workers KV when given, otherwise a D1 table. Workers KV can't do an atomicsetIfAbsent, so only offersetIfAbsenton the D1 table.- Include a
wrangler.jsoncsnippet in the README with the D1 binding, the DO binding and its migration. "private": trueinpackage.json. A maintainer publishes it for the first time.
Testing
Use Miniflare from a normal Node test (new Miniflare({ ... d1Databases, kvNamespaces, durableObjects }) and its getD1Database() etc.) rather than the Workers vitest pool, which doesn't mix well with the root vitest projects here. Workers KV has a 60 second minimum TTL, so pass skip: ['kv-ttl'] for the KV-backed run, and run the suite a second time on the D1-only setup without skipping it.
Acceptance criteria
-
runStorageConformancepasses with D1 + KV + DO (skipping onlykv-ttl) and with D1 alone (nothing skipped) - 50 concurrent increments through the Durable Object land exactly
- README with the wrangler config
- Changeset for
@chatcops/store-cloudflare(minor) -
pnpm -r build,pnpm test:coverage(90% lines, 80% branches for store packages),pnpm lintandpnpm publintpass
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13
- Forks
- 7
- Merge medio
- 3 h 33 min
- PR fusionados (30 d)
- 176
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsPosiblemente ocupada @varun-pahuja la tomó hace 2 días. Abiertoenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Type-check the TypeScript samples in the docsPosiblemente ocupada @An16og la tomó hace 2 días. Abiertodocumentation hacktoberfest help wanted testing
Dificultad 4/5 3-5 días Aptitud para principiantes 70/100
codercops/chatcops#201 · 7 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Hacktoberfest 2026: start hereAbiertohacktoberfest
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Add built-in translations to the widgetPosiblemente ocupada @piyusshhjangid la tomó hace 1 día. Abiertohelp wanted widget
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
codercops/chatcops#55 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/chatcops
Issues similares
-
bug skills
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
equinor/fusion-framework#5846 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Eyevinn/open-videocore#1256 ·
Los mantenedores suelen responder en 1 día
-
Frontend build fails with Frappe version-16: DataImport is no longer exported by @framework/uiAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Theme preset geist points at undefined --font-geistPosiblemente ocupada @claude la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día