Skip to content

prototype(tier2): the stack the reference CRM needs, files, handles, shared stores and company Postgres - #381

Closed
allisonmahmood wants to merge 7 commits into
prototype/tier2-initfrom
prototype/tier2-crm
Closed

allisonmahmood wants to merge 7 commits into
prototype/tier2-initfrom
prototype/tier2-crm

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Prototype, not for merge. Part of #315.

The reference CRM is the tier 2 map's acceptance journey, and the stack could not host it: tier 2 had no files, no authorised file handles, no staged uploads, no shared file stores, and ctx.connections had never run against a real company database. This branch builds those on top of #380 (it is based on prototype/tier2-init, so the diff shows only this round) so fresh agents can build the CRM from the project skills alone.

What is here

  • Tier 2 files (ctx.files): list/stat with handles in queries, get/put/delete in actions, store-grain wakes.
  • Authorised file handles: 57-character deterministic tokens bound to viewer, company, patch, version and object; every redemption re-authorised live (the byte cache always revalidates); patchy.files.url/download, useFileUrl.
  • Staged uploads: patchy.files.stage → single-use Upload, t.upload() in action args, adoption as a pointer write under files/<patchId>/<objectId>.
  • Shared file stores: files(…, { shared: true }), patchy add shared-store, discovery in patchy list, live checks, unshare waking subscribers, reshare restoring them, dependants refusing unshare without force, dev fixtures.
  • Server-only tier 2 page: a real bypass fixed (a tier 2 page could call tables.* directly around the handler's viewer filter).
  • Hidden documents suspend after a 30 s grace and resync on return.
  • Company Postgres on Neon (crm_finance, read-only role proven by refused writes) reached from an action.
  • Two allowlist variants fixed at init: A is the decided floor (patchy, preact, @preact/signals), B adds @zag-js/preact with four machines and @tanstack/preact-table; both smoke-tested under compat.
  • Journey fixtures and truth data, the boundary proofs (pnpm test:prototype-crm, 9/9), updated skills plus patchy-shared-stores and the variant-B-only patchy-packages.
  • prototypes/tier2-crm/README.md: file map, API shapes, numbers, gaps, decisions.

The four runs

Each variant was built from the skills alone twice, once by Opus 5.5 and once by astra. All four published inside the 90-minute box, and none bypassed authority. An independent Opus verifier scored them against truth files: A-Opus 92 (9 m 43 s), A-astra 95 (56 m), B-Opus 92 (10 m 44 s), B-astra 94 (43 m 52 s). Variant B's packages went almost unused: one Zag dialog in one run, which cost 24 KB gzip. The verifier found a stack bug: a dropped client leaves its company transaction idle and its slot taken. The sources, reports and scores are in prototypes/tier2-crm/runs/, and the report and wall list are on #315.

Verdict

Resolved on #315 on 2026-09-27. No example CRM ships to agents; the four runs stay here as internal reference. The allowlist is the floor only. The company member directory becomes a native resource.

Try it

git fetch origin prototype/tier2-crm && git checkout prototype/tier2-crm && pnpm install
pnpm prototype:crm setup
XDG_CONFIG_HOME=$PWD/.local/prototype-crm/xdg PATCHY_RUNTIME_CALLS_PER_MINUTE=100000 pnpm dev
pnpm prototype:crm-fixtures        # needs ~/.config/patchy-cloud/neon-spike.env for the finance database
pnpm test:prototype-crm            # the boundary proofs
pnpm prototype:crm init /tmp/crm-a --variant a   # a tree ready for an agent; prints its env line
pnpm prototype:crm browser owner <url> [more urls]   # one signed-in window, a tab per patch
pnpm dev stop

Not breaking: nothing here is deployed; it is a throwaway branch.

Built by Claude Opus 5.5 (builder subagent), orchestrated by Claude Fable 5.1 via Claude Code.

🤖 Generated with Claude Code

allisonmahmood and others added 4 commits September 27, 2026 16:40
…ds, shared stores, viewer filter and hidden documents

ctx.files on tier 2 (list/stat in queries, get/put/delete in actions), authorised
file handles redeemed through the shell with live re-authorisation and a
revalidated byte cache, staged uploads adopted by an action, shared file stores
with add shared-store and discovery, the tier 2 page made server-only, handler
refusals contained, and hidden-document suspension. The step 11 proofs run
with pnpm test:prototype-crm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wo allowlist variants, journey fixtures and skills

ctx.connections exercised for real against a read-only role on the Neon spike
project, registered through the admin connection page; variant A (patchy only)
and B (Zag.js Preact adapter with four machines, TanStack preact-table) chosen
at init and honoured by refresh, the import check and generation; one fixture
script for the contracts source, finance connection, contacts.csv and truth
files; project skills for files, handles, uploads, shared stores, useQuery and
useFileUrl.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on and rollback, fixture fixes and the README

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:primitives Patch tables and files size:xl Over 1,000 changed lines; review in multiple passes labels Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:primitives Patch tables and files area:server Touches the server area size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant