feat(seed): demo a brewing waterborne outbreak so the Health->Fair Share interop shows cold
The Health Post -> Fair Share water-floor interop needs >=3 DISTINCT diarrhea reporters (anti-inflation), so it was not demonstrable on a single fresh device. The hollow-demo-v3 seed now appends 5 foreign-signed diarrhea symptom reports from 3 distinct resident identities, so loading the demo shows an elevated dispatch priority + the one-click Raise Fair Share water floor action with no manual multi-device setup. Verified cold on the real surface (banner present, diarrhea count 5, dispatch elevated). Fixture bumped v2->v3.
This commit is contained in:
1 parent
2f6a6ba907
commit
b9deb73592
4 files changed
+53
-1
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 169 KiB |
@@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { db } from "../lib/db";
|
||||
import { getPublicKey, init } from "../lib/identity";
|
||||
import { readAll } from "../lib/eventlog";
|
||||
import { countDistinctSymptomReporters } from "../miniapps/healthpost/healthpostEvents";
|
||||
import { listProposals, listRoster } from "../lib/assembly";
|
||||
import {
|
||||
computeQvTally,
|
||||
@@ -30,6 +31,7 @@ import {
|
||||
DEMO_FIXTURE_MARKER,
|
||||
DEMO_SAMPLE_MINIAPP_MANIFEST,
|
||||
HOLLOW_DEMO_COMMONS_FUND_ACCOUNT,
|
||||
HOLLOW_DEMO_DIARRHEA_REPORTER_KEYS,
|
||||
HOLLOW_DEMO_FIXTURE,
|
||||
HOLLOW_DEMO_HAZARD_REPORT,
|
||||
HOLLOW_DEMO_HOUSING_NEIGHBOR_RESIDENTS,
|
||||
@@ -166,9 +168,15 @@ describe("AdminSeedPanel - Load Hollow demo", () => {
|
||||
2 + // farms settlement (seed.resource.food + fairshare.allocation.cycle)
|
||||
1 + // local mentor.skillReview (apprentice, still-learning)
|
||||
1 + // foreign-signed mentor.skillReview (proficient mentor)
|
||||
HOLLOW_DEMO_DIARRHEA_REPORTER_KEYS.length + // foreign-signed diarrhea symptom reports
|
||||
1; // seed.demo.loaded marker
|
||||
expect(entries).toHaveLength(expectedCount);
|
||||
|
||||
// The seeded brewing outbreak has >=3 DISTINCT diarrhea reporters, so the
|
||||
// Health Post -> Fair Share water-floor interop is demonstrable cold (and
|
||||
// can never be triggered by a single resident re-reporting).
|
||||
expect(countDistinctSymptomReporters(entries, "diarrhea")).toBeGreaterThanOrEqual(3);
|
||||
|
||||
const payloadTypes = entries.map((e) => (e.payload as { type: string }).type);
|
||||
expect(payloadTypes).toContain("seed.population");
|
||||
expect(payloadTypes).toContain(DEMO_FIXTURE_MARKER.type);
|
||||
|
||||
@@ -37,6 +37,8 @@ import {
|
||||
HOLLOW_DEMO_PROPOSAL,
|
||||
buildDemoCorroboratingHazardEntry,
|
||||
buildDemoMentorReviewEntry,
|
||||
buildDemoDiarrheaReportEntry,
|
||||
HOLLOW_DEMO_DIARRHEA_REPORTER_KEYS,
|
||||
HOLLOW_DEMO_ROSTER,
|
||||
HOLLOW_DEMO_VOTES,
|
||||
hasDemoFixtureBeenLoaded,
|
||||
@@ -244,6 +246,13 @@ export function AdminSeedPanel({ assemblyDbName, aggregateEndpoint }: AdminSeedP
|
||||
// review was the local identity's own (a mentor can never match itself).
|
||||
await appendEntry(await buildDemoMentorReviewEntry(await nextDemoLamportTs()));
|
||||
|
||||
// A brewing waterborne situation: 3 distinct residents report diarrhea
|
||||
// (5 reports total) so the Health Post -> Fair Share water-floor
|
||||
// corroboration gate is demonstrable cold, never single-reporter-inflated.
|
||||
for (const key of HOLLOW_DEMO_DIARRHEA_REPORTER_KEYS) {
|
||||
await appendEntry(await buildDemoDiarrheaReportEntry(key, await nextDemoLamportTs()));
|
||||
}
|
||||
|
||||
await append(DEMO_FIXTURE_MARKER);
|
||||
setDemoStatus("Demo data loaded into the Event Log.");
|
||||
} finally {
|
||||
|
||||
+36
-1
@@ -185,7 +185,7 @@ export interface DemoFixtureMarkerPayload {
|
||||
|
||||
export const DEMO_FIXTURE_MARKER: DemoFixtureMarkerPayload = {
|
||||
type: "seed.demo.loaded",
|
||||
fixtureId: "hollow-demo-v2",
|
||||
fixtureId: "hollow-demo-v3",
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -465,6 +465,41 @@ export const HOLLOW_DEMO_MENTOR_APPRENTICE_RATING = Rating.Again;
|
||||
*/
|
||||
export const HOLLOW_DEMO_MENTOR_SECRET_KEY: Uint8Array = new Uint8Array(32).fill(0x3c);
|
||||
|
||||
/**
|
||||
* A THIRD distinct demo identity, so the seeded diarrhea cluster below has the
|
||||
* >=3 DISTINCT signers the Health Post -> Fair Share water-floor interop
|
||||
* requires (one resident re-reporting can never trigger it). Fixed, not random.
|
||||
*/
|
||||
export const HOLLOW_DEMO_THIRD_REPORTER_SECRET_KEY: Uint8Array = new Uint8Array(32).fill(0x6d);
|
||||
|
||||
/**
|
||||
* Keys that foreign-sign the seeded diarrhea self-reports: 5 reports from 3
|
||||
* DISTINCT residents (total 5 -> elevated dispatch priority; 3 distinct -> the
|
||||
* water-floor corroboration gate fires), a brewing waterborne situation the
|
||||
* clinician can respond to in the demo. SECOND/MENTOR are the same residents
|
||||
* who filed the corroborating hazard and the mentor review - residents are
|
||||
* multi-faceted, and the distinct-signer count is what matters here.
|
||||
*/
|
||||
export const HOLLOW_DEMO_DIARRHEA_REPORTER_KEYS: readonly Uint8Array[] = [
|
||||
HOLLOW_DEMO_SECOND_REPORTER_SECRET_KEY,
|
||||
HOLLOW_DEMO_MENTOR_SECRET_KEY,
|
||||
HOLLOW_DEMO_THIRD_REPORTER_SECRET_KEY,
|
||||
HOLLOW_DEMO_SECOND_REPORTER_SECRET_KEY,
|
||||
HOLLOW_DEMO_MENTOR_SECRET_KEY,
|
||||
];
|
||||
|
||||
/** Builds one foreign-signed healthpost.symptomReport (diarrhea) at lamportTs. */
|
||||
export async function buildDemoDiarrheaReportEntry(
|
||||
secretKey: Uint8Array,
|
||||
lamportTs: number,
|
||||
): Promise<UnsignedEventLogEntry> {
|
||||
return buildForeignSignedEntry(
|
||||
secretKey,
|
||||
{ type: "healthpost.symptomReport", symptom: "diarrhea" },
|
||||
lamportTs,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the foreign-signed `mentor.skillReview` entry for the proficient
|
||||
* second identity at `lamportTs`: a real "Good" review of the at-risk skill,
|
||||
|
||||
Reference in new issue
Block a user