diff --git a/.omo/evidence/first-place-overhaul/task-3-first-place-overhaul.txt b/.omo/evidence/first-place-overhaul/task-3-first-place-overhaul.txt new file mode 100644 index 0000000..27f5f2b --- /dev/null +++ b/.omo/evidence/first-place-overhaul/task-3-first-place-overhaul.txt @@ -0,0 +1,200 @@ +PLAN TODO 3 - ECONOMY.md DISCLOSURE EDITS +========================================== + +Task: Add two new bullets to ECONOMY.md's "What this system does NOT +guarantee (disclosed honestly)" section (wallet.issue unauthenticated +issuer; Housing fairnessDebt not validated for finiteness at replay), and +reconcile the two sentences that previously asserted the "only net +issuance is the bounded welcome credit" invariant as settled fact. + +Scope: documentation-only. No code paths touched. + +---------------------------------------------------------------- +1. SOURCE VERIFICATION (read before writing prose) +---------------------------------------------------------------- + +src/lib/ledger.ts, isIssuePayload: + + function isIssuePayload(payload: unknown): payload is IssuePayload { + if (typeof payload !== "object" || payload === null) return false; + const p = payload as Record; + return ( + p.type === "wallet.issue" && + typeof p.account === "string" && + typeof p.amount === "number" && + Number.isFinite(p.amount) && + p.amount >= 0 + ); + } + + Confirmed: this checks payload SHAPE only (type tag, account is a + string, amount is a non-negative finite number). It does not check that + the signing key / authorPubkey has any relationship to `account`, and + does not check amount against any cap. Any peer can sign a wallet.issue + crediting their own account id with an arbitrary non-negative amount and + it will be accepted by computeBalances identically to a legitimate + welcome-credit/fairdraw/housing issuance. This is the technical basis for + the "Unauthenticated wallet.issue issuer" bullet. + +src/lib/housing.ts, isHousingAssignmentPayload: + + export function isHousingAssignmentPayload( + payload: unknown, + ): payload is HousingAssignmentPayload { + if (typeof payload !== "object" || payload === null) return false; + const p = payload as Record; + return ( + p.type === "housing.assignment" && + typeof p.cycle === "number" && + Array.isArray(p.assignments) && + typeof p.fairnessDebt === "object" && + p.fairnessDebt !== null + ); + } + + Confirmed: `fairnessDebt` is checked only for being a non-null object - + its per-resident numeric values are never validated for finiteness + (no Number.isFinite check on any value in the map, unlike + solveHousingAssignment's own internal preference-score finiteness + checks). computeFairnessDebtLedger folds this map directly via + Object.assign with no sanitization, and solveHousingAssignment's MILP + objective (`pref.score * (1 + fairnessDebtWeight * debt)`) would carry a + NaN/Infinity value forward into every future cycle's solve. This is the + technical basis for the "Unvalidated Housing fairnessDebt on sync" + bullet. + +---------------------------------------------------------------- +2. EDITS MADE +---------------------------------------------------------------- + +Three edits to ECONOMY.md: + +a) Softened the "Welcome credit" bullet under circuit 1 Issuance: changed + "This is the ONLY deliberate net issuance... disclosed here" to "By + design, this is MEANT to be the ONLY deliberate net issuance... See the + disclosed limitation below: that design intent is not yet + code-enforced against a peer self-issuing an arbitrary amount." + +b) Softened the "Conservation" bullet under circuit 1: changed "The only + net issuance is the bounded welcome credit... a stated, stable + invariant, not unbounded inflation" to "By design, the only INTENDED + net issuance is the bounded welcome credit... is MEANT to be a stable + invariant... see the disclosed limitation below: this is not yet + code-enforced against a peer self-issuing an arbitrary amount." + +c) Added two new bullets at the end of "What this system does NOT + guarantee (disclosed honestly)": + - "Unauthenticated wallet.issue issuer" - describes isIssuePayload's + shape-only check, the self-issuance risk, the comparison to + extractQvBallots' voter-identity authentication, and states this is + disclosed as a known limitation per an explicit scope decision (not + claimed to be fixed later). + - "Unvalidated Housing fairnessDebt on sync" - describes + isHousingAssignmentPayload's missing finiteness check, the resulting + risk from a malformed/malicious synced event, and the bounded blast + radius (housing fairness rotation only, never Commons Credit or any + other circuit). + +No other prose in the file was touched. No code file was modified. + +---------------------------------------------------------------- +3. VERIFICATION +---------------------------------------------------------------- + +Full re-read of ECONOMY.md's top section (circuit 1 "Commons Credit") and +the "does NOT guarantee" section after editing confirms no remaining +sentence anywhere asserts "only net issuance is the bounded welcome +credit" (or equivalent) as an already-guaranteed, code-enforced fact. Both +occurrences now read "by design... meant to be" and point to the new +disclosed-limitation bullet. + +grep -c "wallet.issue\|fairnessDebt" ECONOMY.md +=> 6 + +(>= 2 required; the 6 hits span the softened circuit-1 prose referencing +the limitation plus the two new bullets' own text and inline code +references.) + +---------------------------------------------------------------- +4. DIFF OF ECONOMY.md +---------------------------------------------------------------- + +diff --git a/ECONOMY.md b/ECONOMY.md +index 1acee3f..3540c23 100644 +--- a/ECONOMY.md ++++ b/ECONOMY.md +@@ -18,9 +18,11 @@ misreading, so each is defined on its own below. + - **Issuance (sources), each tied to a real contribution or an explicit, + bounded grant:** + - *Welcome credit* (50): a one-time line of credit the commons extends to +- every new resident so trade can start on day one (classic LETS seed). +- This is the ONLY deliberate net issuance, it is small and bounded, and it +- is disclosed here - not hidden fiat. ++ every new resident so trade can start on day one (classic LETS seed). By ++ design, this is meant to be the ONLY deliberate net issuance, small and ++ bounded, and disclosed here - not hidden fiat. See the disclosed ++ limitation below: that design intent is not yet code-enforced against a ++ peer self-issuing an arbitrary amount. + - *Being housed* credits a resident ONCE, as a one-time settlement grant, + when an assignment cycle first places them in a slot - never again for + the same placement and never per re-run of the cycle (idempotent). It is +@@ -32,9 +34,11 @@ misreading, so each is defined on its own below. + for a service (e.g. a Mentor session, a borrowed tool, help with a task). + This is the wallet's reason to exist. + - **Conservation:** every transfer is zero-sum (one debit, one matched +- credit). The only net issuance is the bounded welcome credit, so at steady +- state Sigma(balances) = residents x welcome - a stated, stable invariant, +- not unbounded inflation. ++ credit). By design, the only INTENDED net issuance is the bounded welcome ++ credit, so at steady state Sigma(balances) = residents x welcome is meant ++ to be a stable invariant, not unbounded inflation - see the disclosed ++ limitation below: this is not yet code-enforced against a peer ++ self-issuing an arbitrary amount. + - **Credit limit:** the default per-account credit limit is 0, so a resident + cannot transfer below their own issued credit; an over-spend is REJECTED at + replay (LedgerState.rejected) and surfaced, never silently applied. This is +@@ -107,3 +111,25 @@ misreading, so each is defined on its own below. + adjacent data on a shared store, sent on purpose. The passive symptom tally + (`healthpost.symptomReport`) and all other personal health inputs stay + strictly local; only the explicit referral handoff leaves the device. ++- **Unauthenticated `wallet.issue` issuer:** `ledger.ts`'s `isIssuePayload` ++ accepts any signed entry shaped `{ type: "wallet.issue", account, amount }` ++ where `amount` is a non-negative finite number - it checks the payload's ++ shape, not who the signer is relative to `account`. Any peer can sign a ++ `wallet.issue` crediting their OWN account with an arbitrary amount, the ++ same way `fairdraw`/`housing` legitimately do; nothing authenticates ++ "issuer" identity the way `extractQvBallots` authenticates voter identity ++ against the signing key. So the "only the bounded welcome credit is net ++ issuance" invariant above is a design intent, not something the code ++ enforces today. This is disclosed as a known limitation, not fixed, per an ++ explicit scope decision for this build. ++- **Unvalidated Housing `fairnessDebt` on sync:** `housing.ts`'s ++ `isHousingAssignmentPayload` checks that a `housing.assignment` event's ++ `fairnessDebt` is a non-null object, but never checks that its values are ++ finite numbers. A synced event from a malformed or malicious peer could ++ carry a `fairnessDebt` with a `NaN`, `Infinity`, or non-numeric value for ++ some resident; `computeFairnessDebtLedger` would fold that value straight ++ into the rotation ledger and `solveHousingAssignment`'s debt-weighted ++ objective would carry it into every future cycle. The blast radius is ++ bounded to the housing fairness rotation (it never touches Commons Credit ++ or any other circuit), but it is not validated at the replay boundary ++ today. + +---------------------------------------------------------------- +5. COMMIT +---------------------------------------------------------------- + +commit 208cf76c95216d879f16f2479d40c16297c54908 +"docs(economy): disclose wallet.issue and Housing fairnessDebt as known +limitations; reconcile the contradicted issuance-invariant claim" +1 file changed, 32 insertions(+), 6 deletions(-) + +---------------------------------------------------------------- +6. DISCLOSED RISK (not a fix, as instructed - documentation task only) +---------------------------------------------------------------- + +Both bullets describe real, unfixed gaps in the code as it stands today: +a peer can self-issue unbounded wallet credit, and a synced +housing.assignment event's fairnessDebt is not sanity-checked for +finiteness. Neither was touched in code; this task is strictly the +documentation disclosure per the plan's scope decision.