diigo-cache: bookmark cache in Durable Objects (goal 1c)

The dump worker becomes a page cache: a hit is served from DO SQLite
storage with no diigo call; a miss asks the webapp instance in the
cache's wiring and etches the page.

- two independent caches, one behavior (PagedCache): DiigoCache keeps
  every item; PublicCache keeps shared items only, dropping private
  rows before they are stored; served at /public/<username> (HTML page
  form, or JSON)
- create flow on one port: /_connect relays webapp's mint form, /_mint
  proxies the mint, /_wire wires a private or public cache; /_publish
  adds a public cache later
- ids are webkeys: kept out of URLs (POST bodies), shown and logged
  only as a hash fingerprint; saved to the password manager under the
  holder's petname (never sent to the server)
- items keyed on diigo's link_id; username from u_name; unkeyable
  items and every failure path are logged; each page read logs hit/miss
- tests run the real worker + DOs in the vitest pool against a fake
  webapp (tests/fake-webapp.js)

Generated-by: opencode (GLM)
Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 04:19:54 -05:00
1 parent c5e433cc9c
commit 6f409fc83a
15 files changed
+1664 -211

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import { defineProject } from "vitest/config";
// the plugin resolves from diigo-bookmarks's store (the one vitest
// install on disk); direct-path import sidesteps pnpm's exports-map
// restriction *for the config file*. cloudflareTest (the plugin form,
// not the bare pool) is what provides the `cloudflare:test` module.
import { cloudflareTest } from "../diigo-bookmarks/node_modules/.pnpm/@cloudflare+vitest-plugin@1.3.6_@cloudflare+workers-types@5.20261005.1_@types+node@26.6.4_@vi_7mty7nznaeeyt2ohspxbzj4p6m/node_modules/@cloudflare/vitest-plugin/dist/pool/index.mjs";
export default defineProject({
plugins: [
cloudflareTest({
// the real worker + DOs; WEBAPP is a fake (aux workers must be JS)
wrangler: { configPath: "./wrangler.tests.jsonc" },
miniflare: {
workers: [
{
name: "fake-webapp",
modules: true,
scriptPath: "./tests/fake-webapp.js",
compatibilityDate: "2026-09-29",
},
],
},
}),
],
test: {
include: ["tests/**/*.test.ts"],
},
});