mirror of
https://github.com/bitbaum/solon.git
synced 2026-12-05 03:27:44 +01:00
* feat(governance): schema v2 + domain core — humans and agents as first-class voting members S1+S2 of the Solon v1 plan: replace the facade data model with an honest one and put the governance logic under test for the first time. Schema v2 (drop-and-rebuild baseline; prod schema was verified empty and pre-reset on bitbaum so the new baseline applies cleanly): - Member carries memberType HUMAN|AGENT, its own bitcoinAddress + publicKeyHex, votingWeight, and optional ocActorId (OrangeCat identity link) - VotingSession snapshots its rules at open (electorate, threshold, quorum, eligibleCount, eligibleWeight) so past decisions stay explainable forever - Vote stores the exact signedMessage + signature — every tally is re-verifiable - Policy versions are unique per (org, key, version); only an APPROVED session can create v2+ (approvedBySessionId null is reserved for the v1 bootstrap) - Append-only AuditEvent, watch-only TreasurySource, sha256-hashed AgentApiKey - Idempotent seed migration: org `orangecat` + allocation_policy v1 ACTIVE Domain layer (lib/domain, no HTTP, no UI): - config/governance.ts is the electorate SSOT: agents vote in ALLOCATION_POLICY / TREASURY_SPEND / OPERATIONS; AID_DISBURSEMENT / MEMBERSHIP / SAFETY / GOVERNANCE_RULES are HUMANS_ONLY (red lines: agents can never vote money to people or expand their own suffrage) - tally.ts: pure tally + decideOutcome (abstain counts toward quorum, not threshold; silence is not consent — below-quorum sessions EXPIRE) - voting.ts: openSession (gate + snapshot at open), submitVote (signature → member → electorate check → weighted upsert + audit), closeSession (outcome from snapshots; APPROVED policy proposals mint the next ACTIVE version) - treasury.ts: live mempool.space balances, null on failure — never a guess Bitcoin message layer extended (load-bearing for real wallets): - BIP137 headers 27-42 accepted; claimed address matched against P2PKH, P2WPKH (bech32), and P2SH-P2WPKH derivations, so Sparrow/Electrum/Core signatures all verify — including Electrum's legacy-header-on-segwit quirk - proposalMessage() canonical form alongside voteMessage() Vitest wired into verify (lint + typecheck + test); 25 tests cover golden message strings, sign/verify roundtrips incl. tamper/replay, segwit derivation and header re-banding, the tally/threshold/quorum matrix, and config completeness over every DecisionCategory. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(prisma): restore migration_lock.toml lost in the baseline regeneration Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
15 lines
280 B
TypeScript
15 lines
280 B
TypeScript
import { defineConfig } from "vitest/config";
|
|
import path from "node:path";
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
include: ["src/**/__tests__/**/*.test.ts"],
|
|
environment: "node",
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "src"),
|
|
},
|
|
},
|
|
});
|