mirror of
https://github.com/bitbaum/solon.git
synced 2026-12-04 05:07:04 +01:00
Solon could govern many organizations and shipped exactly one, because the only way to create one was to write a SQL migration (drizzle/0001_seed_org1). That does not survive a second builder, and it made Solon something the studio grants rather than something people use. WHERE THE LINE IS Founding is permissionless; acting within an organization is governed. Requiring a vote to create one is circular — there is no electorate to vote in yet — so the founding seat is granted the way membership.ts already grants the genesis seat: on proof, not permission. The founder signs with a Bitcoin key they control, bound to their OrangeCat identity, and the organization, the founder's seat and both audit events are written in ONE transaction. There is no instant when an organization exists with an unclaimed founding seat somebody else could take. ONE SEAT PER ORGANIZATION, NOT PER PERSON members.oc_actor_id was globally unique, so an OrangeCat identity could sit on exactly one roster ever — a builder who founded a second organization could not be its founding member. It is now unique per organization, which keeps the property that mattered (nobody holds two votes in one electorate) and drops the one that was an accident. memberForActor() therefore takes an organization; without that, a builder would be shown one organization's seat on another's pages. Four call sites updated. ATTRIBUTION IS CONSENT, NOT A NAME MATCH Permissionless founding opens one door that must stay shut: anyone could found `loki` and appear on a public register to govern a product they have nothing to do with. So organizations.claimed_project is set only from a grant Loki signs for the founder's own identity (src/lib/loki-grant.ts), checked against the SESSION's actor id — never one taken from the request. Squatting a name costs a vanity slug, never attribution. A grant that is present but invalid refuses the founding outright rather than quietly creating an unattributed organization. Organization #1 is backfilled as governing `orangecat` (0004) — it predates grants, so it is reference data, the way the organization itself was. AND THE 404 NOBODY OWNED Loki's fleet map and the bitbaum studio site both link /orgs/<slug>. No such page existed: every one of those links answered 404, including the link to organization #1. /orgs/[slug] now serves the roster and the record, and /api/orgs lists every organization so Loki can stop probing one name at a time. PROVEN CI ran ONE integration spec by name, so the membership spec guarding the founding seat had never once run there. It now runs every *.integration.test.ts — and caught this change's own regression on the first run, where the reworded refusal no longer matched that spec's assertion. 23 integration assertions against a real database (atomicity, signature replay across message types, the multi-organization constraint, grant forgery and expiry, one organization per project, the founding cap) plus 116 unit tests. pnpm run verify: green. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
37 lines
1.6 KiB
Bash
37 lines
1.6 KiB
Bash
# Copy to .env and fill in. Nothing here is a real secret.
|
|
|
|
# --- Required ---------------------------------------------------------------
|
|
|
|
# PostgreSQL. `npm run db:migrate` creates the schema against this.
|
|
DATABASE_URL="postgresql://solon:solon@localhost:5432/solon"
|
|
|
|
# NextAuth v5. Generate with: openssl rand -base64 32
|
|
AUTH_SECRET=""
|
|
|
|
# The app's own public origin. NextAuth infers this from request headers, which
|
|
# is wrong behind a reverse proxy — pin it in every deployed environment or
|
|
# sign-in redirects land on the internal host instead of the public one.
|
|
AUTH_URL="http://localhost:3000"
|
|
NEXT_PUBLIC_APP_URL="http://localhost:3000"
|
|
|
|
# --- Sign in with OrangeCat (optional locally, required in production) -------
|
|
# Solon delegates identity to OrangeCat's OAuth provider.
|
|
ORANGECAT_OAUTH_ISSUER="https://orangecat.ch"
|
|
ORANGECAT_OAUTH_CLIENT_ID=""
|
|
ORANGECAT_OAUTH_CLIENT_SECRET=""
|
|
|
|
# --- Optional ---------------------------------------------------------------
|
|
|
|
# Watch-only treasury balances are read from a mempool.space-compatible API.
|
|
# Defaults to the public instance when unset.
|
|
MEMPOOL_API_BASE="https://mempool.space/api"
|
|
|
|
# Outbound notification of a recorded decision (OrangeCat re-verifies the
|
|
# signatures itself; this only tells it there is something new to read).
|
|
SOLON_WEBHOOK_URL=""
|
|
# Also verifies the grant Loki attaches when a project owner founds an
|
|
# organization from their project page (src/lib/loki-grant.ts). Must equal
|
|
# Loki's SOLON_WEBHOOK_SECRET. Unset, founding still works — it just cannot be
|
|
# attributed to a project.
|
|
SOLON_WEBHOOK_SECRET=""
|