Skip to content

docs(id book): cover the mail Worker and the two Worker proofs of concept (#13900) - #13914

Merged
dezren39 merged 1 commit into
mainfrom
book/id-workers
Nov 24, 2026
Merged

dezren39 merged 1 commit into
mainfrom
book/id-workers

Conversation

@dezren39

@dezren39 dezren39 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Part of the PM-BOOK programme #13900 (lane ID-SIDELINE; coordinator PM-BOOK). The coverage census (~/workspace/pm-book/coverage-ledger.md, Table A) found three ID Workers with no coverage in the id book (pkgs/id/book). This PR covers all three, surveyed from source with every load-bearing name verified by grepping the repo.

New chapters

  • pkgs/id/book/reference/mail-worker.md — "The mail Worker API" (full chapter; the mail Worker is a real production surface): the Worker mail in nixos/services/id-mail/worker/ — what it does (address-confirmation and sign-in mail for id), all four routes from config.json (mail.security.cab, mail.id.security.cab, id-mail.security.cab, mail-id.security.cab), the single POST contract, bearer-token auth against SHA-256 digests in the CALLERS secret, the amd (template mode, 1 recipient) and admin (free mode, 5 recipients) grants, the two templates and the six-digit {code} match, the MAIL_CONFIG / CALLERS / EMAIL / LIMITER bindings, the configured limits (60 s window, 60 caller, 5 recipient) and the Limiter DO's ordering, the complete failure-shape table (405/500/401/413/400/403/429/502), the host side (id serve --world-mail-command → id-cloudflare-mail, the rest vs worker transports, services.id-mail, the live host's workerUrl = "https://mail.security.cab"), its relationship to the hosted Worker (none in code) and to the native directory code that generates and verifies the codes, and operations/deployment (operator id-mail-deploy vs the manual publish/promote workflows, including that only the operator path acts on the retire list).
  • pkgs/id/book/reference/worker-poc.md — "id-worker-poc: the World Durable Object proof of concept" (honest PoC chapter): the completed id: PoC: one example world running unmodified in a Worker isolate — journal equality vs the native wasmtime host (from #2057) #2271 proof — one unmodified example world in a Worker isolate, journal equality against the native wasmtime host (counter + tic-tac-toe sequences, forced cold starts, compare: PASS (13 steps equal)), the pre-registered differences it never claimed equality over, WORLD/WorldObject bindings, the /step, /cold-start, /state routes, the journal schema, the hosted loader's refusals (64 MiB ceiling, portability=native), its proof commands, and where its ideas landed (evidence for the hosted edition's design; no code carried into id-hosted-worker, nothing deployed or referenced by production config).
  • pkgs/id/book/reference/d1-journal-poc.md — "id-d1-journal-poc: the D1 journal proof of concept" (honest PoC chapter): the local-only D1 fit probe — placeholder database ID, always --local, /health, /append, /snapshot, /tail, the version-1 created/caps_granted entries, ordinal allocation under the id: F12.13 journal replication (read replicas over a signed stream) #806 single-writer assumption, what it proved (exact-byte storage, ordering, bookmark-carried consistency) and what it explicitly did not (multi-writer, signatures, production replica behaviour; a D1 bookmark is not a stream cursor), and its design threads (design(id): serverless edition storage — D1 vs Turso vs both for id on Cloudflare Workers #5681, id: design: D1 journal fit (design + spike) (from #5681) #5864, id: design: serverless storage contract (from #5681) #5863).

Registration and cross-links

  • All three registered in pkgs/id/book/SUMMARY.md immediately after "The hosted Worker API". The id book has no second navigation/manifest gate like mcpx's compendium — checked: no test or manifest references the book tree; SUMMARY.md plus create-missing = false in pkgs/id/book.toml is the whole gate.
  • Cross-linked from "The hosted Worker API" and "The hosted edition"; a new "The mail Worker" operations section in "Running a node: serve, worlds and the hosted edition"; and the sync contract in "Keeping this book current" now names the mail Worker chapter for mail route/grant/template/limit/binding changes.
  • No worker prioritised list / issue-map chapter exists in the id book to add these to: the roadmap chapter's tracker table is design-programme trackers, and the research issue maps are dated census snapshots. Recorded here rather than inventing one.

Verification actually run

  • Mechanical audit over the whole book (script): 106 SUMMARY entries; every book file listed in SUMMARY; every chapter's single H1 (outside code fences) equal to its SUMMARY text; every internal .md link resolving with link text equal to the target chapter's title — 0 problems. All three workers covered in SUMMARY by exact Worker name.
  • mdbook build in pkgs/id/: exit 0, zero warnings (log: 3 INFO lines), all three new pages rendered.
  • nix build .#id-docs --print-build-logs (the CI gate derivation): green, only INFO lines from mdBook inside, rendered output contains index.html and the three new pages; rendered HTML spot-checked for mail.security.cab, id-worker-poc, id-d1-journal-poc.
  • Hedge-word pass over the new chapters (-shaped, reportedly, appears to): none remain as unverified claims.

Disagreements found (docs vs code)

  1. MW-1 — route count. The census/brief shorthand names two mail routes; config.json declares four: mail.security.cab, mail.id.security.cab, id-mail.security.cab, mail-id.security.cab. The chapter documents all four.
  2. MW-2 — the retire list. DEPLOYMENT.md says the retire list "is not acted on" — true only of the publish/promote workflows it documents. The operator path (deploy.mjs, via id-mail-deploy) does act on it, retiring id-mail before deploying. The chapter scopes both statements to their paths.
  3. MW-3 — no wrangler.toml. The mail Worker has no Wrangler config file in the repo: config.json is the configuration of record, consumed by cloudflare.config.ts (cf CLI) and by deploy.mjs, which generates .generated/wrangler.json. The chapter states this so readers do not hunt for a file that does not exist.
  4. POC-1 — worker-poc README route list. The README's layout bullet for src/worker.ts names POST /step and POST /cold-start but omits GET /state, which the source header and handler implement. The chapter follows the source and notes the gap.
  5. MW-4 — who enforces the 15 minutes. The template text says the code "works for 15 minutes", but the Worker neither generates codes nor enforces expiry — it only pattern-matches a six-digit code. Generation, lifetime and verification are the native directory code's (code_mail in directory_view.rs builds exactly the two templated messages). The chapter states the split explicitly.
{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-24T00:48:54Z",
    "session_id": null,
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/wt-id-workers-book",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/wt-id-workers-book",
      "repo": "developing-today/code",
      "branch": "book/id-workers",
      "sha": "bb0b439c8ad3bdb9f7a5d757147345d04d378be7"
    },
    "auth_subject": "oc-code-04",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…cept (#13900)

The PM-BOOK coverage census (programme #13900) found three ID Workers
with no chapter in the id book. Add them, surveyed from source:

- reference/mail-worker.md (The mail Worker API): the production mail
  Worker `mail` in nixos/services/id-mail/worker/ — all four routes
  (mail.security.cab, mail.id.security.cab, id-mail.security.cab,
  mail-id.security.cab), the POST contract, bearer/Digest caller auth
  and the amd (template) / admin (free) grants, MAIL_CONFIG / CALLERS /
  EMAIL / LIMITER bindings and limits, the full failure-shape table,
  the host side (id serve --world-mail-command, the rest/worker
  transports, services.id-mail), and the operator vs publish/promote
  deployment paths, including that only the operator path acts on the
  retire list.
- reference/worker-poc.md: id-worker-poc, the completed #2271 World
  Durable Object proof of concept (journal equality vs the native
  wasmtime host), its routes, journal schema, loader refusals and
  where its ideas landed.
- reference/d1-journal-poc.md: id-d1-journal-poc, the local-only D1
  journal fit probe — routes, entry shapes, ordinal allocation,
  bookmark-vs-cursor limits, and its open design threads (#5681,
  #5864, #5863).

Registered in SUMMARY.md after The hosted Worker API (the id book has
no second navigation/manifest gate; SUMMARY.md plus
create-missing = false is the whole gate). Cross-linked from The
hosted Worker API, The hosted edition, Running a node (new mail
Worker operations section), and the Keeping this book current sync
contract.

Verification: mechanical audit over the book — 106 SUMMARY entries,
every file listed, single H1 equal to its SUMMARY text, every
internal link resolving with text equal to the target title — 0
problems. mdbook build clean with zero warnings; nix build .#id-docs
green with the three new pages rendered.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1d062c6-081a-45ba-aa1d-46a8f2bcf2b8
Commits

Reviewing files that changed from the base of the PR and between c4e2e72 and bb0b439.

Files selected for processing: 8

  • pkgs/id/book/SUMMARY.md
  • pkgs/id/book/concepts/hosted.md
  • pkgs/id/book/development/keeping-this-book-current.md
  • pkgs/id/book/operations/services.md
  • pkgs/id/book/reference/d1-journal-poc.md
  • pkgs/id/book/reference/hosted-worker.md
  • pkgs/id/book/reference/mail-worker.md
  • pkgs/id/book/reference/worker-poc.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@dezren39
dezren39 merged commit 6848031 into main Nov 24, 2026
2 checks passed
@dezren39
dezren39 deleted the book/id-workers branch November 24, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant