Files
captoys/diigo-cache/doc/open-issues.md
T
2026-10-29 16:26:02 -05:00

7.6 KiB

Open issues

In IBIS notation: ? issue, ?! resolved, ?~ open with a fallback; : position, :+ accepted, :- rejected, :~+ fallback; + pro, - con; ! to-do; . comment. Append; don't renumber.

?! 1. How does diigo see the cookie come from the IP it was issued to?
  . observed: minted from the browser, the cookie failed from Cloudflare
  . unverified that IP is the only binding; the mint sends user-agent
    "Mozilla/5.0", not the browser's, and that works in dev
  : 1a. log in to diigo from a browser that shares bldbox's public IP
    (same LAN, same NAT)
    + no setup if that's where the browser already is
    - breaks when the browser roams (phone, laptop away from home)
    ! compare: curl https://ifconfig.me on bldbox and in the browser
  : 1b. advertise bldbox as a tailnet exit node; route the browser through
    it while logging in to diigo and copying the cookie
    + bldbox's IP by construction, from anywhere on the tailnet
    - bldbox isn't an exit node (ExitNodeOption false, 2026-10-14);
      needs `tailscale set --advertise-exit-node` and admin approval
  :+ 1c. run the browser on bldbox
    + worked 2026-10-14: a cookie copied from Brave's devtools on bldbox
      minted, wired public, and filled 168 pages
  :- 1d. deploy to Cloudflare
    - its egress IPs aren't the browser's (the failure that prompted this)

?~ 2. How is diigo-cache reachable only from the tailnet?

?~ 2. How is diigo-cache reachable only from the tailnet?
  :~+ 2a. workerd on 127.0.0.1:8790; tailscale serve proxies
    https://bldbox.tail09e44.ts.net/ to it
    + HTTPS with a real cert: PasswordCredential needs a secure context
    + tailscaled owns the tailnet address; no start-order dependency
    - needs HTTPS certificates on in the tailnet (off as of 2026-10-14)
      ! enable in the admin console (install.md)
    - every local user and process on bldbox reaches 127.0.0.1:8790 (see 3)
      + the cache id is still needed for anything private
  : 2b. listen on 100.89.146.23 directly (ListenStream, FreeBind=yes)
    - plain HTTP: the password-manager button fails
  : 2c. tailscale serve to a unix socket only it can open
    + no loopback port
    - unverified that tailscale 1.90.9 serve takes a unix socket target
  ? 2d. Which tailnet devices may reach it?
    . today: every device on the tailnet (m5x, penguin, pixel-7, tiny-jwc)
    : 2d-i. restrict to some devices with a tailnet ACL grant on bldbox:443

?~ 3. What account does the service run as?

?~ 3. What account does the service run as?
  :~+ 3a. a system unit with DynamicUser=yes
    + the cookie's state is 0700 to a uid nothing else runs as; agents
      and bots running as connolly can't read it
    + full sandboxing (systemd-analyze security: 2.2 OK)
    - install and upgrade need sudo
  : 3b. a user unit under connolly, with lingering
    + no sudo for upgrade; a ~/.local profile
    - the cookie sits in connolly's files, readable by every process
      connolly runs, Discord and opencode bots included
    - Ubuntu's AppArmor userns restriction weakens user-manager sandboxing
    - tailscale serve needs root (or `tailscale set --operator`) anyway

? 4. Does /api need a rate limit on the tailnet?

? 4. Does /api need a rate limit on the tailnet?
  . CONTRIBUTING asks for one "before exposing a deployment"
  :~+ 4a. not while only tailnet devices reach it (see 2)
  : 4b. a rate limit in front of workerd before any funnel (see 5)

? 5. How does the weekly roundup read the public page?

? 5. How does the weekly roundup read the public page?
  . the madmode blog build needs /public/<username>; where does it run?
  : 5a. build on a tailnet device
  : 5b. join CI to the tailnet (Tailscale's GitHub Action)
  : 5c. tailscale funnel just /public/ to the internet
    + public pages are public by design
    - exposes a guessable URL; needs 4b

? 6. How is state backed up?

? 6. How is state backed up?
  :~+ 6a. by hand, service stopped (operate.md)
  : 6b. a systemd timer
    - backups hold the cookie: where do they go, encrypted how?
  : 6c. none: the cache is a cache
    - the ids people saved point at objects that would be gone
? 7. How does a cache get a fresh cookie?
  . a wired cache refuses a different webapp id
  :~+ 7a. mint a fresh webapp instance and wire a new cache
    - a new cache id to save
    + wiring public re-registers the username, so the public URL stays
  : 7b. let webapp replace the cookie in an existing instance
    + cache ids stay put

? 8. Should wrangler dev state move to bldbox?

? 8. Should `wrangler dev` state move to bldbox?
  . Durable Object unique keys follow miniflare's `<script>-<class>`,
    so the per-object files may carry over; untested
  :~+ 8a. start fresh on bldbox
    + dev cookies were minted for wherever dev ran (see 1)
  : 8b. copy .wrangler/state/v3/do/<script>-<class>/ into the state dirs

? 9. What should we be able to observe, and how?

? 9. What should we be able to observe, and how?
  . today: each worker console.logs objects ({event, ...}); workerd's
    structuredLogging puts them in the journal (operate.md)
  . gap: webapp logs only mint; a diigo request shows up only as the
    cache's account of it ({event: "cache", outcome: "miss" | "refetch"}),
    so no status, latency, or failure before the cache sees it
  . the refresh (every 3h) is seen only by reading the journal
  ! survey practice before choosing: logs vs metrics vs traces, what to
    alert on; Workers observability docs as a start
  : 9a. log each diigo request in webapp: path, status, ms; no query
    values or headers, so the cookie never appears
  ? 9b. how does anyone notice a refresh failing (expired cookie)?

? 10. Do we need to store diigo page numbers?

? 10. Do we need to store diigo page numbers?
  . pages come from load_user_items with sort=updated, newest first; each
    new or edited bookmark shifts the rest down one slot, a deletion up one
  . only page 1 is refetched (every 3h, refetchThrough 1), so pages 2 and
    on are snapshots from the first fill (2026-10-14)
  . items are keyed by item_id; page_members records each page's positions
  . consequences, seen 2026-10-29:
    . k new bookmarks leave k items on no page: a gap in paged views
    . an edited bookmark is listed on page 1 and at its stale position
    . summing logged page items (16,767 private) counts snapshots, not items
    . a deletion is never noticed; its row stays
  . week views (?days=, ?in=) query items by date, so they're unaffected
  : 10a. keep pages as stored snapshots (today)
    + read-through: viewing a page not yet filled fetches it
    - the drift above
  : 10b. store only items; a page number is just the fill's cursor
    . each page-table read has a replacement:
      . refresh depth (deepestPageSince): items updated since the cutoff,
        / 100, rounded up, + 1 page of slack for shifts
      . invalidateRecent: not needed
      . knownTotal: keep diigo's latest total as one kv value
      . completeness (pagesThrough): a "full pass done" flag on the fill job
      . paged public view: items order by updated desc, limit/offset
      . page dump (HIT/MISS): fetch live; it's a debugging tool
    + paged views get no gaps or duplicates
    + last_seen per item: after a full pass, items not seen were deleted
      or made private on diigo
    + fetched_at per item says more than pages.etched_at
    - views past the filled part come back short until the fill gets there
    - a schema migration