Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)

Geschlossen
#249 2 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@bhushan4work arbeitet bereits daran.

Seit 21.10.2026.

  • #296 von @bhushan4work — gemerged

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
postgresql, typescript

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement hacktoberfest help wanted server

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 })
  • d1 is required:
    • It stores conversations (with append, updateMessage, removeMessage, list, purge) and events (with query).
    • 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 append atomic with db.batch(). The version check has to be part of the statements themselves, for example UPDATE ... SET version = version + 1 WHERE id = ? AND version = ?, with the inserts conditional on it.
  • counters: a Durable Object namespace when given. Durable Objects run one request at a time, so increments are exact; ship the ChatCopsCounter class. Without one, fall back to a D1 UPSERT ... 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 atomic setIfAbsent, so only offer setIfAbsent on the D1 table.
  • Include a wrangler.jsonc snippet in the README with the D1 binding, the DO binding and its migration.
  • "private": true in package.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

  • runStorageConformance passes with D1 + KV + DO (skipping only kv-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 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.

Vorherrschende Sprache
TypeScript
Sterne
13
Forks
7
Ø Merge
3 Std. 28 Min.
Gemergte PRs (30 T.)
182

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus codercops/chatcops

Alle Issues in codercops/chatcops

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.