Public: anyone can read this; the crew can change it.

A Worker-shaped hosted app under celld dev, measured against a Bun app: one example, one test, one table #16694

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This pull adds the example, the test and the "Measured" section, but I took no measurements. My sandbox refused github.com, so scripts/celld.ts couldn't fetch the pinned v0.6.1 binary, and esbuild isn't installed here either. The new test skips with that reason.

Notes

shipped production is serving it deploy 354c752

opened this

This pull adds the example, the test and the "Measured" section, but I took no measurements. My sandbox refused github.com, so scripts/celld.ts couldn't fetch the pinned v0.6.1 binary, and esbuild isn't installed here either. The new test skips with that reason. No celld ran, so nothing here has been run against a real binary.

What changed

  • Example: examples/celld-counter/ has a wrangler.json, a worker.js, a forge.json and a README.
    • worker.js is a SQLite-backed Durable Object counter. GET / renders the count on the server and POST / increments it. A POST whose Origin host differs from Host gets a 403.
    • Responses carry CSP, X-Content-Type-Options and Referrer-Policy.
    • forge.json run links .celld to $FORGE_APP_DATA/celld, then runs exec celld dev --port $PORT.
  • Test: test/celld-counter.test.ts boots the example through /bin/sh -c with the forge.json run, plus PORT, HOST and FORGE_APP_DATA in an explicit env. It asserts:
    • / answers with the headers.
    • A cross-origin POST is refused.
    • The count survives a stop and start.

    It reuses scripts/celld.ts and is not in the forge.json gate. I added it to scripts/test-honesty-allow.json for its wait loop. I ran bun scripts/gate.ts --fix and bun x tsc --noEmit; both were clean. I ran the new test file only, and it skipped.

  • Docs: docs/research/celld.md has a "Measured" section. Every cell in the table says "not measured". The section says why and how to fill it: run the test on a machine that can download the release, then time the same run command against a Bun hello app.

Left out

  • src/apps/* is untouched.
  • The .celld symlink is unverified. I found no flag to move celld's state directory. If celld refuses or resolves the symlink, state would land outside FORGE_APP_DATA. That would be the finding, and I did not work around it.
  • I also did not check that celld dev with no directory argument uses the working directory. I guessed it does.
  • The app's PATH would need celld on it, which a worker app kind would have to provide.

Recommendation: don't open a worker app kind yet. There are no numbers, and state placement is untested. Open it only if state lands inside FORGE_APP_DATA and idle RSS and cold start are within a small multiple of Bun's.

To try it: on a networked machine with esbuild on PATH, run bun test test/celld-counter.test.ts, then fill in the table.

Closes #491

3 earlier comments · 2 events
commented

This pull adds the example, the test and the "Measured" section, but I took no measurements. My sandbox refused github.com, so scripts/celld.ts couldn't fetch the pinned v0.6.1 binary, and esbuild isn't installed here either. The new test skips with that reason. No celld ran, so nothing here has been run against a real binary.

What changed

  • Example: examples/celld-counter/ has a wrangler.json, a worker.js, a forge.json and a README.
    • worker.js is a SQLite-backed Durable Object counter. GET / renders the count on the server and POST / increments it. A POST whose Origin host differs from Host gets a 403.
    • Responses carry CSP, X-Content-Type-Options and Referrer-Policy.
    • forge.json run links .celld to $FORGE_APP_DATA/celld, then runs exec celld dev --port $PORT.
  • Test: test/celld-counter.test.ts boots the example through /bin/sh -c with the forge.json run, plus PORT, HOST and FORGE_APP_DATA in an explicit env. It asserts:
    • / answers with the headers.
    • A cross-origin POST is refused.
    • The count survives a stop and start.

    It reuses scripts/celld.ts and is not in the forge.json gate. I added it to scripts/test-honesty-allow.json for its wait loop. I ran bun scripts/gate.ts --fix and bun x tsc --noEmit; both were clean. I ran the new test file only, and it skipped.

  • Docs: docs/research/celld.md has a "Measured" section. Every cell in the table says "not measured". The section says why and how to fill it: run the test on a machine that can download the release, then time the same run command against a Bun hello app.

Left out

  • src/apps/* is untouched.
  • The .celld symlink is unverified. I found no flag to move celld's state directory. If celld refuses or resolves the symlink, state would land outside FORGE_APP_DATA. That would be the finding, and I did not work around it.
  • I also did not check that celld dev with no directory argument uses the working directory. I guessed it does.
  • The app's PATH would need celld on it, which a worker app kind would have to provide.

Recommendation: don't open a worker app kind yet. There are no numbers, and state placement is untested. Open it only if state lands inside FORGE_APP_DATA and idle RSS and cold start are within a small multiple of Bun's.

To try it: on a networked machine with esbuild on PATH, run bun test test/celld-counter.test.ts, then fill in the table.

commented

The gate failed on a fixed wait and on duplicated helpers in test/celld-counter.test.ts. I fixed both and pushed. bun scripts/gate.ts and bun x tsc --noEmit pass here. I ran only test/celld-counter.test.ts and test/forge-cloudflare-celld.test.ts; both skip because the sandbox can't fetch celld, so the example itself is still never run.

  • Shared helper: test/helpers/celld_serve.ts now holds until, which waits for the booting server. Both celld tests use it, and I deleted their private copies.
  • freePort: the helper re-exports the forge's own freePort from src/apps/process.ts instead of defining another. src/apps/process.ts is not changed.
  • Real timer: the one sleep in until is marked // real-timer: a child process is booting; there is no clock to step.
  • Honesty allowance: in scripts/test-honesty-allow.json I removed the entries for the two celld tests and added one for the helper.

Nothing else changed. The "Measured" table in docs/research/celld.md is still all "not measured", and the recommendation stands: don't open a worker app kind yet.

Changes requested — before the latest push

The example worker is sound: same-origin POST check, the security headers, a server-rendered count. But box 4 is not met. The 'Measured' table is empty (every cell says 'not measured'), and the issue is a measurement. The recommendation is therefore a guess, and the core risk, where celld puts its state, is untested. Nothing here has run against a real celld, so boxes 1 and 3 are also unproven.

Fix first: get one run on a machine that can fetch the pinned v0.6.1 release and has esbuild. Fill the table with cold start to first 200, p50 and p99 over 1,000 GETs, and idle RSS and RSS after 1,000 requests, for the Bun hello app and for the example. If this run cannot reach GitHub, hand the measuring to a run that can, and do not land a table of blanks as the deliverable.

Also:

  1. The test 'survives a stop and start, in FORGE_APP_DATA' never checks FORGE_APP_DATA. After the restart, assert that data/celld holds files (and that .celld is a symlink to it). Otherwise a celld that resolved the symlink and wrote elsewhere would still pass.
  2. Verify that celld dev with no directory argument uses the working directory, and that it accepts the symlinked .celld. State the result in the README rather than 'not yet verified'.
  3. In scripts/test-honesty-allow.json, put the test/helpers/celld_serve.ts entry in alphabetical order (it belongs after test/footing, not before forge-origin-oauth).
  4. /healthz sends only nosniff. Send the same HEADERS, so every response carries the floor.
commented

I fixed three of the four small items. The measurement and the celld dev check are not done: this run cannot reach GitHub, so I could not fetch celld v0.6.1. esbuild is also missing here, so the celld-counter test skipped (5 skipped, 0 run). The change is not yet run against a real celld.

The measurement. The "Measured" table in docs/research/celld.md is still blank, and the recommendation is still "don't open a worker app kind yet", resting on a guess. The issue is a measurement, so this pull should not land as the deliverable. Someone has to run it on a machine that can fetch the pinned release and has esbuild. It needs cold start to first 200, p50 and p99 over 1,000 GETs, and idle RSS and RSS after 1,000 requests, for the Bun hello app and for the example.

Changed:

  • /healthz in examples/celld-counter/worker.js now sends the same HEADERS as every other response. The first test asserts the CSP and Referrer-Policy on /healthz too.
  • The restart test in test/celld-counter.test.ts now asserts three things after the restart:
    • .celld is a symlink.
    • It points at FORGE_APP_DATA/celld.
    • data/celld is non-empty.
  • test/helpers/celld_serve.ts is moved into scripts/test-honesty-allow.json in sorted order. It now sits between test/helpers/cell-probe.ts and test/helpers/checks-forge.ts, not directly after test/footing, which would break the sort.

Not done: I did not check that celld dev with no directory argument uses the working directory, or that it accepts the symlinked .celld. The README and research doc still say "unverified", now with the reason. The new test assertions are the check for the symlink and where state lands, once it can run.

gate.ts --fix and tsc --noEmit were clean.

[]
Approved

Since 35341c23b3af the only change is 1e2666374. My earlier asks are met: /healthz carries the same security headers as every other response and the test asserts them; the restart test asserts the .celld symlink and a non-empty data/celld; the honesty allow list is sorted. The example is small, same-origin POST is checked, headers are set, and src/apps/* is untouched. The pull is green.

The measurement was not done. The sandbox cannot reach GitHub, so no real celld has run, the Measured table is all 'not measured', and the test has only ever skipped. The doc says this plainly and the recommendation (don't open a worker kind yet) follows from it, so I would not hold the pull for it. It does leave box 4 open and the issue open.

Two things to do next: (1) run bun test test/celld-counter.test.ts on a machine with esbuild and GitHub access, and fix the test if the symlinked .celld or the no-argument celld dev behaves differently from the guess; (2) fill the table against a Bun hello app and revise the recommendation from the numbers.

commented

Left #491 open: 2 unticked items remain (test/celld-counter.test.ts boots the example the way src/apps/process.ts would: the same env and PORT. It asserts that / answers with the headers, that a cross-origin POST is refused, and that the count survives a stop and start. It skips with a reason when the binary is unavailable, and it stays out of the gate.; docs/research/celld.md gains a "Measured" table, comparing against a Bun hello app on the same machine: cold start to first 200, p50 and p99 over 1,000 GETs, RSS when idle, and RSS after 1,000 requests. The pull ends with a recommendation: open a worker app kind, or don't.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs