Repository navigation
docs: ×10 content (37→74 pages), three truth axes, first CI — plus 7 framework fixes writing them found - #16
Merged
Conversation
…umented or in a shrinking backlog Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…workflow - doc-example.ts generalizes the README quick-start extraction: any md fence, stubbed app-local imports, imported as a real module - pages/guide-stores.test.ts exercises the stores guide example end to end - packages/docs-tests joins the root test script; GitHub Actions runs bun test + typecheck on every push/PR Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…reate Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…s/**/README.md Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… the CLI - bin.ts resolves examples from the published package (embedded at release time, Brisa-style) or the workspace; rewrites workspace:* deps to real registry ranges and the package name - release.ts embeds examples/ into create-janux before bun publish - docs (Examples page, CLI reference, deployment guide, package README) lead with bun create janux … --example; starter descriptions now match what the template actually ships - docs tables: scroll instead of clip; inline code never splits mid-word Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
… skips without Postgres Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- landing drops the sidebar (Layout sidebar={false}), content centered
- header gains Docs/Playground links; footer credits the Brisa author
- mission/vision section: agent-written, human-reviewed, agent-operable
- mobile: minmax(0,1fr) on doc/faces/features/playground grids so long
<pre> lines scroll inside instead of widening the page; footer wraps;
pg-hint hidden — all 40 pages fit a 390px viewport (Playwright sweep)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ns row Copy and Run-in-playground now share a flex actions row (8px gap) instead of overlapping absolutes; mission section reformatted into three left-aligned pillars with centered lede/close for readability. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… a real @xyflow/react callback Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… this page Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…islands Two root causes behind the playground breaking on SPA visits (previously papered over with data-native links): - keepRuntimeStyles: the diff dropped runtime-injected <style>/<link> nodes (Monaco injects ~59 style tags on first import and never re-injects), so a revisited editor rendered with position:static view-lines scattered across the page — intermittently, depending on what the morph kept. Snapshot the live head before the swap and resurrect whatever it disconnected. - extractLeaving: mounted islands absent from the incoming page are removed BEFORE the diff, so their runtime DOM is never morphed against unrelated content; the post-diff sweep still owns disposal. Persisted islands keep the existing graft path; abort recovery reattaches both sets. fetchPage now hands applyPage the HTML text (prefetch already stored text), which also lets it scan incoming data-jx ids. data-native removed from the docs playground links — plain SPA navigation is now correct; the attribute stays as an escape hatch (navigation guide updated). Verified: 5 leave/revisit rounds in Chrome with geometric assertions (view-lines inside the editor box, position:absolute, styles alive) plus full-page screenshots; 457 unit tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…vity primitive
14 new pages (37 → 51):
- getting-started/{what-is-janux,quick-start,project-structure,mental-model,editor-setup}
— project-structure documents every convention slot the Vite plugin discovers
(middleware, matchers, i18n, src/api, stores, styles, favicon), previously
undocumented; mental-model includes a React→Janux map.
- reference/{signal,computed,watch,batch,untrack,owners} — the #1 documented
gap: the signals API had a single one-line mention. Each page states the
semantics its tests prove (Object.is dedupe, dynamic dependencies, one flush
per outermost batch, reverse-order cleanups, no zombie effects) and warns
that "effect" from janux is the component factory, not the signal primitive.
- reference/{every,parse-duration,create-bus} — refresh policies including
.orOn() chaining, the duration grammar, the event bus contract.
- guide/getting-started keeps its URL as the onramp index; the landing CTA and
header Docs link now point at the new quick start.
Tooling: export-coverage only counts code and headings now, so an English word
that happens to match an export ("every mutation is audited") no longer masks
an undocumented API — that immediately surfaced foreign() (guide-only, no
reference page), now tracked in the backlog. New
pages/reference-reactivity.test.ts executes the documented examples and
asserts every documented semantic.
Verified: 502 unit tests + typecheck green; all 52 doc pages render in Chrome
with breadcrumb/H1/TOC, no raw markdown leaks, no mobile overflow at 390px;
search finds the new pages.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two guide pages for what agents most need when generating views, none of it documented before: - guide/views-and-jsx — every prop and exactly what it becomes in HTML: class vs className, boolean/null/undefined attributes, escaping, dropped function props and invalid attribute names, void elements, dangerHTML, fragments and falsy children. Plus the full delegated-event table (on, intent, onInput, onChange, onKeyDown/Up, onFocus/Blur, onPointerDown/Up and the data-jxe-* markers each emits) and the fact that i18n rewrites internal <a> hrefs. - guide/keys-and-lists — the two different jobs keys do: list reconciliation (where an element's id also counts as a key) and island identity, where the key lands in the snapshot, the ui:// resource URI and the tool name, gets sanitized to [A-Za-z0-9_.-] and deduped to key~2 with a warning. pages/guide-views-and-jsx.test.ts asserts every claim against the real renderer — which corrected two of my own assumptions (delegation markers carry the island id: widget#default:inc; void elements render self-closing). Verified: 518 unit tests + typecheck green; both pages render with breadcrumb, grouped nav, TOC and no overflow at 1600px or 390px. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…to 20 Two reference pages that retire 12 backlog entries (janux/query and janux/interop are now empty; janux/client 19 → 14): - reference/data-cache-api — useQuery vs the query() primitive (and why the options getter is what makes the key reactive without thrashing a derived), the full mutation lifecycle with ctx flowing from onMutate to onError/onSuccess, every QueryClient method including dehydrate/hydrate for the per-request SSR client, and hashKey's object-key sorting. - reference/foreign — the whole ForeignOptions surface, all four hydrate directives and what each does to SSR, isForeignDef for code that walks a view tree, and why a foreign island is agent-opaque by default. pages/reference-data-cache.test.ts asserts the non-obvious claims: key-order independence, prefix invalidation (cart refreshes cart/summary but not catalog), direct set/get, SSR round-trip, and both mutation lifecycles. Verified: 532 unit tests + typecheck green; 56 doc pages render clean in Chrome (h1 + breadcrumb + no markdown leaks + no overflow) and search resolves hashKey, foreign, invalidateQueries and the new guide pages to heading anchors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… backlog empty - reference/client-state — persistStore (async-capable StateStorage, partialize, and the versioned envelope + migrate that stops a shipped rename from bricking a user's boot), urlState (schema-validated params that fall back instead of corrupting state, replace-by-default so filters don't spam history, popstate-aware) and dropzone (drag/drop + paste + click-to-pick, filtering before onFiles, reactive isOver, detach function). - reference/client-runtime — the embedding seams: the registry's maps including `mounting` (why a double click shares one instance instead of racing two), mountIsland/mountEagerIslands, performNavigation and its abort guarantee, prefetch's 30s single-use cache, the JanuxBridge behind window.janux, and the navigate tool: same-origin-only with the real link list returned on a hallucinated host, clicking the *visible* anchor, glowing it before moving. Plus toDomNodes/morph. janux/client is now empty in the backlog (19 → 0); 41 symbols left overall, all in @janux/agent, @janux/vite, @janux/cli and i18n — Wave C material. Verified: 537 unit tests + typecheck green; all 58 doc pages clean in Chrome, new pages fit 390px. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The embedded harness was the largest gap left: 19 exported APIs with only prose-level mentions. Each page documents the behavior that actually matters in production, read off the source: - agent-memory — createMemory's three methods (ensureThread fails closed with thread_forbidden when a resourceId doesn't match, so a guessed thread id can't leak a conversation), the nine-method HarnessStorage contract, and createPgStorage creating its own tables on first use with a dynamic pg import so apps that don't use it don't pay for it. - agent-guardrails — the InputProcessor contract and runProcessors' short-circuit, why unicodeNormalizer goes first (invisible codepoints a model reads and a reviewer doesn't), what historyTokenBudget never drops (system prompt, newest user turn), injectionGuard's warn→block rollout, and approxTokens being deliberately cheap and erring high. - agent-workflows — the suspend/resume shape where a step runs twice (ask, then record), why state lives only in storage between calls, and when a confirm-guarded intent is the simpler answer. - agent-rate-limit — the one-method CounterStore seam, the limiter failing OPEN by design, why the memory store is wrong behind a load balancer (N replicas = N x limit), and identityFor deciding who gets limited. - agent-mcp-client — lazy single initialize, per-user pool keys because the token differs per user, failure-evicts-the-entry so a remote restart self-heals, namespacing against tool collisions, and remote tool descriptions being untrusted input. - agent-attachments — att_N refs keeping payloads out of tool calls, the two independent size ceilings, all-or-nothing rejection, and mirroring the policy in dropzone while the server stays the authority. Verified: 558 unit tests + typecheck green; all 64 doc pages render clean in Chrome, new pages fit 390px. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… now EMPTY Three pages close the last 22 undocumented exports: - reference/i18n-api — getI18n (throws with the fix in the message when i18n isn't configured), translateCore for translating off-request with real Intl.PluralRules and recursive interpolation, selectMessages and why a page ships only its own strings (plus `declared` patterns for dynamically resolved keys — the fix when a raw key shows up in the browser), and formatElements for markup translators can move. - reference/build-internals — resolveAppConfig's precedence and mtime cache-buster, the api() stub pipeline that PARSES exports with SWC instead of executing the module (so server-only imports never enter the client graph), the Node<->Fetch adapters for mounting Janux inside Express/Connect, createHttpHandlers, renderNode, and scripting the CLI via runCli/parseArgs. - reference/client-tools — the six ui_* tools every app has (including ui_wait_settled, the one people forget), CLIENT_TOOL_NAMES as the generated-and-therefore-drift-proof way to tell a browser tool from an app intent, and the local model: DEFAULT_LOCAL_MODEL plus supportsLocalLlm for gating the UI instead of offering an option that fails. - schema-api gains a JxType section: the immutable type object, where .optional() returning a new type means a shared base can't leak a modifier. undocumented-exports.ts is now empty for all 12 public entries — adding an export without documenting it fails the suite. Also: long API names in headings wrap instead of pushing the # anchor past a 390px viewport (caught by the mobile sweep on agent-guardrails). Verified: 574 unit tests + typecheck green; 67 doc pages clean in Chrome, all 69 pages fit 390px. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The starter template ships a counter island and an agent panel; the tutorial told readers to delete a TaskBoard.tsx that never existed. It now says what the scaffold really contains and where the tutorial's component goes. Also switches the command to bun create janux. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…bar) The HTML shell links /src/styles.css as a stylesheet, but the dev server serves it as text/javascript with no charset — so a browser is free to decode the UTF-8 bytes as Latin-1 and the sidebar disclosure marker rendered as mojibake (â–¾ instead of ▾). Every non-ASCII content: value is now a CSS escape (\25BE, \25B8, \2026, \2014, \2191\2193), which is pure ASCII and decodes identically whatever the browser assumes; @charset declares utf-8 too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
recipes/forms.md documents the form-as-one-intent surface: intent={...} on the
form, FormData entries becoming the intent input, name being what matters, the
prevented default, absent checkboxes, and the agent calling the same intent
with no DOM involved.
The first draft claimed int() coerces the "42" a form submits. The recipe's
test proved it doesn't — int() rejects "42", bool() rejects "on", num()
rejects "1.5" — so the page now documents the real pattern (declare str(),
convert in run, or keep a numeric contract on a separate agent-facing intent)
and a test asserts the non-coercion so the claim can't drift back.
recipe-forms.test.ts also covers the data-jxform marker carrying the island
id, validation rejecting before run executes, enum option validation, and an
agent submitting the intent directly.
Verified: 584 unit tests + typecheck green; page renders with breadcrumb, TOC
and 4 code blocks; 70 pages fit 390px; sidebar markers correct.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The dev shell emitted <link rel="stylesheet" href="/src/styles.css">, but Vite serves that path as a JS module (text/javascript — that's how CSS HMR works). A stylesheet link pointing at a JS-typed response is a MIME mismatch the browser may refuse outright, and since the response carries no charset it may decode the UTF-8 bytes as Latin-1: non-ASCII content: glyphs rendered as mojibake (the sidebar disclosure marker showed as "â–¾" instead of "▾"). devStylesheets() now appends Vite's `?direct` query, which serves the compiled stylesheet itself as text/css. Extracted as a named export so the contract is unit-tested: plugin.test.ts asserts the ?direct URL, that an existing query is preserved, and the no-stylesheet case. Test written first and failing. Verified in Chrome: the link resolves as text/css, styles apply, the marker renders correctly, and SPA navigation still keeps the stylesheet alive. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…UTED Compiling a snippet proves it parses and imports real symbols. It does not prove the prose: a draft of recipes/forms.md claimed int() coerces the "42" a form submits — compiles, imports fine, and is false. Only running it caught that. page-coverage.test.ts closes the gap the same way export-coverage did. A page with a snippet that imports the framework must either be covered by a test in pages/ (declared by naming the page in a describe title, so coverage reads off the test itself) or be listed in untested-pages.ts. Stale backlog entries fail too, so the list can only shrink — and a NEW page can never be added without executing its examples. Current state: 39 pages make executable claims, 10 are executed, 32 tracked as pending (some pages are covered by a shared test, hence the arithmetic). That number is now visible in CI instead of being a matter of trust. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…s Phase 5 superseded README now maps the five sections with real entry points and states the verification property (every snippet compiled and import-checked, main examples executed, two coverage guards). PLAN-docs-redesign-x10.md gets a status note pointing Phase 5 at PLAN-docs-content-x10.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The documented island is extracted and driven for real: optimistic write, rollback on rejection, and settle-by-invalidation. The test also pins the trap the page warns about — setQueryData on a key nothing has read is a silent no-op, so the useQuery in the view is what makes the write land. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Intent pipeline (invalid_input / not_ready / forbidden, partial writes kept, audit with ok:false), the api() envelope status by status (400/403/404/500 and the client stub that drops the code), and janux:error on a corrupt snapshot. Two claims only a run could settle: a human is NOT blocked by a forbidden guard, and nothing rolls back the state written before a throw. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The recipe's promise is "your server, the whole app". Without a public way to resolve an app's conventions that meant copy-pasting the CLI's internals, so `prodServerOptions` — already used by `janux start` and prerendering — is now exported from @janux/cli and documented in reference/cli.md. The documented handler is extracted and driven with real Requests: static first, then delegation (api envelope, manifest, .md projection, 404), ctxFor, middleware reaching /_janux/*, and the node adapter round trip. One assertion pins the reason the ordering is yours: server.fetch never reads from disk. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The mutation example passed an updater callback (`(old) => [...old, vars]`). setQueryData takes the VALUE: the callback would have been stored AS the data, which the new test pins by asserting the entry becomes a function. Also fixed the invalidateQueries wording (it refetches matching entries whether or not anyone observes them — the source comment claimed otherwise too) and made the Sessions example a real importable module, so the reactive-key claim runs. Backlog: 32 → 31 untested pages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
reference/every.md documents `every('5m').orOn('a').orOn('b')`, but orOn
returned a plain policy with no orOn on it: the second call was a TypeError
(and didn't typecheck either). Made the builder recursively chainable — same
immutable-base guarantee, now real — and covered every() / onEvent() /
parseDuration with executable tests, including a source that really refreshes
when the event fires on the bus and a bad debounce that throws on attach.
Backlog: 31 → 29 untested pages.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…nterop is shipped The page still said React adapters were "on the roadmap": foreign() has landed, so both the React bullet and the honesty section now point at it and at examples/interop-react. Added four frameworks (Brisa facts checked against brisa.build, SvelteKit `csr = false` and SolidStart `"use server"` against their own docs) and replaced the 8-column matrix — which hid two columns behind a scroll with no affordance — with two transposed tables that fit whole. Verified in Chrome at 1440px and 390px: no clipped column, no page overflow. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A link that 404s teaches nothing, so links.test.ts now resolves every internal /docs link, every #anchor (with the renderer's own slugify), every app route and every GitHub tree path against what exists. It immediately found two dead anchors (#spa-navigation lives on guide/navigation, not ssr-and-resumability) and the README's stale page count, now guarded too. Also corrected three example rows that promised what the apps don't do: data-cache has no mutation() and no urlState (it syncs ?tag= by hand), interop-react uses no hydrate directive, and the i18n app never configured a static export. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…r the limit Closeout review of my own diff: the optimistic-ui tests leaned on the entry and server list left behind by the previous test (they'd fail run in isolation), so each one now seeds through the same path a mounted island uses. The error-handling test had grown past 200 lines, so the HTTP half moved to its own file — both still name the page, so coverage is unchanged. Also shortened two documented lines that overflowed their code block in Chrome (a `Task` alias instead of an inline generic, and a wrapped middleware arrow). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…three guards now Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A freshly scaffolded app could not build: `bun create janux my-app && bun run
build` died with "Rollup failed to resolve import react from
janux/src/client/foreign.ts". foreign() already imports React dynamically, but
Rollup resolves dynamic imports statically, so a bare `import('react')` in a
code path the app can never reach was enough to fail the bundle.
When the app root can't resolve react/react-dom they are now externalized: the
import expression survives in dead code. When it can (examples/interop-react),
nothing changes — that build still bundles react-dom.
Verified end to end on a real scaffold outside the repo: bun create → install →
build (51 KB client.js, no react chunk) → start → curl gets the SSR island,
/client.js, /styles.css and a manifest with counter.inc/dec/reset.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Docker: a real image, built and curled outside the repo. The numbers in the
page are measured, not estimated — 425 MB with a .dockerignore against 523 MB
without it (98 MB of macOS binaries; it does NOT break the build, which is what
I assumed before testing), and 421 MB for a multi-stage variant, which is why
the page tells you to skip that complexity. Two things only a run could teach:
oven/bun:*-slim ships no curl or wget, so a `CMD curl -f` healthcheck fails
100% of the time (the page's bun-based one reports `healthy`), and
`--production --frozen-lockfile` does work on the scaffold.
deploying.md's Dockerfile — never verified, no .dockerignore, no healthcheck —
is now a pointer to the recipe. One Dockerfile, one place to rot.
Monorepo: a real workspace with apps/web plus a shared packages/ui. Verified by
running it: the shared island SSRs as janux-island, its intent marker is in the
HTML and the manifest exposes toggle.flip / ui://toggle. The claim worth the
Chrome trip is the failure mode — with the island in boot({ defs }) a click
flips off→on; without it the click does nothing. Also verified: `janux build`
from the repo root exits 0 saying "nothing to bundle — fully static app",
and a shared package's *.api.ts is never discovered (the page's example
imported schema/str from @janux/server, which doesn't export them — fixed).
Tests: the monorepo page runs its own fences (static component, api namespacing,
the boot-registration failure mode); the docker page can't build an image in CI,
so its test pins the claims that rot instead — the scripts it invokes exist in
the template, the framework packages stay runtime deps, the env vars are the
ones model.ts reads, and the healthcheck never regresses to curl.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… approval
Found by the layer-3 eval this wave adds, with a real model: asked to pay 5999
cents, gemini-flash-lite answered "I've paid 5999 cents and your order ID is
ord_j85u9s" — for an api() declared `guard: 'confirm'`.
The proposal logic lived only in handleApi (the HTTP door). `invokeTool` — the
seam the copilot loop AND the hosted MCP endpoint share — called invokeApi with
origin 'agent' and no confirm gate, so the tool just ran. The MCP path was worse
than silent: tools/list advertises `annotations.requiresApproval` and tools/call
executed anyway.
Extracted the proposal registration both doors now share. Docs needed no change
— guide/agent-and-copilot.md already promised "the copilot can propose checkout,
but a human approves it on the UI"; the code didn't.
Verified twice: a unit test that fails before the change (charge recorded, no
proposal) and the same real-model prompt afterwards, where the tool result is
{"status":"proposal","id":"prop_api_2"} and the model asks for confirmation.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Layer 1 (scripted model, no key): the page's own `reply`/`scriptedServer`
helpers are extracted by the test and drive the real loop, so the snippet can't
rot. Layer 2 (no secrets): `janux verify` and `janux eval --start` ran green
against examples/shop — four steps including the human-approval hop; the page
quotes the real CLI output. Layer 3 (real model): ran against a live shop with
openrouter/google/gemini-2.5-flash-lite, and it earned its keep immediately —
the confirm-guard bypass fixed in the previous commit is what it found.
examples/shop/model-evals is that layer as a real, gated test: it skips unless
BOTH a key and a live EVAL_URL are present (verified both ways — 2 pass with
them, 2 skip without), so `bun test` stays green for everyone else.
Two numbers the page reports because I measured them, not guessed:
- the same prompt gave different tool choices across runs, which is why layer 3
never gates a merge and retries before believing a failure;
- `api.shop.catalog` said what it WAS ("List products with prices"), and a small
model answered from memory instead of calling it. Rewritten to say when to
reach for it, the same prompt called it on 5 of 5 runs. That description
change ships here too — it's the actionable output of a layer-3 signal.
The page test also caught the recipe lying: it told readers to assert a proposal
with JSON.stringify(...).toContain('"status":"proposal"'), which never matches
because a tool result travels as a JSON *string*. Both now parse it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
recipes/auth-and-context.md said "the CLI wires this from src/server if you export it". Nothing did: there was no ctxFor convention anywhere, so a scaffolded app could not build a per-request ctx — no session, no tenant, no role — without writing its own server. The page promised the right thing; the code was missing. `src/ctx.ts` now default-exports `(req) => ctx`, resolved exactly like src/middleware.ts and src/matchers.ts, and wired in both directions: the Vite plugin for `janux dev` and prodServerOptions for `janux start`. Verified on a scaffolded app outside the repo, both modes: a route reading ctx.userId renders `null` with no header and `ada` with `x-user: ada` under `janux start`, and `grace` under `janux dev`. The page now documents the convention, and its test asserts the rest of what it claims: ctx reaches routes and api() alike per request, guards resolve per ctx (admin's agent refunds unattended, a guest's proposes), and a forbidden tool disappears from that context's manifest. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…lossary
Every page audited against the code, not from memory. What was wrong:
- tutorial 3 described the starter's AgentPanel as a ~100-line copilot that
POSTs /_janux/agent. It is a 150-line manifest inspector that never talks to
the agent endpoint; the chat lives in examples/shop's Copilot (174 lines).
- faq said i18n was "your strings, your call" (there is a full i18n system) and
that the agent loop is "deliberately small" with the memory/RAG story pending
(defineAgent({ harness }) ships memory, processors, rate limits; workflows,
attachments and MCP clients sit alongside).
- deploying's static-export tree listed llms.txt unconditionally; it appears
only when llmsTxt is configured (checked by building examples/i18n statically:
6 prerendered pages, per-locale, no llms.txt without the config).
- glossary was missing eight terms the docs now use (foreign island, harness,
WebMCP, hosted MCP endpoint, llms.txt, query cache, urlState, matcher).
Harness gap found while auditing: the fence regex required a newline right after
the language, so ` ```tsx live ` — the corpus' only flagged fence, and the one
readers can press Run on — was invisible to the snippet compiler, to docExample
and to the page-coverage guard. All three now accept flags (a flag needs
whitespace, so ```json still isn't mistaken for js). That immediately demanded a
test for recipes/tailwind.md, which is now covered.
Seven new page tests (tutorial ×3, testing-components, local-model-copilot,
deploying, cross-island-events, external-mcp-clients + debugging-webmcp,
tailwind) — backlog 29 → 23 pages. Tailwind's build pipeline is the one claim a
unit test can't reach, so it was verified for real on a scaffolded app: install
→ `@import "@janux/tailwind"` → `janux build` emitted a 4.5 kB styles.css with
the five utilities used, the author's CSS below the import intact, and unused
utilities purged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…have Found while running the plan's own closeout step — building the docs site with output: "static" and serving dist/client from a dumb static server. Every single page fetched /_janux/manifest and got a 404: the HTML shell links it unconditionally, and on a static host /_janux/* does not exist by design. Harmless (routeTools() was already fail-soft) but wrong: a console error on every page of every static deploy, this docs site included. `staticExport: true` (set by the CLI when output is "static") omits the link, and the client treats the link's absence as "there is no server to ask" instead of guessing. The framework's WebMCP tests now use the real shell markup, since that link is what they were implicitly relying on. Verified: rebuilt the 76-page static export and re-ran the browser sweep — zero failed requests, while search (static index), the copy button, prev/next and llms.txt all still work with no server at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ses it The example synced `?tag=` by hand with typeof-location guards. That wasn't laziness: `urlState()` read `location.search` eagerly, so calling it from an island's view threw "location is not defined" during SSR. It now yields the fallback with no location — the server renders the fallback and the island corrects itself on mount, which is what query-only state means here. examples/data-cache is now what its docs row promised: one typed binding per island (keyed by state, like useQuery's handle), a tracked `effect` whose `when` reads the URL signal so deep links and the Back button flow into state, and `replace: false` so each filter is a history entry. Verified in Chrome against the live example: ?tag=display deep-links to a filtered list, clicking a tag rewrites the URL with no page navigation, Back restores the previous filter, ui://catalog reports the same tag the user sees, and the console stays clean. My first expectation was wrong, not the code — Back did nothing until the example opted out of the default replaceState. Also: the layer-3 model evals are a script now, not a permanently-skipped test. `bun test` reports 738 pass / 0 skip; `bun model-evals/run.ts` exits 1 with a clear message when the key or URL is missing (both paths verified). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
reference/watch.md opens with `watch(() => document.title = \`${count.value} items\`)`.
That arrow returns a string, and `effect()` stored whatever came back as the
cleanup — so the next run (and dispose) called it: "cleanup is not a function".
The component effect path already guarded this; the signal-level one didn't.
Found by writing the page's own test: three of its four documented guarantees
passed, and the two examples with an implicit return crashed.
Backlog: 23 → 21 pages (watch, create-bus).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
reference/client-state.md promises "without [migrate], incompatible payloads are dropped rather than crashing your boot". The code did the opposite: with no migrate it applied the old payload anyway, so a shipped rename left users booting with state this code no longer understands — the exact failure the sentence promises to prevent. Found by asserting that table row. Backlog: 21 → 20 pages (client-state, with persistStore/urlState/dropzone all executed: the versioned envelope, replace-vs-push, popstate re-reads, and dropzone's filters never firing onFiles with an empty list). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tes it Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Four more pages off the backlog (17 → 15), asserting what each page actually
promises: both schema tables row by row (projection + zero value, and the
missing-value precedence), the three rules guide/components says are enforced
plus nested-island identity, api()'s three projections (endpoint validating in
AND out, the SWC stub that leaves no server code behind, the manifest tool with
its confirm/approve cycle), and the whole HTTP handler protocol — segment
grammar, the { req, params, ctx, url } bag, 405 + Allow, HEAD→GET, multipart.
Two of my own assumptions were wrong, not the docs: buildDefault gives an
optional field its zero value (not undefined), and the persist envelope is
{ v, s }.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
i18n (guide + reference): real Intl.PluralRules categories in Polish, the interpolation delimiters, allowEmptyStrings, selectMessages shipping only used keys plus declared i18nKeys, formatElements, and the routing rules (302 to a detected locale, JANUX_LOCALE cookie winning over accept-language). Interop (guide + foreign): a real React component server-rendered inside its host, the frozen ForeignDef with its documented defaults, and the page's central promise — a foreign island contributes no tools and no resource, so the shell is what an agent drives. Two of my assumptions were wrong again, not the docs: translateCore has no cross-locale fallback (the fallback option is a list of KEYS) and a message tree needs returnObjects — which the guide documents and the reference bullet did not, now qualified. Also documented that foreign SSR is fail-soft, since a throwing props mapper silently ships an empty host (that is how I found my fixture bug). Backlog: 15 → 11 pages.
…nature agent-memory, agent-rate-limit, agent-attachments, agent-workflows and agent-mcp-client are mostly tables of defaults and failure codes: every default and every code now runs. The guarantees worth pinning: memory throws thread_forbidden on a foreign thread id, the rate limiter fails OPEN when its store throws (cost control degrades, the copilot stays up), a workflow suspends and resumes on a DIFFERENT runner from storage alone, and remote MCP tools are namespaced going in and bare on the wire. Doc bug found: agent-workflows showed `runner.resume(started.runId, …)`. The real signature takes the definition first, so that snippet threw for anyone who copied it. Fixed, plus a line about the two ways resume refuses. Two harness guards also got sharper: the stale "runnable > covered" sanity check (coverage overtook it) is now an invariant that can't rot, and page coverage no longer counts a bare `x/y.md` string — a test fetching http://test/pricing.md was inflating the covered set. Backlog: 11 → 6 pages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The last six: client-api and client-tools (the six built-in tools, the bridge's methods, the janux:tool-call/proposal events and a real delegated click through boot()), agent-and-copilot (setup card, api.* executed server-side, ui.* handed back, maxTurns, the tools.include allowlist, and a forbidden api never offered), plus cli, build-internals and project-structure (every conventional path resolved from a real temp app, janux.config precedence, the SWC stub pipeline and the Node⇄Fetch adapters). untested-pages.ts is now empty and page-coverage asserts it stays that way, so a new page with runnable examples can only ship with a test or a deliberate, visible entry in that list. Three of my own assumptions were wrong again, not the docs: CLIENT_TOOL_SPECS live on the janux root (as the page says), the built-in ui_* tools are always offered alongside app tools, and the eval-grammar helpers are internals — that grammar is covered by the CLI's own tests and the real `janux eval` run. 856 tests, 0 skipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The snapshot-scripts + manifest-link block was repeated in two page tests and about to be repeated in a third. It now lives in one fixture, which also keeps the manifest-link requirement (what tells the client there IS a server to ask) in a single place. The monorepo test boots with webmcp: false — WebMCP isn't what that page claims, and leaving it on only made boot() fetch a manifest no test server serves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The badge said 630+; `bun test` reports 856 passing and 0 skipped, and `bun test packages` — the command the line below the badge shows — reports 823. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Executes the pending Phase 5 of the docs redesign, plus the tooling that keeps it honest. 37 → 74 pages.
The property this PR buys
Three guards make the docs verifiable rather than aspirational, and all three backlogs are empty:
packages/docs-tests/pages/that runs it and asserts the documented semantics.untested-pages.tsstarted at 32 pages and is now empty; a new page can only ship with a test or a deliberate, visible entry in that list.links.test.tsresolves every internal/docslink, every#anchor(with the renderer's own slugify), every app route and every GitHub tree path — and the README's page count.The pattern that repeats: writing a test for a page turns prose into a question the runtime answers. Sometimes the prose was wrong; sometimes the code was; often my own assumption was. Each is noted in the test that settled it.
Content
getting-started/(5): what-is-janux, quick-start, project-structure, mental-model (with a React→Janux map), editor-setup.optimistic-ui,error-handling,custom-server,docker,monorepo-setup,agent-evals-in-ci,forms. Plus a refresh of the 8 existing recipes, the tutorial,faq,glossary, and an expandedcomparison(Brisa, SvelteKit, Nuxt, SolidStart; the 8-column matrix that hid two columns behind a scroll is now two tables that fit).Product & UX
bun create janux my-appis the canonical command, in a copy pill; every code block has a copy button.--example <name>scaffolds anyexamples/app from the CLI.bun test+ typecheck on every push/PR.Framework changes writing the docs found these
Behavior changes, each with a test that fails before the fix:
fix(server): the copilot loop ranconfirm-guardedapi()tools without approval. The proposal logic lived only in the HTTP door;invokeTool— shared by the copilot loop and the hosted MCP endpoint, which advertisesannotations.requiresApproval— executed instead. Found by a real model eval answering "I've paid 5999 cents" for a tool that must be approved.fix(vite):janux buildno longer needs React installed. A freshly scaffolded app couldn't build (Rollup failed to resolve import "react"fromforeign.ts). Listed as pre-existing in this PR's earlier description; fixed here.fix(signals):watch()treated any return value as a cleanup. The documented one-linerwatch(() => document.title = …)returns a string and crashed on the next run. Also previously listed as pre-existing.fix(persist): a payload from anotherversionis dropped when there's nomigrate, asclient-statealways promised. It was being applied instead.fix(client):urlState()no longer crashes SSR. It readlocationeagerly, so calling it from a view threw — which is whyexamples/data-cachehand-rolled its?tag=sync. That example now usesurlStatefor real (deep link, Back button and agent parity verified in Chrome).fix(static): a static export stops advertising endpoints it doesn't have. Every page of every static deploy fetched/_janux/manifestand got a 404;staticExportomits the link and the client treats its absence as "there's no server to ask".fix(core):every().orOn().orOn()— chaining the reference page documents, which threw a TypeError.feat(config):src/ctx.ts— the per-requestctxconventionauth-and-contextclaimed existed. It didn't: a scaffolded app couldn't do auth without writing its own server. Wired throughjanux devandjanux start, verified on a real scaffold.feat(cli):prodServerOptionsis exported, so the custom-server recipe doesn't ask you to copy the CLI's internals.Verification
856 tests + 7 e2e, 0 failures, 0 skipped; typecheck green. Beyond the suite:
<h1>, zero failed requests and zero console errors from a dumbpython3 -m http.server, with ⌘K search, the copy button, prev/next andllms.txtall working.healthyhealthcheck, endpoints 200, and measured sizes (425 MB, 523 MB without a.dockerignore, 421 MB multi-stage, which is why the page says skip it).packages/ui; a click on the shared island flips it only when registered inboot({ defs }).janux verify+janux evalgreen with zero secrets; the layer-3 model eval run against a live app withopenrouter/google/gemini-2.5-flash-lite(that's what found the HIL bypass). It ships as an explicit runner, not a permanently-skipped test.Not in this PR
agent-evals-in-cidocuments are not wired here: the PR-level one (verify+eval) needs no secrets and would be direct dogfooding; the nightly model eval needsOPENROUTER_API_KEYin repo secrets.🤖 Generated with Claude Code