The table
What mounts these is the Worker contract, what contributes them is a capability, adding a route is where you first read one, and c.error is errors.
c.var. | Type | Uncomposed value |
|---|---|---|
auth | AuthContext | null | null |
actingOrganization | ActingOrganizationResolver | A resolver that answers null |
locale | LocaleContext | null | null |
t | Translator | A real translator over baked English |
moderator | TextModerator | A real moderator over the shipped blocklist |
publicIdentity | PublicIdentity | handles: false, and every lookup answers nobody |
controlPlane | ControlPlaneContext | null | null |
controlPlaneVerifier | ControlPlaneVerifier | null | null — which makes admin routes deny |
sameOrigin | SameOriginGate | null | null |
emit | AuditEmit | A no-op recorder |
entitlements | EntitlementResolver | A resolver that holds nothing — so every gate 403s |
log | Logger | A real per-request logger |
db | The D1 registry | |
kv | The KV registry | |
workflows | The job dispatcher |
Five are zero-config, and nothing null-checks them
t, moderator, publicIdentity, log and emit.
With no i18n composed, t is a translator over the baked English every composed capability contributed — which is why a project that never opts in behaves byte for byte as it did before.
With no moderation block in the Worker’s pithy.config.ts, moderator checks the blocklist the kit ships, folded for case, width, accents and look-alike characters. Config extends the list or replaces the moderator, and a moderator that throws or runs out of time answers review, never allow. Moderation has the rest.
With no public handles composed, publicIdentity says so: handles is false, and handlesOf(userIds) answers an empty map. auth({ handles: true }) fills it, and then one handlesOf call resolves a whole page of user ids to the handles their owners typed, leaving out any id with none. A capability reads handles here and never from auth, and checks handles to tell this Worker has no handles from this player has none — which is how a leaderboard read leaves the field out in the first case and answers null in the second. Giving players a public handle has the rest.
With no audit composed, emit is a no-op. Non-fatal by contract — it never throws, so an audited action is never broken by an audit write.
One default denies, and that is the exception
entitlements.
A missing audit write cannot grant access. A missing entitlement check can.
So with no provider composed the resolver holds nothing and every gate answers 403, rather than passing because the thing meant to check it is absent.
The same reasoning makes controlPlaneVerifier null rather than permissive: that null is what makes a capability’s admin routes deny in a Worker that never enabled the seam.
auth and controlPlane are two seams on purpose
A management client is not a user of your app. It holds no session and owns no user row.
auth is narrowed past requireAuth()
A handler chained after requireAuth() on the same route reads auth as AuthContext, never null. The guard’s type is SignedInEnv, exported from @pithy-sh/auth, and Hono intersects it with the app’s env for every handler after it. A separate app.use(path, requireAuth()) refuses the same requests and narrows nothing. Protecting a route has the helper typing and requireAuthUnnarrowed().
actingOrganization is a resolver, read on demand
Which organization this request acts for, and what the caller’s role there allows. @pithy-sh/organization’s middleware fills it. Read it with await c.var.actingOrganization(): resolving it is a D1 read most requests never need. With no organization capability composed it answers null, so nothing is in force and every rule that admits by organization admits nobody.
A seam beside auth, never a field on it. auth says who is signed in; this says what they may do here, and a capability that gates on it, such as media or storage, never imports the capability that computes it.
locale versus t
Read t to render a string. Read locale when you need the tags themselves — lang and dir on a document, or the locale stamped onto an email job’s row.
null means nothing was negotiated, which is a different fact from the default was chosen.
LocaleContext carries three: the catalog locale (which falls back), the formatting locale (which does not), and the direction.
sameOrigin is published already bound
Bound to this Worker’s trusted origins by the capability that resolved them. Read it through requireSameOrigin(), which takes no argument.
A bound gate rather than the origin list, deliberately. Handing over the list is how a Worker ends up with two same-origin implementations free to disagree — and the weaker one is then its real policy.
log carries what a client must not see
It carries PithyError detail — the inverse of what the HTTP codec does.
Never wire it to a client surface.
Derive a namespaced child with c.var.log.child("<capability>"). Every record already carries request correlation — the request id, method, path, environment and version.
db, kv and workflows are loosely typed on the base seam
Deliberately — the precise types depend on which capabilities are composed, and createBackend’s return narrows all three.
Inside a capability, cast to the registry your schema names.
c.var.db.app // your database
c.var.kv.sessions // your namespace
c.var.workflows.trigger("media/image-to-text", { id })None of them needs a conditional
An uncomposed seam is present and inert, not absent.
c.var.emit(...) from a project with no audit capability is a call that does nothing — not a crash, and not a branch you have to write.