From 430d59a2e8d7ec793dc494a00edc6288b4925588 Mon Sep 17 00:00:00 2001 From: Justin Visser Date: Thu, 18 Jun 2026 20:10:27 +0200 Subject: [PATCH] web: regenerate types and sync for the new forwarding levers go generate brings novelty, harmAwareness, programEffect into the generated Config and Bounds; preset base, field labels, the clamp switch, and the test fixtures pick them up. No UI for them yet (that is the next slice); behaviour and the demo are unchanged. type-check, unit tests and lint all green, so CI's type-drift guard is satisfied. --- web/src/components/__tests__/ResultsTable.spec.ts | 3 +++ web/src/composables/__tests__/useSimStore.spec.ts | 3 +++ web/src/lib/__tests__/bounds.spec.ts | 6 ++++++ web/src/lib/__tests__/urlState.spec.ts | 3 +++ web/src/lib/bounds.ts | 6 ++++++ web/src/lib/fieldLabels.ts | 3 +++ web/src/presets/deepfake-school.ts | 3 +++ web/src/types/engine.ts | 13 ++++++++++++- 8 files changed, 39 insertions(+), 1 deletion(-) diff --git a/web/src/components/__tests__/ResultsTable.spec.ts b/web/src/components/__tests__/ResultsTable.spec.ts index 17d3a6f..6ea26ca 100644 --- a/web/src/components/__tests__/ResultsTable.spec.ts +++ b/web/src/components/__tests__/ResultsTable.spec.ts @@ -12,6 +12,9 @@ const base: Config = { edgesPerNode: 2, triangleProb: 0.4, forwardProb: 0.5, + novelty: 0, + harmAwareness: 0, + programEffect: 1, numEducated: 3, origin: 0, graphSeed: 1, diff --git a/web/src/composables/__tests__/useSimStore.spec.ts b/web/src/composables/__tests__/useSimStore.spec.ts index 943b2a8..eec9286 100644 --- a/web/src/composables/__tests__/useSimStore.spec.ts +++ b/web/src/composables/__tests__/useSimStore.spec.ts @@ -23,6 +23,9 @@ const TEST_BOUNDS: Bounds = { edgesPerNode: { min: 1, max: 8 }, triangleProb: { min: 0, max: 1 }, forwardProb: { min: 0, max: 0.9 }, + novelty: { min: 0, max: 1 }, + harmAwareness: { min: 0, max: 1 }, + programEffect: { min: 0, max: 1 }, } // The fake engine: numReached mirrors numEducated so tests can tell which diff --git a/web/src/lib/__tests__/bounds.spec.ts b/web/src/lib/__tests__/bounds.spec.ts index 8d29f55..7db9670 100644 --- a/web/src/lib/__tests__/bounds.spec.ts +++ b/web/src/lib/__tests__/bounds.spec.ts @@ -8,6 +8,9 @@ const bounds: Bounds = { edgesPerNode: { min: 1, max: 8 }, triangleProb: { min: 0, max: 1 }, forwardProb: { min: 0, max: 0.9 }, + novelty: { min: 0, max: 1 }, + harmAwareness: { min: 0, max: 1 }, + programEffect: { min: 0, max: 1 }, } const config: Config = { @@ -15,6 +18,9 @@ const config: Config = { edgesPerNode: 3, triangleProb: 0.45, forwardProb: 0.38, + novelty: 0, + harmAwareness: 0, + programEffect: 1, numEducated: 36, origin: 0, graphSeed: 17, diff --git a/web/src/lib/__tests__/urlState.spec.ts b/web/src/lib/__tests__/urlState.spec.ts index ef2af93..8bbfbfc 100644 --- a/web/src/lib/__tests__/urlState.spec.ts +++ b/web/src/lib/__tests__/urlState.spec.ts @@ -16,6 +16,9 @@ const preset: StudyPreset = { edgesPerNode: 3, triangleProb: 0.45, forwardProb: 0.38, + novelty: 0, + harmAwareness: 0, + programEffect: 1, numEducated: 36, origin: 0, graphSeed: 17, diff --git a/web/src/lib/bounds.ts b/web/src/lib/bounds.ts index 6e88ea5..e02de3b 100644 --- a/web/src/lib/bounds.ts +++ b/web/src/lib/bounds.ts @@ -39,6 +39,12 @@ export function clampConfigField( return clampNumber(rounded, bounds.triangleProb.min, bounds.triangleProb.max) case 'forwardProb': return clampNumber(rounded, bounds.forwardProb.min, bounds.forwardProb.max) + case 'novelty': + return clampNumber(rounded, bounds.novelty.min, bounds.novelty.max) + case 'harmAwareness': + return clampNumber(rounded, bounds.harmAwareness.min, bounds.harmAwareness.max) + case 'programEffect': + return clampNumber(rounded, bounds.programEffect.min, bounds.programEffect.max) case 'numEducated': return clampNumber(rounded, 0, numStudents) case 'origin': diff --git a/web/src/lib/fieldLabels.ts b/web/src/lib/fieldLabels.ts index 153c82e..cabebff 100644 --- a/web/src/lib/fieldLabels.ts +++ b/web/src/lib/fieldLabels.ts @@ -7,7 +7,10 @@ export const CONFIG_FIELD_LABELS: Record = { edgesPerNode: 'Friends per student', triangleProb: 'Clique tendency', forwardProb: 'Chance to forward', + novelty: 'Novelty / shock', + harmAwareness: 'Harm awareness', numEducated: 'Education budget', + programEffect: 'Program strength', origin: 'First poster', graphSeed: 'Friendship network', thresholdSeed: 'Who resists', diff --git a/web/src/presets/deepfake-school.ts b/web/src/presets/deepfake-school.ts index 3cb5386..85136f6 100644 --- a/web/src/presets/deepfake-school.ts +++ b/web/src/presets/deepfake-school.ts @@ -28,6 +28,9 @@ export const deepfakeSchoolPreset: StudyPreset = { edgesPerNode: 3, triangleProb: 0.45, forwardProb: 0.38, + novelty: 0, + harmAwareness: 0, + programEffect: 1, numEducated: 36, origin: 0, graphSeed: 17, diff --git a/web/src/types/engine.ts b/web/src/types/engine.ts index dc412a9..85692eb 100644 --- a/web/src/types/engine.ts +++ b/web/src/types/engine.ts @@ -20,8 +20,16 @@ export interface Config { numStudents: number /* int */; edgesPerNode: number /* int */; // attachment edges per new student (network density) triangleProb: number /* float64 */; // chance to close a friend-of-a-friend triangle - forwardProb: number /* float64 */; // chance a student forwards the fake along an edge + /** + * Forwarding is an additive composite (see ForwardChance): a baseline + * propensity, raised by how novel/shocking the fake is, lowered by the + * year group's ambient harm awareness. + */ + forwardProb: number /* float64 */; // baseline chance a student forwards the fake along an edge + novelty: number /* float64 */; // how novel/shocking the fake is (0..1); raises forwarding + harmAwareness: number /* float64 */; // ambient AI-literacy / harm awareness in the year group (0..1); lowers forwarding numEducated: number /* int */; // students the education program reaches + programEffect: number /* float64 */; // how strongly the program suppresses an educated student's forwarding (0..1; 1 = never forwards) origin: number /* int */; // student who first posts the fake graphSeed: number /* uint64 */; thresholdSeed: number /* uint64 */; @@ -53,6 +61,9 @@ export interface Bounds { edgesPerNode: IntBounds; triangleProb: FloatBounds; forwardProb: FloatBounds; + novelty: FloatBounds; + harmAwareness: FloatBounds; + programEffect: FloatBounds; } /** * Result is the outcome of one scenario run.