Repository navigation
prototype(tier2): patchy init --tier 2, server/, dev on the engine and a two-artifact publish - #380
Closed
allisonmahmood wants to merge 14 commits into
Closed
allisonmahmood wants to merge 14 commits into
allisonmahmood wants to merge 14 commits into
Conversation
…artifact publish PROTOTYPE for #314. New packages/execution (workerd loader, Engine service, server.call handler), handler descriptors and the server.call operation on the wire, patchy/server builders with t.object/array/enum/nullable/row, the server bundle build with the import check, tier 2 publish storing a second object and re-deriving the handler map, tier 2 init scaffold and the patchy-server skill. Dev runtime wiring follows. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…scaffold typechecks PROTOTYPE for #314. Infer matches descriptor shapes instead of the Column class (deep instantiation), the generated server client takes the config type explicitly, tier 2 starter files land last in the scaffold, the Vite library build uses rolldownOptions. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ts; callback refusals as data PROTOTYPE for #314. patchy dev binds the server bundle from a Vite library build-watch, swaps the loaded version per rebuild, and serves a second loopback listener bound to a fixture colleague. The loader returns callback refusals as data because Error properties do not survive the RPC hop into the guest. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…esources keep version; README PROTOTYPE for #314. The import check's refusal is found through rolldown's error wrapping on publish and in both watchers, devResources exposes the initial version as a value again (its tests spread it) beside currentVersion(), and prototypes/tier2-init/README.md records the file map, the numbers and the stall list. Co-Authored-By: Claude Fable 5.1 <[email protected]>
PROTOTYPE for #314. Co-Authored-By: Claude Fable 5.1 <[email protected]>
PROTOTYPE for #314. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…preact and the patchy-preact skill PROTOTYPE for #314 round 2. The tier 2 scaffold is the #296 point 14 recipe: empty root, src/main.tsx + src/App.tsx, exact preact and signals pins in dependencies, jsx react-jsx + jsxImportSource preact beside oxc.jsx.importSource, modulePreload off, preact/debug behind an awaited dynamic import. patchy/preact loads compat once and re-exports what a patch needs; the import check refuses react, react-dom and preact/compat and no longer allows vite/*. The patchy-preact skill is served on tier 1 and tier 2. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… refusal codes; row-shape and path diagnostics PROTOTYPE for #314 round 2. Transaction.ts opens one SERIALIZABLE company transaction per mutation at admission (REPEATABLE READ READ ONLY for a query) on its own fiber; callbacks are jobs on that fiber, so they serialise on and join it; completion joins the running job, refuses the rest and commits only after the result validated. A 40001 anywhere, statement or commit, re-invokes the handler up to three times with a fresh capability. Two invocations per company, busy past that. t.row validates the pinned table shape, descriptors carry only their own keys, refusal codes come from the host's own record, and a publish disagreement names the descriptor path. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…l; round 2 README PROTOTYPE for #314 round 2. A timed-out invocation makes the engine probe its workerd; an unanswered probe after a 1 s margin kills and respawns the process (18 ms measured), in-flight invocations roll back and report handler_timeout. The health poll after spawn runs on wall-clock time so the server's test layers build under the TestClock again. README gains the Round 2 section; the patchy-server skill states the transaction. Co-Authored-By: Claude Fable 5.1 <[email protected]>
PROTOTYPE for #314 round 3. The transaction scope is ready before admission completes and settles queued callbacks on every fiber exit; the listener parses before the liveness check; a 40001 anywhere (statement, commit, or caught by the guest) marks the attempt abort-only and retries up to three times; the outcome is classified from the commit phase with the transaction verified before COMMIT, so unknown_outcome is only a COMMIT whose reply failed; SET LOCAL statement_timeout bounds a callback in flight; the table handlers used for callbacks run over Transaction.joiningDatabases on the invocation's held connection, so four pool slots carry four invocations; declared handler errors are enforced, refusals are correlated with the refusal the host issued, row validation requires every column, descriptor lookup uses own keys, and the modulepreload exemption is gone. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…d ctx.run PROTOTYPE for #314 round 3. Generation emits the declared shared-table and connection client factories into _generated/server.ts and types ctx.shared / ctx.connections from them; the guest entry instantiates them over the callback stub; the host gates shared reads to queries and actions, connections to actions, and serves ctx.run from an action by re-entering the invocation path under the parent's remaining deadline, each nested mutation its own transaction and slot. isHandlerError is structural across the two bundled copies of HandlerError. The patchy-server skill carries the access table and the declaration pointers. Co-Authored-By: Claude Fable 5.1 <[email protected]>
PROTOTYPE for #314 round 3. The company pool's size is a config (PATCHY_COMPANY_POOL_CONNECTIONS, default 4) so the load runs can see what the pool alone changes; the dev runner passes that, the invocation bound and the runtime call rate through from its shell; the engine logs its capability and in-flight registries when they change and the loader's /healthz reports its invocation map, for the soak's leak check. Numbers are in the README's Round 3 section. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PROTOTYPE for #314 round 3. patchy.server.<module>.<query>.subscribe (args, onSnapshot) on the core client with #313's refcounted registry; the shell's SSE stream and the server's stream routes lifted from #313 and narrowed to tier 2 queries. ServerCall traces the tables each run's callbacks touched (shared aliases keyed on the owner's table), refuses anything but a query under a subscription, and wakes by key after a mutation's COMMIT; tier 1 table writes wake from Runtime.dispatch and the dev loop wakes version:<patch> on rebind. A wake during a run is kept and checked against the run's new dependencies. The patchy-server skill teaches .subscribe and says results are readonly; patchy-preact points at it. Also fixes step 2's lint and tsc reds. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PROTOTYPE for #314 round 3. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Sep 25, 2026
Closed
Closed
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.
Prototype, not for merge. Part of #314.
A tier 2 patch has no path today from
patchy initto a served version whose page calls server code: no handler contract in the package, no second artifact on publish, no engine beside the runtime. This slice builds the thinnest real thread through every surface so a fresh agent with only the tree and the project skills can be measured against it.What is here
packages/execution: the engine (the Prototype: the execution-service spike on ECS Fargate, a handler bundle in a credential-free task against Neon #311 loader Worker on workerd,bind/invoke/inspect, a loopback callback listener with per-invocation capabilities) and theserver.callruntime handler.patchy/serverwithquery/mutation/action,t.object/array/enum/nullable/row,HandlerError;patchy/_generated/server.tsbound to the config;patchy.server.<module>.<export>()typed fromserver/itself.server_hashon the version, handlers re-derived server-side and compared before the version is recorded.patchy devon the engine with rebuild-and-rebind and two viewer mounts; thepatchy-serverproject skill;init --tier 2.prototypes/tier2-init/README.md: the file map, measured numbers, the stall list and design notes.Numbers (2026-09-25, one laptop)
engine spawn 41 ms, bind 7-12 ms, warm invoke 3-5 ms;
init --tier 28.9 s, scaffold typecheck 1.1 s; publish 1.6 s; served page viewer 121 ms, add-and-relist 66-73 ms, server-side query 5-12 ms and mutation 4-6 ms;patchy devstart 4.6 s, first bind 71 ms, edit-to-rebind 122 ms, two tabs ready 231 ms, simultaneous adds 151/149 ms; disagreeing manifest 422 in 48-104 ms,for(;;){}refused at 5041 ms with the throwaway process gone;sleep(12000)ishandler_timeoutat 10.01 s.Stalled or skipped: the Preact scaffold; stopping a CPU-spinning handler in the serving engine (no watchdog by decision);
ctx.shared/files/connections/run, the mutation key and subscriptions; one transaction per mutation (a row written before a throw persists, stated in the skill).Checks on this branch:
pnpm typecheckgreen (38/38);pnpm lintgreen;pnpm test935 passed, 2 expected reds (the SDK export-list assertion now sees./server, the migration-ledger assertion now sees0009), 3 load-induced timeouts that pass alone,docs/API.mdre-rendered.Fresh agent
Handed to a fresh agent (astra with tools) with only the tree and the project skills: a shared follow-up-calls tool with attributed "mark done", built, run as two people in the two dev mounts and published in about eight minutes with no package reached for; its handlers then answered hosted
server.calls on the instance. Stall list, astra's evaluation and the build report are on #314. A first run was invalid because pnpm's store served a stalepatchy-0.0.1.tgzby URL; that finding goes to the repo and dev loop ticket.Round 2
Allison asked for the learning round 1 left out. Same branch, four more commits.
patchy/preactloads compat once and re-exports what a patch needs; the tier 2 scaffold issrc/main.tsx+src/App.tsxwith exact pins independencies,jsx: react-jsx+jsxImportSource: preactbesideoxc.jsx.importSource,modulePreloadoff; the import check refusesreact,react-dom,preact/compatand no longer allowsvite/*; apatchy-preactskill is served on tier 1 and 2. Measured:onChangefired 5/5 keystrokes, add through the form 112-114 ms,forwardReffocus works, built document 14.5 KB gzip against 4.8 KB vanilla, scaffoldtsc1.06 s, fresh init 22.3 s on an empty store.writeThenThrow0 rows, ten-callback mutation p50 14 ms server-side, insert-then-timeout rolled back (0 rows,handler_timeoutat 10.01 s), eight concurrent bumps on one row total 8 with 3 serialization retries; on PGlite 0 rows, p50 22 ms, no retries (one connection). Bound: two invocations per company,busypast that, because each callback borrows a second pool slot through the table handlers.t.rowvalidates the pinned row shape ($.createdAt: expected an ISO timestamp), descriptors carry only their own keys, refusal codes come from the host's own record, disagreements name the descriptor path (notes.add.kind: declared "query", bundle says "mutation").handler_timeout;notes.listanswered 23 ms after the respawn. Execution compatibility, not containment.Stalls: the two-invocation bound; the
ProcessKilledpath was not the one the measured sibling took (its own deadline came first); tier 1 stays vanilla. Checks:pnpm typecheckgreen (38/38);pnpm lintgreen;pnpm test937 passed with the two expected reds (SDK export list, migration ledger) and one load timeout that passes alone; the server test files that had hung since round 1 (engine health poll under the TestClock) pass again.Round 3
Round 3 has four steps: astra's second-pass enforcement fences,
ctx.shared/ctx.connections/ctx.run, load numbers for the limits ticket (#304), and a subscription on a tier 2 query. The README's## Round 3has every table. The runs used the worktree'spnpm devinstance (embedded Postgres, one company) unless PGlite is named.1. Fences.
COMMIT, andunknown_outcomeis only a lostCOMMITreply.Transaction.joiningDatabases, in the execution seam), so four pool slots carry four invocations.SET LOCAL statement_timeoutbounds a callback in flight.errorsare enforced by the host, and descriptor lookup uses own keys.writeThenThrowand insert-then-timeout leave 0 rows.handler_timeoutat 10.02 s; Postgres cancels the statement in the same millisecond, and 0 rows remain.2.
ctx.shared,ctx.connections,ctx.run. A query reading another patch's shared table throughctx.shared.signups.listtakes 9.4 ms p50 wall, and a mutation reaching it getsaccess_denied. An action running two sibling mutations and a query throughctx.runtakes 20.5 ms p50; the sibling'sHandlerErroris rethrown to the action, and a query'sctx.runis refused. Stall:ctx.connectionsis unexercised. The embedded Postgres cannot satisfy the connect path'sverify-fullTLS and non-superuser checks.3. Load (bounds: 4 invocations per company, 4 pool connections, 10 s deadline, call rate raised to 100,000/min).
busybusybusybusymakes clients retry through full admission, and that halves throughput at 20 viewers.4. Subscriptions.
patchy.server.<module>.<query>.subscribe(args, onSnapshot)returns an unsubscribe. The shell stream and client registry are lifted from Prototype: the reactive query loop across two browsers #313.COMMIT, a tier 1 write fromRuntime.dispatch, and a dev rebind withversion:<patch>.patchy dev, aserver/edit reaches the live subscription on the new bundle in 79 ms without a resync.up-to-datewatermark fence, desired/admitted reconciliation, a separate re-run bucket, hidden-document suspension, a per-company semaphore with a per-patch cap). There are two wake points where a build wants one.Checks after round 3:
pnpm typecheckis green (38/38) andpnpm lintis green; round 3 fixed two reds that step 2 had left. Targeted suites: runtime 34/35 (only the expected migration-ledger red), serving 31/31, patchy 310/310 (itsOperationunion assertion gainedsubscribe | unsubscribe, as #313 did), company-database 30/30. The fullpnpm testwas not re-run.Try it
Not breaking: nothing here is deployed anywhere; tier 0 and tier 1 paths are unchanged except for one added runtime operation the broker admits by table, and one additive migration.
Built by Claude Fable 5.1 via Claude Code (subagent)
🤖 Generated with Claude Code