Skip to content

feat(patchy): patchy dev on the production engine: live server rebinding, the colleague mount on both tiers, dev.log #404

Closed

Description

@allisonmahmood

Part of #384. Implements the dev half of spec §13; decisions repo and dev loop points 2, 5, 12–14, the execution service (dev runs the production engine), limits §1 (contract limits in dev, the PGlite gap).

What to build

  • patchy dev on the production engine: the supervised local executor with the local runtime as host, over PGlite, the same callback path and contract limits as production.
  • Live server rebinding: dev's watcher re-reads server/ (a new module is callable with no restart; dev logs new server module leads: run pnpm patchy refresh for types). A rebuild binds bundle and descriptors as one new binding. Admitted calls, including nested ctx.run, finish on the binding they were admitted on. Every open subscription re-runs on the new binding as a wake, and a run finishing after the swap is discarded and run again. A removed handler or a breaking args change ends its subscription permanently. A failed build or import refusal is logged and the last good binding keeps serving. A src/ rebuild reloads the shell, as today.
  • The colleague mount on both tiers: the second listener serves the patch as the fixture non-admin member; --json gains colleagueUrl on tiers 1 and 2. The primary mount is the machine token's user.
  • dev.log: one line per call (viewer, handler, outcome, ms, then its ctx.log lines, and in dev only a handler_failed message and stack), the full wide event behind --json. dev logs --json keeps { ok, log, text }. Dev writes no runtime-log rows.
  • Fixtures from handlers: handlers read shared-table and connection fixtures in dev.
  • The promise in the skills (patchy-dev-loop in the repo, patchy-server and patchy-loop in the SDK): "patchy dev runs the same handler engine and callback path as production. It does not reproduce production's scheduling, limits or containment. A handler that spins forever times out, and a health check restarts the dev engine, which can interrupt other calls in flight." Plus: PGlite reproduces neither contention nor serialization conflicts, so dev is not evidence for busy or write_conflict.

Admitted at merge

The full tier 2 dev loop.

Done when

An edit to a server/ handler is live in about 120 ms without dropping an in-flight call; an open subscription re-runs on the new binding; the colleague mount on a tier 1 patch writes as the colleague. Acceptance owned here: ctx.connections over TLS verify-full with a non-superuser role; handlers read shared-table and connection fixtures; the dev log attributes each call to its viewer.

Surfaces

ADR-0004 (colleagueUrl), packages/patchy/README.md, docs/DEVELOPMENT.md, the patchy-dev-loop skill (containment, the colleague mount on both tiers), the Publishing glossary (Colleague mount), the dev runner if it changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions