fix(admin): stop seeding fake sensor readings into Water Watch
The prior commit seeded two hardcoded sensorId strings ("kiosk-1",
"kiosk-2") reporting through the real corroboration gate - technically
real engine logic, but the sensorId label implies a hardware sensor
network that doesn't exist anywhere in this project. Water Watch has no
actual device integration; its real design is a resident typing a reading
into ReportReadingForm, and corroboration specifically requires a second,
genuinely independent report - something an admin seed step cannot
honestly produce without inventing a second reporter.
Removes the seeded readings entirely. Water Watch now starts at its
honest "No sensor readings yet" empty state, same as it would with zero
fabricated starting data. The real corroboration mechanism is meant to be
demonstrated by actually using the form, not by injected fixture data
standing in for equipment that was never built.
Tunnel Safety's hazard report, Farms' planting forecast, Assembly's votes,
and Mentor's skill review are unaffected - each represents an action a
real person could take through the app's own real form, with no claim
about external hardware, consistent with this fix's standard.
This commit is contained in:
1 parent
1ec340da7f
commit
804bf4e4a2
3 files changed
+13
-51
No files matched your search
@@ -130,9 +130,10 @@ describe("AdminSeedPanel - Load Hollow demo", () => {
|
||||
// population + 4 resources + 3 baselines + 4 fairshare.need + 1 wallet.issue
|
||||
// + 1 wallet.transfer + skillHolder seeds + 1 housing.assignment cycle
|
||||
// + 1 wallet.issue credit per housing resident + 1 marker
|
||||
// + 4 waterwatch.reading.report + 2 water corroboration settlement
|
||||
// (seed.resource.water credit + fairshare.allocation.cycle, only the 4th
|
||||
// reading reaches "alert") + 1 tunnelsafety.hazard.report
|
||||
// + 1 tunnelsafety.hazard.report (no Water Watch readings: this app has
|
||||
// no real sensor network, so the demo seed deliberately leaves it at its
|
||||
// honest "No sensor readings yet" empty state rather than injecting
|
||||
// fixture data standing in for hardware that doesn't exist)
|
||||
// + 2 farms settlement (seed.resource.food credit + fairshare.allocation.cycle)
|
||||
// + 1 mentor.skillReview
|
||||
const expectedCount =
|
||||
@@ -145,8 +146,6 @@ describe("AdminSeedPanel - Load Hollow demo", () => {
|
||||
1 +
|
||||
housingResidentCount +
|
||||
1 +
|
||||
4 +
|
||||
2 +
|
||||
1 +
|
||||
2 +
|
||||
1;
|
||||
|
||||
@@ -12,10 +12,8 @@ import {
|
||||
import { computeGdd, settleFarmsForecast, solveFarmsPlantingOptimizer } from "../lib/farms";
|
||||
import { reportHazard } from "../lib/tunnelsafety";
|
||||
import { DEFAULT_ASSEMBLY_DB_NAME, getAssemblyEngine } from "../miniapps/assembly/useAssemblyEngine";
|
||||
import { createCorroborationGate } from "../miniapps/waterwatch/corroboration";
|
||||
import { postSkillReview } from "../miniapps/mentor/mentorEvents";
|
||||
import { Rating } from "../lib/mentorSchedule";
|
||||
import { reportWaterReading, settleCorroboratedReading } from "../miniapps/waterwatch/corroboration";
|
||||
import { toAccountId } from "../shell/accountId";
|
||||
import { AdminAggregatePanel } from "./AdminAggregatePanel";
|
||||
import {
|
||||
@@ -37,7 +35,6 @@ import {
|
||||
HOLLOW_DEMO_PROPOSAL,
|
||||
HOLLOW_DEMO_ROSTER,
|
||||
HOLLOW_DEMO_VOTES,
|
||||
HOLLOW_DEMO_WATER_READINGS,
|
||||
hasDemoFixtureBeenLoaded,
|
||||
validateSeedInput,
|
||||
type ResourceType,
|
||||
@@ -162,27 +159,15 @@ export function AdminSeedPanel({ assemblyDbName, aggregateEndpoint }: AdminSeedP
|
||||
});
|
||||
}
|
||||
|
||||
// Two independently-corroborating Water Watch readings (plan: richer
|
||||
// demo data), run through the SAME real corroboration gate
|
||||
// DeviceMonitor itself replays over (createCorroborationGate +
|
||||
// reportWaterReading + settleCorroboratedReading) - so the gate's own
|
||||
// state machine, not a hand-set status, decides "alert". Each raw
|
||||
// reading is persisted regardless of its gate verdict, exactly like a
|
||||
// live resident submission, so a cold reload replays the identical
|
||||
// sequence DeviceMonitor would reconstruct on its own.
|
||||
const waterGate = createCorroborationGate({ gate: { warmupSamples: 1 } });
|
||||
const waterBaseTime = Date.now();
|
||||
for (const reading of HOLLOW_DEMO_WATER_READINGS) {
|
||||
const fullReading = {
|
||||
sensorId: reading.sensorId,
|
||||
channel: reading.channel,
|
||||
value: reading.value,
|
||||
timestamp: waterBaseTime + reading.timestampOffsetMs,
|
||||
};
|
||||
const gateEvent = waterGate.ingest(fullReading);
|
||||
await reportWaterReading(fullReading);
|
||||
await settleCorroboratedReading(gateEvent);
|
||||
}
|
||||
// Water Watch deliberately gets NO seeded reading: its sensorId field
|
||||
// names a resident-chosen tap label typed through the real
|
||||
// ReportReadingForm, never a literal hardware device - this app has
|
||||
// no actual sensor network, so a seed fixture that injects
|
||||
// "kiosk-1"/"kiosk-2" readings would imply equipment that doesn't
|
||||
// exist. Water Watch honestly starts at "No sensor readings yet"; the
|
||||
// real corroboration mechanism (two independent reports agreeing) is
|
||||
// demonstrated live by actually using the form, not by admin-injected
|
||||
// fixture data standing in for a device that was never built.
|
||||
|
||||
// One real hazard report (plan: richer demo data), through the same
|
||||
// reportHazard() path ReportHazardForm uses - Tunnel Safety's map and
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
import type { MiniappManifest } from "../lib/miniappManifest";
|
||||
import type { ProposalRecord, RosterEntry } from "../lib/assembly";
|
||||
import type { HousingPreference, HousingSlot, SolveHousingInput } from "../lib/housing";
|
||||
import type { WaterReading } from "../miniapps/waterwatch/corroboration";
|
||||
import type { HazardReportInput } from "../lib/tunnelsafety";
|
||||
import type { PlantingPlot, CropMaturityWindow, TemperatureEntry } from "../lib/farms";
|
||||
|
||||
@@ -310,27 +309,6 @@ export function buildDemoSkillHolderPayloads(): DemoSkillHolderPayload[] {
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* A real, independently-corroborated Water Watch alert for the Hollow demo
|
||||
* fixture: two distinct sensors (`kiosk-1`/`kiosk-2`) each report a
|
||||
* baseline-establishing pH reading, then both report the same extreme
|
||||
* contaminated value in sequence - the exact real `reportWaterReading`/
|
||||
* `createCorroborationGate` path independently verified to produce a
|
||||
* genuine "alert" `GateEvent` on the 4th reading (two independent sensors
|
||||
* agreeing is the whole mechanism this mini-app demonstrates; this is not
|
||||
* a fabricated alert state, it is replayed through the same corroboration
|
||||
* gate DeviceMonitor itself uses). Timestamps are relative offsets the
|
||||
* caller adds to `Date.now()` at load time, keeping every reading inside
|
||||
* the gate's default 5-minute corroboration window regardless of when the
|
||||
* demo is actually loaded.
|
||||
*/
|
||||
export const HOLLOW_DEMO_WATER_READINGS: ReadonlyArray<Omit<WaterReading, "timestamp"> & { timestampOffsetMs: number }> = [
|
||||
{ sensorId: "kiosk-1", channel: "pH", value: 7.1, timestampOffsetMs: 0 },
|
||||
{ sensorId: "kiosk-2", channel: "pH", value: 7.0, timestampOffsetMs: 1_000 },
|
||||
{ sensorId: "kiosk-1", channel: "pH", value: 2.0, timestampOffsetMs: 2_000 },
|
||||
{ sensorId: "kiosk-2", channel: "pH", value: 2.0, timestampOffsetMs: 3_000 },
|
||||
];
|
||||
|
||||
/**
|
||||
* One real hazard report for the Hollow demo fixture, appended through the
|
||||
* same real `reportHazard()` path `ReportHazardForm` uses - so Tunnel
|
||||
|
||||
Reference in new issue
Block a user