Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- postgresql, typescript
- Ambito
- backend, database, distributed-systems
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 13
- Fork
- 7
- Merge medio
- 3h 41m
- PR unite (30g)
- 155
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di codercops/chatcops
-
Document the pre-chat formForse già presa @masyarakatai l’ha presa 5 giorni fa. Apertadocumentation good first issue hacktoberfest widget
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
codercops/chatcops#70 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
docs: update the providers page for openai-compatible, registerProvider and provider importsForse già presa @prakashNalla l’ha presa oggi. Apertadocumentation good first issue hacktoberfest website
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
codercops/chatcops#291 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
docs: add a protocol reference page for custom clientsForse già presa @kachamsiddarth l’ha presa oggi. Apertadocumentation good first issue hacktoberfest website
codercops/chatcops#286 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Create @chatcops/store-sqlite, a store for single-server setupsForse già presa @srikar-naidu l’ha presa oggi. Apertaenhancement hacktoberfest help wanted server
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
codercops/chatcops#247 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Batch analytics events into an EventSink and compute stats from itForse già presa @srujankaleru2007 l’ha presa oggi. Apertacore enhancement hacktoberfest help wanted
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
codercops/chatcops#246 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/chatcops
Issue simili
-
bug P3 UI/UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
StellarState/SS-backend#712 ·
I maintainer di solito rispondono entro 1 giorno
-
area: backend bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
snapotter-hq/SnapOtter#3473 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
gitroomhq/postiz-app#2304 ·
I maintainer di solito rispondono entro 1 giorno
-
harlan-agent-ready-to-implement routine:ci-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
harlan-zw/unlighthouse#454 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno