Add local mock for Artifacts REST control plane - #209
Conversation
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughAdded a mock Cloudflare Artifacts Durable Object with repo metadata management, REST endpoints for create/get/list/fork/token operations, wrangler binding configuration, worker integration, and integration tests. Documentation updated to clarify mock server scope during local development. Changes
Sequence DiagramsequenceDiagram
actor Client
participant MockWorker as Mock<br/>Worker
participant DO as Artifacts<br/>Durable Object
participant Storage as In-Memory<br/>Storage
Client->>MockWorker: POST /repos<br/>(create repo)
MockWorker->>DO: fetch with<br/>create command
DO->>Storage: readStorage()
Storage-->>DO: load repos
DO->>Storage: append new repo<br/>+ timestamps
Storage-->>DO: persisted
DO-->>MockWorker: repo + token
MockWorker-->>Client: 200 + repo data
Client->>MockWorker: GET /repos<br/>(list repos)
MockWorker->>DO: fetch with<br/>list command
DO->>Storage: readStorage()
Storage-->>DO: all repos
DO-->>DO: sort + paginate
DO-->>MockWorker: repos array
MockWorker-->>Client: 200 + repos
Client->>MockWorker: POST /repos/fork<br/>(fork repo)
MockWorker->>DO: fetch with<br/>fork command
DO->>Storage: readStorage()
Storage-->>DO: verify source exists
DO->>Storage: append forked repo
Storage-->>DO: persisted
DO-->>MockWorker: forked repo
MockWorker-->>Client: 200 + fork data
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Testing
Summary by CodeRabbit
Documentation
npm run devwithout contacting live endpoints.New Features
Tests