Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/deps-issue-115.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@cloudhal/api": patch
"@cloudhal/cloudflare": patch
"@cloudhal/core-ts": patch
"@cloudhal/schedules": patch
"@cloudhal/astro-renderer": patch
"@cloudhal/cli": patch
---

Dependency patch updates (#115). `@cloudhal/api` depends on Better Auth 1.7.12 and on exactly the versions it uses itself: `@better-auth/core` and `@better-auth/api-key` 1.7.12, `@better-auth/utils` 0.5.0 and `better-call` 1.4.4. `@cloudhal/cloudflare` asks for zod ^4.6.7 (GHSA-mrhx-c7xc-m3w5 is fixed in 4.6.6). `@cloudhal/core-ts` and `@cloudhal/astro-renderer` use marked ^18.1.1. `@cloudhal/core-ts` and `@cloudhal/schedules` use temporal-polyfill 1.0.6. `@cloudhal/astro-renderer` uses vite ^8.3.5. The Studio shipped in `@cloudhal/cli` is built with React 19.3.1, TanStack Router 1.170.46 and TanStack Query 5.104.5. marked 18.1.1 splits a few unusual markdown inputs differently: a blockquote ends before an unquoted line that follows a heading, rule or HTML block, and indented HTML blocks interrupt a paragraph. A stored body like that keeps rendering and shows virtual block ids until its next write.
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pnpm i18n:export / pnpm i18n:import [--locale xx] # translations as nested ICU
12. **Size ratchet** ([docs/engineering/code-structure.md](docs/engineering/code-structure.md)): files ≤ 800 lines (soft 400; `.astro` 500, tests 1500; i18n dictionaries are data and exempt — the Studio bundle budget guards them), functions ≤ 150 lines, depth ≤ 5, ≤ 4 positional params (use an options object beyond 3); one responsibility per module, dispatch tables instead of giant switches. `pnpm size:check` (in `pnpm check`) fails on a new violation or when a file in `scripts/size-baseline.json` grows — put new code in a new module next to it; after shrinking one, run `node scripts/size-check.ts --update`.

## Versions (pinned via pnpm catalog / Cargo workspace)
Node 24 · pnpm 12 · TypeScript 7.0 · Biome 2.5 · Vitest 5 · Turborepo 2.11 · Rust 2024 edition · json-schema-to-typescript 16.0.0 · cargo-typify 0.8.0 · ajv 8.20 · jsonschema 0.59 · better-sqlite3 13 · miniflare 4.20260730 (last stable 4.x; see ADR-0012) · wrangler 4.148 · @astrojs/cloudflare 14.3 · Astro 7.3 · Tailwind 4.3 · marked 18 · Hono 4.13 · Better Auth 1.7.7 · Kumo 2.14 · React 19.3 · TanStack Router 1.170 / Query 5.104 · Vite 8.3.
Node 24 · pnpm 12 · TypeScript 7.0 · Biome 2.5 · Vitest 5 · Turborepo 2.11 · Rust 2024 edition · json-schema-to-typescript 16.0.0 · cargo-typify 0.8.0 · ajv 8.20 · jsonschema 0.59 · better-sqlite3 13 · miniflare 4.20260730 (last stable 4.x; its sharp overridden to 0.35.5; see ADR-0012) · wrangler 4.148 · @astrojs/cloudflare 14.3 · Astro 7.3 · Tailwind 4.3 · marked 18 · Hono 4.13 · Better Auth 1.7.12 · Kumo 2.14 · React 19.3 · TanStack Router 1.170 / Query 5.104 · Vite 8.3.

## When unsure
Read `docs/adr/README.md` and the relevant ADR; each ADR links its primary sources. If the change alters a contract or a public interface, write an RFC first (`.agents/skills/write-rfc`).
Expand All @@ -70,5 +70,5 @@ Turborepo configuration, task behavior, and CLI commands can vary between instal

Read `docs/README.md` inside that installed package first, then read the relevant pages from its `docs/` directory before changing Turborepo configuration or commands. Heed deprecation notices. These bundled docs match the installed package version and are available without network access.

This block is written and re-added by `turbo` before repository-scoped commands when an AI agent is detected. In the Turborepo source repository, its template is defined in `crates/turborepo-cli/src/cli/agent_guidance.rs`. Removing the managed block while updates are enabled means a later qualifying invocation will add it again. Set `"agentGuidance": false` in the root `turbo.json` or `turbo.jsonc` to opt out; this does not remove an existing block. Keep the block committed with your work to avoid an uncommitted change on the next agent invocation.
This block is written and re-added by `turbo` before repository-scoped commands when an AI agent is detected. In the Turborepo source repository, its template is defined in `crates/turborepo-cli/src/cli/agent_guidance.rs`. Removing the managed block while updates are enabled means a later qualifying invocation will add it again. Set `"agentGuidance": true` in the root `turbo.json` or `turbo.jsonc` to opt in; this does not remove an existing block. Keep the block committed with your work to avoid an uncommitted change on the next agent invocation.
<!-- END:turborepo-agent-rules -->
3 changes: 3 additions & 0 deletions apps/studio/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ export default defineConfig({
// Dialog/menu flows take ~0.5 s alone but several seconds when the whole monorepo tests in
// parallel (turbo); 5 s made them flaky.
testTimeout: 20_000,
// Vitest ≥5.0.4 caches transformed modules on disk by default. Its key does not cover the
// catalogs() plugin's code (packages/messages), so a compiler change could test stale catalogs.
fsModuleCache: false,
},
});
10 changes: 10 additions & 0 deletions docs/adr/0012-cloudflare-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ Studio needs nothing extra, because Better Auth's base URL is the request origin

## Addendum (2026-10-08): purging what changed
Publish and rollback no longer purge the whole cache. `onPublished` receives the snapshot that was live and the new one; `SiteGraphStore.planCachePurge` turns their diff into Cloudhal cache tags (`cloudhal-node-`, `-term-`, `-list-`, or the site tag for structure — RFC-0002, follow-up notes), and the admin Worker sends them to the site Worker in requests of at most 100 tags, Cloudflare's limit per tag purge. Workers Cache always uses the Free-tier purge rate limit (5 requests per minute, bursts of 25), so one publish spends at most three requests and otherwise sends one "purge everything", which is also the fallback for a first publish, an unreadable or too large diff, and a failed tag purge. Sources: https://developers.cloudflare.com/workers/cache/purge/ · https://developers.cloudflare.com/cache/how-to/purge-cache/#hostname-tag-prefix-url-and-purge-everything-limits (checked 2026-10-08).

## Addendum (2026-10-25): Miniflare's pinned sharp and undici

Decision 6 pins the direct `miniflare` devDependency (the D1, R2 and Durable Object harnesses of `@cloudhal/storage/testing` and the packages that test with them). Wrangler brings its own Miniflare: wrangler 4.148.0 and `@cloudflare/vite-plugin` 1.63.0 (through `@astrojs/cloudflare`) run Miniflare 5.20261006.0-alpha, which that pin does not cover.

- **sharp.** Every Miniflare release pins sharp exactly. 4.20260730.0, still Miniflare's npm `latest`, pins 0.35.2, and the 5.20261006.0 alpha pins 0.35.4. Both are below 0.35.5, the fix for GHSA-wq5f-xc86-pv6w (librsvg), and 0.35.2 is also below 0.35.4, the fix for GHSA-rgj7-g3m4-5g8c (libheif). Miniflare loads sharp only for its Images binding and its `cf.image` fetch mock. Cloudhal configures no Images binding and makes no `cf.image` fetches: the `/cdn-cgi/image/` URLs from `@cloudhal/astro-renderer` are resolved at the edge. `pnpm-workspace.yaml` therefore overrides `sharp@<0.35.5` to exactly 0.35.5. That version was already in the lockfile through Astro, and the calls Miniflare makes behave the same on 0.35.2, 0.35.4 and 0.35.5 (checked locally on 2026-10-25). Overrides are not published. A project that uses `@cloudhal/storage/testing` with Miniflare 4 keeps Miniflare's sharp unless it adds the same override. A new project resolves the starter's `wrangler ^4.148.0` to a release whose Miniflare pins 0.35.5. Remove the override when `pnpm why -r sharp` shows nothing below 0.35.5 without it.
- **wrangler** stays at 4.148.0 in this change. 4.152 is a minor move: it changes the Miniflare under `createTestHarness` (5.20261019.2-beta), needs `@cloudflare/vite-plugin` 1.65 and `@cloudflare/workers-types` ≥ 5.20261019.1, and uploads source maps on deploy by default (4.150). It gets its own change, verified with the CLI's Cloudflare suites.
- **undici.** The undici versions Miniflare pins (7.28.0 in 4.20260730.0, 7.29.1 in the 5.x alpha) are accepted for local development and tests: Miniflare uses undici to reach its own workerd on localhost and, outside tests, to fetch Cloudflare's `cf.json` from workers.cloudflare.com, a trusted endpoint (set `CLOUDFLARE_CF_FETCH_ENABLED=false` to turn that off). The fixed 7.30.1 is a minor move inside `dispatchFetch`, which the D1 harness and Miniflare's binding proxy depend on (the Durable Object harness bypasses it since #116), so an override waits for its own serial test run.

Sources: https://github.com/advisories/GHSA-wq5f-xc86-pv6w · https://github.com/advisories/GHSA-rgj7-g3m4-5g8c · https://pnpm.io/settings#overrides · `npm view miniflare dist-tags`, `npm view sharp time`, `npm view wrangler time` (checked 2026-10-25) · Miniflare 4.20260730.0 `dist/src/index.js` (`imagesLocalFetcher`, `cfImageLocalFetcher`, `setupCf`).
29 changes: 29 additions & 0 deletions packages/api/test/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ for (const backend of backends) {
).status,
).toBe(401);
});

it("change-password with revokeOtherSessions ends the other sessions (Better Auth runs it in a transaction on SQLite since 1.7.8)", async () => {
const token = (res: Response) =>
(res.headers.get("set-cookie") ?? "").match(/better-auth\.session_token=[^;]+/)?.[0] ?? "";
const signIn = (password: string) =>
app.request("/api/auth/sign-in/email", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ email: "[email protected]", password }),
});
const here = token(await signIn("correct horse battery"));
const other = token(await signIn("correct horse battery"));
const changed = await app.request("/api/auth/change-password", {
method: "POST",
headers: { "content-type": "application/json", cookie: here },
body: JSON.stringify({
currentPassword: "correct horse battery",
newPassword: "a brand new passphrase",
revokeOtherSessions: true,
}),
});
expect(changed.status, await changed.clone().text()).toBe(200);
const fresh = token(changed);
expect(fresh).not.toBe("");
expect((await app.request("/api/me", { headers: { cookie: fresh } })).status).toBe(200);
expect((await app.request("/api/me", { headers: { cookie: other } })).status).toBe(401);
expect((await signIn("correct horse battery")).status).toBe(401);
expect((await signIn("a brand new passphrase")).status).toBe(200);
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@cloudhal/mcp-server": "workspace:*",
"@cloudhal/schedules": "workspace:*",
"@cloudhal/storage": "workspace:*",
"zod": "^4.6.5"
"zod": "^4.6.7"
},
"devDependencies": {
"@cloudflare/workers-types": "catalog:",
Expand Down
Loading
Loading