From af147e2c121a42aa530222fc5f8d4758c6ceeb00 Mon Sep 17 00:00:00 2001 From: Zacharon <113211893+Zacharon@users.noreply.github.com> Date: Sun, 18 Oct 2026 12:32:05 -0400 Subject: [PATCH 1/2] Add frozen multi-site infrastructure incident evaluation Co-Authored-By: GPT-6 Astra --- docs/LAST_30_DAYS.md | 11 ++- docs/MULTI_SITE_INCIDENT_EVALUATION.md | 98 +++++++++++++++++++ docs/NEXT_TASK_QUEUE.md | 6 ++ tests/fixtures/st-petersburg-20261018.mjs | 73 ++++++++++++++ .../multi-site-incident-evaluation.mjs | 44 +++++++++ .../multi-site-incident-evaluation-tests.mjs | 45 +++++++++ tests/run-tests.mjs | 2 + 7 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 docs/MULTI_SITE_INCIDENT_EVALUATION.md create mode 100644 tests/fixtures/st-petersburg-20261018.mjs create mode 100644 tests/helpers/multi-site-incident-evaluation.mjs create mode 100644 tests/multi-site-incident-evaluation-tests.mjs diff --git a/docs/LAST_30_DAYS.md b/docs/LAST_30_DAYS.md index b965973..6811ba5 100644 --- a/docs/LAST_30_DAYS.md +++ b/docs/LAST_30_DAYS.md @@ -1,6 +1,15 @@ # Last 30 Days -Last updated: 2026-07-15. +Last updated: 2026-10-18. + +## 2026-10-18 - Frozen multi-site incident evaluation + +- Added one offline St. Petersburg four-site case and negative mutation tests in + `tests/multi-site-incident-evaluation-tests.mjs`, wired into the platform suite. +- AP/Reuters/RFE-RL search excerpts only; full-page retrieval failed. All claims + retain attribution and uncertainty; ceasefire terms remain brief-only. +- No runtime/API/provider changes. Operational-evidence/workbench and PortWatch + sample files are absent on this base. See `MULTI_SITE_INCIDENT_EVALUATION.md`. ## Merged Recently diff --git a/docs/MULTI_SITE_INCIDENT_EVALUATION.md b/docs/MULTI_SITE_INCIDENT_EVALUATION.md new file mode 100644 index 0000000..ce9f9b9 --- /dev/null +++ b/docs/MULTI_SITE_INCIDENT_EVALUATION.md @@ -0,0 +1,98 @@ +# Frozen St. Petersburg multi-site evaluation + +This is one **frozen evaluation fixture**, dated 2026-10-18, with partial source +retrieval and unverified claims. It is not live data, an operational assessment, +or a public feed feature. No provider, UI, or API imports it. + +## Source receipt and limitations + +Research on 2026-10-18 retrieved search-index excerpts, not complete article pages. +Direct page opens for AP, ITV's AP coverage, Reuters via Internazionale, +Devdiscourse and StreetInsider, and Local10 failed with `Internal Error` / +`URL ... is not accessible via this tool`. No access restrictions were bypassed. +Source timestamps below are publication metadata returned by search, not verified +event/observation times. Retrieval date has day precision. No raw articles retained. + +| Source | Publication metadata | Retained facts and attribution | +| --- | --- | --- | +| [AP](https://apnews.com/article/f813d3725b8b5f23958a68a95729fd0d) | 2026-10-18 09:49:17 UTC | Beglov: fires at two oil sites; city toll 1 killed, 5 injured. MoD: 1,015 drones intercepted. | +| [Reuters via Devdiscourse](https://www.devdiscourse.com/article/international/3994318-one-killed-five-injured-in-ukrainian-drone-attack-on-russias-st-petersburg-governor-says) | 2026-10-18 12:32 IST (07:02 UTC) | Ozon: logistics fire. VK: data center attacked, user services normal. | +| [Reuters via Yahoo Malaysia](https://malaysia.news.yahoo.com/one-killed-15-injured-ukrainian-104758436.html) | 2026-10-18 10:47 UTC | Authorities: 1 killed, 15 injured across city and Leningrad region. | +| [RFE/RL](https://www.rferl.org/a/ukraine-russia-drone-attacks-zelenskyy-airports/33878787.html) | 2026-10-18 12:07 CET, preserved as displayed | Zelenskyy: 76 energy/oil/gas attacks during prior week. Trump: energy pause announcement October 11. | +| Owner Daily Priority Brief | 2026-10-18; time unknown | No mutually confirmed ceasefire terms: **brief-only, unverified**. | + +The fixture never turns news repetition into independent physical confirmation. +Both Reuters hosts share one organization identity. The casualty reports cover +different geographic scopes: neither sum them nor allocate either to a site. +They remain unreconciled, not an inferred correction or a new city total. +No imagery was inspected, coordinates retrieved, operational closure established, +or restoration sourced. Facility operations and Ozon service impact stay unknown. +VK's service statement is a company claim, not proof of facility operability. +The interception count is not a launch total, site count, damage measure, or +independently verified observation. A ceasefire announcement does not establish +mutual terms or a violation finding. + +## Evaluation contract and use + +This local-main base lacks the operational-evidence code, workbench document, and +PortWatch frozen sample referenced by the brief. The minimal addition is an +evaluation-only schema v1 in `tests/fixtures/st-petersburg-20261018.mjs` and a +validator in `tests/helpers/multi-site-incident-evaluation.mjs`. Public +`/api/events`, its direct Netlify endpoint, and `/api/sources` are unchanged. +This is not integration proof for the absent workbench or future imports. + +Every evidence-bearing field carries source link/id, publisher, publication, +retrieval and event clocks, claimant/type, scope, confidence, verification and +evidence kind. Missing source/observation times are null; event dates are not +invented exact times. Site names and region labels identify the subjects described +by their attack records; geography has no geometry. `national-authority` and +`brief-author` avoid falsely classifying political statements as military or +independent journalism. Confidence describes establishment of the underlying +claim, not confidence that the excerpt exists. All remain unknown/unverified. + +Read-only capability `validateMultiSiteIncidentFixture/v1` accepts this frozen +case shape and returns `{valid, errors}`. It intentionally rejects new supported +facts too: a later source update needs a separately reviewed fixture revision, +not silent mutation of this snapshot. Humans and agents run the same command: + +```sh +node tests/multi-site-incident-evaluation-tests.mjs +npm test +``` + +Negative cases exercise claim-to-observation promotion, launch/damage substitution, +unsupported operations, site casualty allocation, fabricated geography, restoration, +live relabeling, provenance mismatch and collapsed assessment dimensions. Severity, +confidence, impact, corroboration, freshness and completeness remain separate. +The validator is a test utility, not an API ingestion security boundary. + +## Feature-standard scope + +This adds offline evaluation assets only. Seven product acceptance gates: + +- Shared capabilities: PASS for local evaluation; same read-only CLI test and + validator for humans/agents. +- Shared state: NOT APPLICABLE; no application state writes or new persistence. +- Scoped authority: NOT APPLICABLE; no accounts, grants or external effects. +- Human usability: PASS for CLI evaluation; readable fixture/docs and CLI errors. + No product UI introduced. +- Visible supervision: PASS for CLI evaluation; output reports failure and mutation + checks. Delegation/cancellation controls are NOT APPLICABLE to this sync test. +- Safe recovery: NOT APPLICABLE; read-only tests; Git versions assets. +- Receipts: PASS for local evaluation output; application transaction receipts + are NOT APPLICABLE because no application state changes. + +Product UI, hosted operation, live provider and real-user gates are NOT RUN. + +## Local verification, 2026-10-18 + +- `node tests/multi-site-incident-evaluation-tests.mjs`: PASS, valid case plus + 28 rejected unsafe mutations; fully offline. +- `npm.cmd test`: PASS (exit 0): platform suite, validator (10 checks, 0 failures; + 154 syntax files, 403 returned events, 20 reachable source URLs), E2E smoke and + Source Explorer smoke. Existing validator/smoke code calls provider routes; + these results do not independently verify the fixture's reporting. +- `npm.cmd run check:syntax`: PASS; Cloudflare exports valid. +- `git diff --check`: PASS. + +No push, PR, merge, production smoke or deployment performed. diff --git a/docs/NEXT_TASK_QUEUE.md b/docs/NEXT_TASK_QUEUE.md index 61503c0..a91027a 100644 --- a/docs/NEXT_TASK_QUEUE.md +++ b/docs/NEXT_TASK_QUEUE.md @@ -4,6 +4,12 @@ Small, agent-ready tasks only. Do not turn these into broad refactors. ## Context Updates +- Completed locally (2026-10-18): frozen multi-site incident evaluation and offline + semantic regression tests. See `MULTI_SITE_INCIDENT_EVALUATION.md`. Follow-up: + retrieve complete reporting/primary statements and reconcile regional casualty + scopes before any new fixture revision; integrate with a workbench only after + its absent model is available. No live activation or independent fact claim. + - In review: Strategic chokepoints v1 on `feature/strategic-chokepoints-event-intelligence-v1`. Keep follow-on provider work separate from the local registry and do not label a source live without the source-registry contract. - Completed: PR #37 created the ICM memory pack and made `AGENTS.md`, `docs/PROJECT_HANDOFF.md`, `docs/LAST_30_DAYS.md`, `docs/API_CONTRACTS.md`, `docs/SECURITY_INVARIANTS.md`, and this queue the first-read context for future agents. - In progress: Future feature structure and feature-flag documentation on branch `feature/future-feature-structure`. Keep it docs/structure-only: no runtime imports, no fake UI, no unfinished feature activation. diff --git a/tests/fixtures/st-petersburg-20261018.mjs b/tests/fixtures/st-petersburg-20261018.mjs new file mode 100644 index 0000000..c611cd5 --- /dev/null +++ b/tests/fixtures/st-petersburg-20261018.mjs @@ -0,0 +1,73 @@ +// Frozen evaluation input; never import into providers or the public event feed. +const retrievedAt = "2026-10-18"; // Date precision only; not an event/publication clock. +export const sources = { + ap: { + publisher: "Associated Press", publishedAt: "2026-10-18T09:49:17Z", + url: "https://apnews.com/article/f813d3725b8b5f23958a68a95729fd0d", + retrieval: "search-excerpt-only", retrievedAt, organization: "associated-press", + }, + reuters: { + publisher: "Reuters", host: "Devdiscourse", publishedAt: "2026-10-18T07:02:00Z", + url: "https://www.devdiscourse.com/article/international/3994318-one-killed-five-injured-in-ukrainian-drone-attack-on-russias-st-petersburg-governor-says", + retrieval: "search-excerpt-only", retrievedAt, organization: "reuters", + }, + reutersRegional: { + publisher: "Reuters", host: "Yahoo News Malaysia", publishedAt: "2026-10-18T10:47:00Z", + url: "https://malaysia.news.yahoo.com/one-killed-15-injured-ukrainian-104758436.html", + retrieval: "search-excerpt-only", retrievedAt, organization: "reuters", + }, + rferl: { + publisher: "RFE/RL", publishedAt: "2026-10-18 12:07 CET", + url: "https://www.rferl.org/a/ukraine-russia-drone-attacks-zelenskyy-airports/33878787.html", + retrieval: "search-excerpt-only", retrievedAt, organization: "rferl", + }, + brief: { + publisher: "Owner Daily Priority Brief", publishedAt: "2026-10-18", url: null, + retrieval: "brief-only", retrievedAt: null, organization: "owner-brief", + }, +}; + +function field(value, sourceId = null, claimantType = null, claimant = null, scope = null) { + return { + value, sourceId, source: sourceId ? sources[sourceId].url : null, + publisher: sourceId ? sources[sourceId].publisher : null, + publishedAt: sourceId ? sources[sourceId].publishedAt : null, + eventDate: "2026-10-18", observedAt: null, + retrievedAt: sourceId ? sources[sourceId].retrievedAt : null, + claimantType, claimant, scope, confidence: "unknown", + verification: "unverified", evidenceKind: sourceId ? "claim" : "unknown", + provenance: sourceId ? sources[sourceId].retrieval : "not-sourced", + }; +} +function site(id, name, region, sourceId, claimantType, claimant, damage) { + return { + id, name, geography: { label: region, precision: "region-label-only", geometry: null }, + reportedAttack: field("reported-targeted", sourceId, claimantType, claimant, id), + physicalDamageClaimed: damage ? field(damage, sourceId, claimantType, claimant, id) : field(null), + physicalDamageObserved: field(null), operationalStatus: field("unknown"), + casualties: field(null), commercialServiceEffects: field("unknown"), + restorationUpdates: [], restorationStatus: "pending", + dimensions: { severity: "unknown", confidence: "unknown", impact: "unknown", corroboration: 0, freshness: "frozen", completeness: "partial" }, + }; +} +const sites = [ + site("petersburg-terminal", "Petersburg Oil Terminal", "St. Petersburg", "ap", "regional-authority", "Alexander Beglov", "fire-reported"), + site("ruchi", "Ruchi oil depot", "St. Petersburg", "ap", "regional-authority", "Alexander Beglov", "fire-reported"), + site("ozon", "Ozon logistics facility", "St. Petersburg", "reuters", "company", "Ozon", "fire-reported"), + site("vk", "VK-associated data center", "Leningrad region", "reuters", "company", "VK", null), +]; +sites[3].commercialServiceEffects = field("normal-service-claimed", "reuters", "company", "VK", "VK user services; not facility operational status"); + +export const multiSiteIncidentFixture = { + schemaVersion: 1, id: "st-petersburg-multi-site-20261018", + label: "Frozen evaluation fixture - partial source retrieval, unverified claims", + mode: "frozen-evaluation", live: false, frozenOn: "2026-10-18", sources, sites, + nonSiteRecords: [ + { id: "city-casualties", kind: "casualties", evidence: field({ killed: 1, injured: 5 }, "ap", "regional-authority", "Alexander Beglov", "St. Petersburg attack; no site allocation") }, + { id: "regional-casualties", kind: "casualties", evidence: field({ killed: 1, injured: 15 }, "reutersRegional", "regional-authority", "Local authorities", "St. Petersburg and Leningrad region; no site allocation"), relationshipToCityTotal: "not-reconciled-do-not-add" }, + { id: "mod-interceptions", kind: "interception-claim", evidence: field(1015, "ap", "official-military", "Russian Ministry of Defence", "15 Russian regions, Crimea and Black Sea"), unit: "drones-claimed-intercepted", launchTotal: null, physicalDamage: null }, + { id: "ukraine-energy-attacks", kind: "attack-count-claim", evidence: field(76, "rferl", "national-authority", "Volodymyr Zelenskyy", "Ukraine energy/oil/gas; prior week"), unit: "attacks-claimed", period: "prior week as reported; exact interval unverified" }, + { id: "ceasefire-announcement", kind: "context", evidence: { ...field("energy-pause-announcement", "rferl", "national-authority", "Donald Trump", "Russia/Ukraine energy infrastructure"), eventDate: "2026-10-11" } }, + { id: "ceasefire-terms", kind: "context", evidence: field("no-mutually-confirmed-terms", "brief", "brief-author", "Owner brief", "Russia/Ukraine"), mutuallyConfirmedTerms: null }, + ], +}; diff --git a/tests/helpers/multi-site-incident-evaluation.mjs b/tests/helpers/multi-site-incident-evaluation.mjs new file mode 100644 index 0000000..b2dad7e --- /dev/null +++ b/tests/helpers/multi-site-incident-evaluation.mjs @@ -0,0 +1,44 @@ +// Evaluation-only contract: no production provider or API imports this module. +export function validateMultiSiteIncidentFixture(input) { + const errors = []; + const require = (condition, message) => { if (!condition) errors.push(message); }; + require(input?.mode === "frozen-evaluation" && input?.live === false, "fixture must remain frozen, never live"); + require(input?.label?.startsWith("Frozen evaluation fixture"), "frozen label required"); + const checkField = (field, path) => { + require(field && typeof field === "object", `${path}: evidence field required`); + if (!field) return; + for (const key of ["value", "source", "publisher", "publishedAt", "eventDate", "observedAt", "retrievedAt", "claimantType", "claimant", "scope", "confidence", "verification", "evidenceKind", "provenance"]) { + require(Object.hasOwn(field, key), `${path}: missing ${key}`); + } + const source = input.sources?.[field.sourceId]; + if (field.sourceId) { + require(Boolean(source), `${path}: missing source`); + require(field.source === source?.url && field.publisher === source?.publisher && field.publishedAt === source?.publishedAt && field.retrievedAt === source?.retrievedAt && field.provenance === source?.retrieval, `${path}: provenance mismatch`); + require(Boolean(field.claimantType && field.claimant && field.scope), `${path}: attribution required`); + require(field.evidenceKind === "claim", `${path}: sourced claim cannot become observation`); + } else { + require(field.evidenceKind === "unknown" && [null, "unknown"].includes(field.value), `${path}: unsourced value must remain unknown`); + require(field.source === null && field.publisher === null && field.claimant === null, `${path}: unsourced attribution must remain empty`); + } + // This frozen snapshot contains no independently established observations. + require(field.verification === "unverified" && field.confidence === "unknown" && field.observedAt === null, `${path}: no independent verification in this snapshot`); + }; + require(input?.sites?.length === 4, "four distinct sites required"); + require(new Set(input?.sites?.map(site => site.id)).size === 4, "site ids must be unique"); + for (const site of input?.sites || []) { + require(site.geography?.geometry === null && site.geography?.precision === "region-label-only", `${site.id}: no sourced geometry`); + for (const key of ["reportedAttack", "physicalDamageClaimed", "physicalDamageObserved", "operationalStatus", "casualties", "commercialServiceEffects"]) checkField(site[key], `${site.id}.${key}`); + require(site.physicalDamageObserved?.value === null, `${site.id}: claimed damage is not observed damage`); + require(site.operationalStatus?.value === "unknown", `${site.id}: facility operations unknown`); + require(site.casualties?.value === null, `${site.id}: aggregate casualties cannot be allocated`); + require(site.restorationUpdates?.length === 0 && site.restorationStatus === "pending", `${site.id}: restoration not sourced`); + const expected = { severity: "unknown", confidence: "unknown", impact: "unknown", corroboration: 0, freshness: "frozen", completeness: "partial" }; + require(Object.keys(site.dimensions || {}).length === 6 && Object.entries(expected).every(([key, value]) => site.dimensions?.[key] === value), `${site.id}: assessment dimensions must remain separate and unsupported values unknown`); + } + for (const record of input?.nonSiteRecords || []) checkField(record.evidence, record.id); + const interceptions = input?.nonSiteRecords?.find(record => record.id === "mod-interceptions"); + require(interceptions?.kind === "interception-claim" && interceptions?.evidence?.claimantType === "official-military" && interceptions?.unit === "drones-claimed-intercepted" && interceptions?.launchTotal === null && interceptions?.physicalDamage === null, "interceptions are military claims, not launches or damage"); + const terms = input?.nonSiteRecords?.find(record => record.id === "ceasefire-terms"); + require(terms?.mutuallyConfirmedTerms === null && terms?.evidence?.provenance === "brief-only", "ceasefire terms unconfirmed"); + return { valid: errors.length === 0, errors }; +} diff --git a/tests/multi-site-incident-evaluation-tests.mjs b/tests/multi-site-incident-evaluation-tests.mjs new file mode 100644 index 0000000..7b3ccf9 --- /dev/null +++ b/tests/multi-site-incident-evaluation-tests.mjs @@ -0,0 +1,45 @@ +import assert from "node:assert/strict"; +import { pathToFileURL } from "node:url"; +import { multiSiteIncidentFixture as fixture } from "./fixtures/st-petersburg-20261018.mjs"; +import { validateMultiSiteIncidentFixture as validate } from "./helpers/multi-site-incident-evaluation.mjs"; + +export function runMultiSiteIncidentEvaluationTests() { + assert.deepEqual(validate(fixture), { valid: true, errors: [] }); + let rejected = 0; + const rejects = (mutate, expected) => { + const candidate = structuredClone(fixture); + mutate(candidate); + const result = validate(candidate); + assert.equal(result.valid, false); + assert.match(result.errors.join("; "), expected); + rejected++; + }; + rejects(c => { c.live = true; c.mode = "live"; }, /never live/); + rejects(c => { c.label = "Live incident"; }, /frozen label/); + rejects(c => { c.nonSiteRecords[2].evidence.evidenceKind = "observation"; c.nonSiteRecords[2].evidence.verification = "independently-established"; }, /cannot become observation/); + rejects(c => { c.nonSiteRecords[2].launchTotal = 1015; }, /not launches or damage/); + rejects(c => { c.nonSiteRecords[2].physicalDamage = 1015; }, /not launches or damage/); + rejects(c => { c.nonSiteRecords[2].unit = "drones-launched"; }, /not launches or damage/); + for (let i = 0; i < 4; i++) { + rejects(c => { c.sites[i].operationalStatus.value = "closed"; }, /operations unknown/); + rejects(c => { c.sites[i].physicalDamageObserved = structuredClone(c.sites[0].physicalDamageClaimed); }, /not observed damage/); + rejects(c => { c.sites[i].casualties.value = { killed: 1, injured: 5 }; }, /cannot be allocated/); + } + rejects(c => { c.sites[3].operationalStatus = structuredClone(c.sites[3].commercialServiceEffects); }, /operations unknown/); + for (const key of ["severity", "confidence", "impact", "corroboration"]) { + rejects(c => { delete c.sites[0].dimensions[key]; c.sites[0].dimensions.score = 90; }, /dimensions must remain separate/); + } + rejects(c => { c.sites[0].dimensions.corroboration = 2; }, /dimensions must remain separate/); + rejects(c => { c.sites[0].reportedAttack.publisher = "Independent imagery"; }, /provenance mismatch/); + rejects(c => { c.sites[0].geography.geometry = { type: "Point", coordinates: [30, 60] }; }, /no sourced geometry/); + rejects(c => { c.sites[0].restorationUpdates.push("restored"); }, /restoration not sourced/); + rejects(c => { c.nonSiteRecords[5].mutuallyConfirmedTerms = "agreed"; }, /terms unconfirmed/); + assert.deepEqual(fixture.sites.map(site => site.casualties.value), [null, null, null, null]); + assert.notEqual(fixture.nonSiteRecords[0].evidence.scope, fixture.nonSiteRecords[1].evidence.scope); + assert.equal(fixture.sources.reuters.organization, fixture.sources.reutersRegional.organization); + assert.equal(fixture.sites[3].commercialServiceEffects.value, "normal-service-claimed"); + assert.equal(fixture.sites[3].physicalDamageClaimed.value, null); + console.log(`Multi-site frozen evaluation passed: valid fixture and ${rejected} rejected unsafe mutations.`); +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) runMultiSiteIncidentEvaluationTests(); diff --git a/tests/run-tests.mjs b/tests/run-tests.mjs index a38e3f8..0244fa1 100644 --- a/tests/run-tests.mjs +++ b/tests/run-tests.mjs @@ -1,4 +1,5 @@ import assert from "node:assert/strict"; +import { runMultiSiteIncidentEvaluationTests } from "./multi-site-incident-evaluation-tests.mjs"; import fs from "node:fs"; import { SEVERITIES } from "../src/config.js"; import { LAYER_CATALOG } from "../src/data/layers.js"; @@ -2087,5 +2088,6 @@ test("Chokepoint UI filtering, rendering, and event enrichment remain safe", () assert.deepEqual(enriched[0].affectedChokepoints, ["Suez Canal"]); }); +test("Frozen multi-site incident preserves claim and impact boundaries", runMultiSiteIncidentEvaluationTests); await runPendingTests(); console.log("All tests passed."); From d7f31497d22e7d2e09d32e89a3e2203324312687 Mon Sep 17 00:00:00 2001 From: Zacharon <113211893+Zacharon@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:11:41 -0500 Subject: [PATCH 2/2] Save in-progress work: Ukraine grid-region incident evaluation (schema v2) and hosted acceptance probe notes Extends the frozen multi-site incident evaluation with Reuters-attributed grid-region reports and focused query/negative tests, and records the 2026-10-19 PARTIAL hosted acceptance probe. Co-Authored-By: Claude Opus 5.5 --- docs/HOSTED_ACCEPTANCE_2026-10-19.md | 142 ++++++++++++++++++ docs/LAST_30_DAYS.md | 24 ++- docs/MULTI_SITE_INCIDENT_EVALUATION.md | 77 +++++++++- docs/NEXT_TASK_QUEUE.md | 11 ++ tests/fixtures/ukraine-grid-20261020.mjs | 78 ++++++++++ .../multi-site-incident-evaluation.mjs | 100 ++++++++++++ tests/run-tests.mjs | 2 + ...ukraine-grid-incident-evaluation-tests.mjs | 66 ++++++++ 8 files changed, 497 insertions(+), 3 deletions(-) create mode 100644 docs/HOSTED_ACCEPTANCE_2026-10-19.md create mode 100644 tests/fixtures/ukraine-grid-20261020.mjs create mode 100644 tests/ukraine-grid-incident-evaluation-tests.mjs diff --git a/docs/HOSTED_ACCEPTANCE_2026-10-19.md b/docs/HOSTED_ACCEPTANCE_2026-10-19.md new file mode 100644 index 0000000..c1a59fd --- /dev/null +++ b/docs/HOSTED_ACCEPTANCE_2026-10-19.md @@ -0,0 +1,142 @@ +# Hosted acceptance probe — October 19, 2026 + +Verdict: **PARTIAL; proposed hosted acceptance milestone remains open.** + +Observed 15:36–15:40 UTC using T3's collaborative browser. Desktop 1280×800 and +mobile layout 390×844 (desktop browser engine, not a physical mobile device). +No deployment, production configuration changes, provider activation, case import, +review approval or external publication was performed. + +## Revision and hosting identity + +Fetched `origin/main` read-only; it resolves to +`5aabf0f7903ecee7e10c12d05e7eea7113d2cf56`. This worktree stays on its separate +October 18 fixture branch. No rebase, merge or checkout was performed. + +GitHub's check-runs API reports success for validate, repo-secret-scan, +browser-secret-scan, CodeQL and Workers Builds on that revision. The Workers check +links build `cac3d61d-5a42-487b-b1bd-4543ec4f2555`. GitHub's deployments API returned +an empty array; that is not proof of no Cloudflare deployment. The serving Worker +version was not exposed by the sampled responses and was not independently bound +to the supplied `5ca83369-1dde-401a-8d72-f73f12a0ac96` version. + +- [Netlify homepage](https://liveworldmap.netlify.app/): HTTP 200, older operator + console visible; serving SHA unknown. +- [Netlify globe](https://liveworldmap.netlify.app/globe.html): fresh HTTP 404, + “Page not found.” This is a host/path observation, not a merged-code diagnosis. +- [Cloudflare homepage](https://live-map.zacharyfavaron.workers.dev/): HTTP 200, + Watch workspace visible; defaults to `mapMode=2d`. +- [Cloudflare globe](https://live-map.zacharyfavaron.workers.dev/globe.html): HTTP + 200. Normal 3D selection navigated to `/globe?...&mapMode=3d` and rendered Cesium. + +Five sampled frontend response bodies match `git show origin/main:` SHA-256: + +```text +index.html d898ffb47ec6b0a7b0288feb892f0a52d2bbdf0433b5159d3cfcbca8e21b55a6 +globe.html c56cb3ef9d835bcc853d10562db8663d2b6a77c6af785dfdc7c0ac504ac55dbd +src/app-controller.js 8dd8a724b9a050240f68b64f2a09250f0f1b25dbd6441a9915e8dd9287e65456 +src/map/cesium-adapter.js fcdec2879c94ac00e5b3b6938192aca532a383a86766d1b72205d394835f1ec2 +src/map/globe-controller.js 802e2f9cab8632cb3715f3fc2dd4a4c034688dea3b30f77bce81fbd35b96e72e +``` + +This establishes sampled frontend content parity. It does not prove the entire +deployed bundle, server code, serving version, or every asset matches that SHA. +One initial local hashing command failed due to PowerShell/native quoting; the +corrected stdin Node script produced the hashes above. No application change was +needed. + +## Genuine public-event journey + +Hosted `/api/events?hours=24` returned HTTP 200. Selected record: + +- ID `usgs:us6000u3ct`, M 5.3, 116 km WNW of Höfn, Iceland. +- [USGS source](https://earthquake.usgs.gov/earthquakes/eventpage/us6000u3ct). +- Occurred `2026-10-19T14:44:24.015Z`; source revision + `2026-10-19T14:59:53.040Z`; API `ingestedAt` `2026-10-19T15:37:10.607Z`. +- Latitude 64.5774, longitude -17.5136; provider `usgs`; reviewed in supplied + provider metadata. Source page itself was not independently opened in this run. +- Provider status reported healthy, not stale, with `stateStorageMode: memory`. + This is not evidence of durable collection or recovery. + +Clicked the ordinary report title, changed the native map-mode control to 3D, +opened the ordinary export disclosure, downloaded JSON, and used browser Back. +No synthetic event injection or demo mode was used for this journey. + +PASS observations: + +- The same ID/source/occurrence/revision appeared in list, inspector, globe + selection attribute and downloaded artifact. A selected marker and label were + visible on the desktop globe. +- Desktop 2D loaded 12 tile elements at the sampled moment. Globe loaded actual + same-origin Natural Earth JPEG tiles; network diagnostics show HTTP 200. +- Cloudflare homepage CSP has `script-src 'self' 'wasm-unsafe-eval'`; globe adds + `'unsafe-eval'`, retaining the other restrictions. No CSP refusal was found in + captured browser diagnostics. GPU ReadPixels warnings were present. +- The 2D→3D URL retained event ID, 24-hour window, filters, view, basemap, center + and zoom. Browser Back returned to the 2D homepage with those values retained. + Non-default as-of, different time windows and every filter combination were + NOT RUN. +- At 390×844, document scroll width remained 390. The globe rendered at mobile + layout and recovered after one Retry now action. Physical mobile testing and + owner visual acceptance remain NOT RUN. +- Existing `?failWebgl=1` hook explicitly disclosed forced unavailability and + retained the selected event and filters in the Leaflet fallback. This is a + forced renderer-failure probe, separate from the real API failure below. + +## Acceptance gaps and precise follow-up + +1. **Serving-version binding UNKNOWN.** Obtain read-only Cloudflare deployment + metadata linking the currently serving URL/version to the exact revision. + Sampled assets already match; no deployment is needed merely to investigate. +2. **USGS-to-case path not demonstrated.** Clicking Evidence ledger with the + USGS event selected opened `view=chokepoints`, Strait of Hormuz and + `case=portwatch-hormuz-2025-01`. The case selector exposed historical PortWatch, + synthetic Hormuz and Riyadh reporting. No USGS case entry was present. This + run therefore cannot accept the same event through Question → Evidence → + Assessment → Review → Export. Import is available, but was not used to invent + a native handoff or approval. Existing review gates were not exercised/closed. +3. **Mobile pane transition clears selection.** With the event selected in the + mobile Reports inspector, clicking Map removed `event=usgs:us6000u3ct` from + the URL and left `data-globe-selected-event` empty. This fails selection + preservation for that specific pane transition; it is distinct from the + successful desktop Back behavior. +4. **Export semantics differ.** API independentSourceCount/corroborationScore are + null and the inspector says “Independent sources: Not established.” The + snapshot card shows “Corroboration: 1”; JSON reports `distinctSourceCount: 1`, + `sourceKeys: ["usgs"]`, `display: "1 distinct source (related/co-cluster)"`. + Its caveat explicitly says this is not independent primary confirmation. + Record this as terminology/semantic parity ambiguity, not proof that JSON + claims independent verification. Inspector retrieval time also says “Not + supplied” despite API ingestedAt; document the intended clock mapping before + treating ingestion as publication or observation time. +5. **Observed API failure and recovery.** At 15:39:11 UTC console reported HTTP + 503 and `Error: API 503` in loadEvents. Mobile showed “Feed unavailable,” + “Event data temporarily unavailable,” and last successful refresh while + retaining the prior inspector. It also said “Next automatic retry + Future-dated.” This timestamp label is misleading for a scheduled future + retry. One manual Retry now later returned an Operational display with + 9/28 sources healthy; it does not explain the 503 or prove sustained recovery. + Root cause, broader host availability and stale-record export behavior remain + unverified. Do not generalize this single observed response into an outage. + +Next bounded work is version binding and these experience gaps using the merged +implementation. Native PostgreSQL concurrency/restore, hosted durable activation, +global tracking coverage and owner approval remain separate gates. No globe or +routing replacement was attempted. + +## Evidence retained locally + +Ignored directory `artifacts/hosted-acceptance-20261019/` contains: + +- `receipts.json`: browser results, source response sample, URLs, headers, sampled + hashes, globe attributes, ledger navigation, failure diagnostics and recovery. +- `usgs-export.json`: exact 12,676-byte downloaded artifact; not a case approval. +- `desktop-globe-selected.png`, `mobile-2d-selected.png`, + `mobile-feed-unavailable.png`, `mobile-map-after-retry.png`, + `forced-webgl-fallback.png`, `netlify-globe-404.png`. +- `manifest.json`: SHA-256 for those local files. These artifacts are not staged + or intended for static hosting. + +Docs-only follow-up: `git diff --check` and local receipt/export/manifest checks. +No product test suite rerun; no runtime files changed. Acceptance is bounded +browser evidence, not independent H3 or owner sign-off. diff --git a/docs/LAST_30_DAYS.md b/docs/LAST_30_DAYS.md index 6811ba5..7176d50 100644 --- a/docs/LAST_30_DAYS.md +++ b/docs/LAST_30_DAYS.md @@ -1,6 +1,28 @@ # Last 30 Days -Last updated: 2026-10-18. +Last updated: 2026-10-21. + +## 2026-10-21 - Frozen grid-region incident extension + +- Extended the existing offline multi-site evaluation container to schema v2 for + Reuters-attributed Ukrainian grid-region reports. Kept exact assets, physical + damage, outage start, restoration, and cessation verification unknown or false; + Odesa's 32,700 families is explicitly a report-time regional observation. +- Focused query/negative tests and feature-standard gates are documented in + `MULTI_SITE_INCIDENT_EVALUATION.md`. No provider, public API, or UI change. + +## 2026-10-19 - Hosted acceptance probe (PARTIAL) + +- Fetched remote main `5aabf0f` read-only; globe/workbench foundation is merged. + Older local-only/open-PR statements below remain historical. +- Cloudflare 2D/globe and real USGS source-snapshot journey worked; five frontend + assets match main. Serving Worker version remains unbound. Netlify globe 404 + was reproduced without a serving SHA. +- Mobile Map cleared selection; USGS Evidence ledger navigation opened Hormuz; + export source-count terminology differs from inspector independent evidence; + one API 503 exposed an incorrect future retry label before manual recovery. +- Details and locally retained receipts: `HOSTED_ACCEPTANCE_2026-10-19.md`. + No deployment or runtime edits. Hosted acceptance and owner review remain open. ## 2026-10-18 - Frozen multi-site incident evaluation diff --git a/docs/MULTI_SITE_INCIDENT_EVALUATION.md b/docs/MULTI_SITE_INCIDENT_EVALUATION.md index ce9f9b9..ac35f21 100644 --- a/docs/MULTI_SITE_INCIDENT_EVALUATION.md +++ b/docs/MULTI_SITE_INCIDENT_EVALUATION.md @@ -1,6 +1,6 @@ -# Frozen St. Petersburg multi-site evaluation +# Frozen multi-site incident evaluations -This is one **frozen evaluation fixture**, dated 2026-10-18, with partial source +The original St. Petersburg case is a **frozen evaluation fixture**, dated 2026-10-18, with partial source retrieval and unverified claims. It is not live data, an operational assessment, or a public feed feature. No provider, UI, or API imports it. @@ -96,3 +96,76 @@ Product UI, hosted operation, live provider and real-user gates are NOT RUN. - `git diff --check`: PASS. No push, PR, merge, production smoke or deployment performed. + +## 2026-10-21 grid-region extension (schema v2, offline) + +`tests/fixtures/ukraine-grid-20261020.mjs` extends the same multi-site +evaluation container (`sources`, `sites`, `nonSiteRecords`) and the same per-field +evidence envelope and separate assessment dimensions. The one validator +dispatches on `schemaVersion`. `sites` holds seven **regional reports**, not seven identified facilities +or map points. Five western regions are marked as newly targeted **according to +the reported statement**; Kirovohrad and Odesa are central/southern reports. +The Odesa regional record says DTEK reported **three facilities hit**. It does +not name any of them or allocate the 32,700 families among them. + +Each regional record stores `reportedTargetRegion`, `specificAsset`, +`physicalDamage`, `outageStart`, `customersAffected`, `restorationUpdate`, +`source`, and `observationTime` separately. Unknown asset, physical damage, +outage start, and restoration are explicit `null` evidence values. The Odesa +32,700 unit is **families**, with `point-in-time-at-report`, +`permanence: not-established`, and no per-incident or per-facility allocation. +The six regions without a count carry `null`, including no invented unit. The exact DTEK +observation clock is unavailable; `2026-10-20` is report-day precision, separate +from publication and retrieval. Ukrainian energy ministry officials and local +authorities reported the aggregate western expansion. Nekrasov named the +regions and central/western/southern labels; DTEK supplied the Odesa facility +count and family figure. The announced halt is context with Trump as announcer, +Zelenskiy as the speaker reporting it, unknown announcement date, an inferred +Sunday statement date (2026-10-18), and `cessationVerified: false`. It is not +a ceasefire finding. The earlier St. Petersburg fixture's October 11 halt +context is cross-referenced without treating it as a second independent source. +The Sunday Zelenskiy statement may also be the original fixture's weekly +attack-count statement; that possible match is referenced but not counted as +independent evidence. + +The [Reuters article](https://www.reuters.com/business/energy/russia-expands-attacks-energy-facilities-western-ukraine-2026-10-20/) +could not be opened directly in this environment. A +[Reuters syndication snapshot](https://uk.marketscreener.com/news/russia-expands-attacks-on-energy-facilities-to-western-ukraine-ce785cd8d88dfe2c) +was read on 2026-10-21. Its displayed publication/update times are 2026-10-20 +12:50/12:55 BST (11:50/11:55 UTC); the fixture stores a short factual snapshot, +not article text. This is one Reuters origin, not independent corroboration. + +Read-only capability `queryGridIncidentFixture/v2` takes the frozen fixture and +returns an allowlisted regional expansion, Odesa record and halt context after +`validateMultiSiteIncidentFixture` dispatches to the v2 validation branch and +rejects unsupported promotions and extra keys. Human and agent +use the same local command and validation: + +```sh +node tests/ukraine-grid-incident-evaluation-tests.mjs +``` + +Feature-standard gates 1–4 (local test environment): + +| Gate | Status | Evidence and limit | +| --- | --- | --- | +| 1 Shared capabilities | PASS for this read-only evaluation | The documented command calls the same `queryGridIncidentFixture/v2` and validator for a person or an agent. No product adapter was added. | +| 2 Shared state | NOT APPLICABLE | Query reads a versioned frozen fixture; it writes no application or user state. | +| 3 Scoped authority | NOT APPLICABLE | No user, role, grant, or external effect is involved; the fixture is local test data. This grants no ingestion permission. | +| 4 Human usability | PASS for this evaluation | A person can run the command without AI and read the JSON projection and explicit validation errors. Product UI and keyboard use are NOT RUN. | + +Gates 5–7 are NOT APPLICABLE because the capability writes no user data and +causes no external effect. This is candidate evaluation evidence only; live +provider, public API/UI, OSINT Forge storage, independently verified damage, +outage duration, and restoration remain NOT RUN or unknown. + +Local verification on 2026-10-21: `node tests/ukraine-grid-incident-evaluation-tests.mjs` +exited 0 and reported `7 regional reports, 32,700 families at report time, +25 rejected unsafe mutations`. The query JSON includes the five western names, +Odesa count 3, family count 32,700 with point-in-time and permanence caveats, +`null` asset/damage/outage/restoration values, and `cessationVerified: false`. +`npm.cmd run check:syntax` exited 0 (`Cloudflare exports are valid.`). +`npm.cmd test` exited 0: platform suite `All tests passed`; nested validator +`Result: PASS (10 checks, 0 failed)` with one `mode=partial-netlify-function` +warning; E2E and Source Explorer smoke tests passed. These are local tests, +not proof of live case data or hosted UI. diff --git a/docs/NEXT_TASK_QUEUE.md b/docs/NEXT_TASK_QUEUE.md index a91027a..1746d8d 100644 --- a/docs/NEXT_TASK_QUEUE.md +++ b/docs/NEXT_TASK_QUEUE.md @@ -4,6 +4,17 @@ Small, agent-ready tasks only. Do not turn these into broad refactors. ## Context Updates +- 2026-10-21: frozen multi-site schema v2 now has an offline Ukraine grid-region + case and report-time family impact query. Do not promote it into live ingestion; + exact assets, outage/restoration clocks, independent damage and ceasefire + verification need new source evidence. See `MULTI_SITE_INCIDENT_EVALUATION.md`. + +- 2026-10-19: foundation is merged in remote main `5aabf0f`; prioritize existing + hosted acceptance, not a globe rewrite. `HOSTED_ACCEPTANCE_2026-10-19.md` records + working Cloudflare 2D/3D/public-USGS snapshots and remaining version binding, + USGS-to-case handoff, mobile selection and failure/semantic presentation gaps. + Netlify `/globe.html` returned 404, serving SHA unknown. No deployment authorized. + - Completed locally (2026-10-18): frozen multi-site incident evaluation and offline semantic regression tests. See `MULTI_SITE_INCIDENT_EVALUATION.md`. Follow-up: retrieve complete reporting/primary statements and reconcile regional casualty diff --git a/tests/fixtures/ukraine-grid-20261020.mjs b/tests/fixtures/ukraine-grid-20261020.mjs new file mode 100644 index 0000000..27e9e55 --- /dev/null +++ b/tests/fixtures/ukraine-grid-20261020.mjs @@ -0,0 +1,78 @@ +// Frozen v2 extension of the existing multi-site evidence-envelope fixture. No provider imports. +const source = { + publisher: "Reuters", organization: "reuters", + url: "https://www.reuters.com/business/energy/russia-expands-attacks-energy-facilities-western-ukraine-2026-10-20/", + snapshotUrl: "https://uk.marketscreener.com/news/russia-expands-attacks-on-energy-facilities-to-western-ukraine-ce785cd8d88dfe2c", + retrieval: "Reuters-syndication-snapshot; direct Reuters page unavailable", + publishedAt: "2026-10-20T11:50:00Z", updatedAt: "2026-10-20T11:55:00Z", + retrievedAt: "2026-10-21T18:00:55Z", + snapshotFacts: [ + "Ukrainian energy ministry officials and local authorities reported expansion into previously untargeted western regions", + "Nekrasov named Zhytomyr, Lviv, Rivne, Ternopil, Khmelnytskyi, Kirovohrad and Odesa as struck regions", + "DTEK reported three Odesa-region energy facilities hit and 32,700 families remaining without power", + "Zelenskiy described attacks after Trump's announced energy-attack halt; cessation was not independently verified in this snapshot", + ], +}; +export const sources = { reuters: source }; + +function field(value, claimantType = null, claimant = null, scope = null, eventDate = "2026-10-20") { + const sourced = claimant !== null; + return { + value, sourceId: sourced ? "reuters" : null, + source: sourced ? source.url : null, + publisher: sourced ? source.publisher : null, + publishedAt: sourced ? source.publishedAt : null, + eventDate, observedAt: null, + retrievedAt: sourced ? source.retrievedAt : null, + claimantType, claimant, scope, confidence: "unknown", + verification: "unverified", evidenceKind: sourced ? "claim" : "unknown", + provenance: sourced ? source.retrieval : "not-sourced", + }; +} + +function region(name, area, western) { + const scope = `${name} region, Ukraine`; + return { + id: `grid-${name.toLowerCase()}`, name: `${name} regional energy report`, + siteScope: "regional-report; physical sites unidentified", + geography: { label: scope, precision: "region-label-only", geometry: null }, + reportedAttack: field("reported-targeted", "national-authority", "Artem Nekrasov", scope), + physicalDamageClaimed: field(null), physicalDamageObserved: field(null), + operationalStatus: field("unknown"), casualties: field(null), + commercialServiceEffects: field("unknown"), + restorationUpdates: [], restorationStatus: "unknown", + dimensions: { severity: "unknown", confidence: "unknown", impact: "unknown", corroboration: 0, freshness: "frozen", completeness: "partial" }, + reportedTargetRegion: field({ name, area }, "national-authority", "Artem Nekrasov", scope), + reportedExpansion: western ? field("previously-untargeted-reported", "official-sources", "Ukrainian energy ministry officials and local authorities", "western regions (aggregate); Ukraine") : field(null), + reportedFacilityCount: field(null), specificAsset: field(null), + physicalDamage: field(null), outageStart: field(null), + customersAffected: field(null), restorationUpdate: field(null), + source: { sourceId: "reuters", url: source.url }, + observationTime: { exact: null, reportedAsOfDate: "2026-10-20", precision: "day", basis: "report-day; exact source observation clock unknown" }, + }; +} + +const sites = [ + ...["Zhytomyr", "Lviv", "Rivne", "Ternopil", "Khmelnytskyi"].map(name => region(name, "western", true)), + region("Kirovohrad", "central", false), region("Odesa", "southern", false), +]; +const odesa = sites.at(-1); +odesa.reportedFacilityCount = field(3, "company", "DTEK", "Odesa region; unidentified facilities"); +odesa.customersAffected = field({ count: 32700, unit: "families", temporalScope: "point-in-time-at-report", permanence: "not-established", incidentAllocation: "not-established" }, "company", "DTEK", "Odesa regional count; no per-facility allocation"); + +export const ukraineGridIncidentFixture = { + schemaVersion: 2, id: "ukraine-grid-regional-strikes-20261020", + label: "Frozen evaluation fixture - Reuters-attributed regional grid reports", + mode: "frozen-evaluation", live: false, frozenOn: "2026-10-21", + sources, sites, + nonSiteRecords: [{ + id: "energy-attack-halt", kind: "context", + evidence: field("announced-energy-attack-halt", "national-authority", "Volodymyr Zelenskiy", "Zelenskiy's account of Donald Trump's announcement; Russia/Ukraine energy infrastructure", "2026-10-18"), + announcer: "Donald Trump", announcementDate: null, + reportedStatementDate: "2026-10-18", statementDateBasis: "Sunday inferred from Reuters Tuesday 2026-10-20 publication", + cessationVerified: false, + priorFixtureContextId: "st-petersburg-multi-site-20261018:ceasefire-announcement", + possiblePriorStatementContextId: "st-petersburg-multi-site-20261018:ukraine-energy-attacks", + observationTime: { exact: null, reportedAsOfDate: "2026-10-18", precision: "day", basis: "statement-day inferred; announcement clock unknown" }, + }], +}; diff --git a/tests/helpers/multi-site-incident-evaluation.mjs b/tests/helpers/multi-site-incident-evaluation.mjs index b2dad7e..733ec63 100644 --- a/tests/helpers/multi-site-incident-evaluation.mjs +++ b/tests/helpers/multi-site-incident-evaluation.mjs @@ -1,7 +1,11 @@ // Evaluation-only contract: no production provider or API imports this module. +import { isDeepStrictEqual } from "node:util"; + export function validateMultiSiteIncidentFixture(input) { + if (input?.schemaVersion === 2) return validateGridIncidentFixture(input); const errors = []; const require = (condition, message) => { if (!condition) errors.push(message); }; + require(input?.schemaVersion === 1, "unsupported multi-site schema version"); require(input?.mode === "frozen-evaluation" && input?.live === false, "fixture must remain frozen, never live"); require(input?.label?.startsWith("Frozen evaluation fixture"), "frozen label required"); const checkField = (field, path) => { @@ -42,3 +46,99 @@ export function validateMultiSiteIncidentFixture(input) { require(terms?.mutuallyConfirmedTerms === null && terms?.evidence?.provenance === "brief-only", "ceasefire terms unconfirmed"); return { valid: errors.length === 0, errors }; } + +const FIELD_KEYS = ["value", "sourceId", "source", "publisher", "publishedAt", "eventDate", "observedAt", "retrievedAt", "claimantType", "claimant", "scope", "confidence", "verification", "evidenceKind", "provenance"]; +const SITE_KEYS = ["id", "name", "siteScope", "geography", "reportedAttack", "physicalDamageClaimed", "physicalDamageObserved", "operationalStatus", "casualties", "commercialServiceEffects", "restorationUpdates", "restorationStatus", "dimensions", "reportedTargetRegion", "reportedExpansion", "reportedFacilityCount", "specificAsset", "physicalDamage", "outageStart", "customersAffected", "restorationUpdate", "source", "observationTime"]; +const SOURCE_FACTS = [ + "Ukrainian energy ministry officials and local authorities reported expansion into previously untargeted western regions", + "Nekrasov named Zhytomyr, Lviv, Rivne, Ternopil, Khmelnytskyi, Kirovohrad and Odesa as struck regions", + "DTEK reported three Odesa-region energy facilities hit and 32,700 families remaining without power", + "Zelenskiy described attacks after Trump's announced energy-attack halt; cessation was not independently verified in this snapshot", +]; + +function validateGridIncidentFixture(input) { + const errors = []; + const need = (condition, message) => { if (!condition) errors.push(message); }; + const keys = (object, expected, path) => need(object && typeof object === "object" && !Array.isArray(object) && Object.keys(object).length === expected.length && expected.every(key => Object.hasOwn(object, key)), `${path}: unexpected or missing keys`); + const sameArray = (actual, expected) => Array.isArray(actual) && actual.length === expected.length && actual.every((value, index) => value === expected[index]); + keys(input, ["schemaVersion", "id", "label", "mode", "live", "frozenOn", "sources", "sites", "nonSiteRecords"], "fixture"); + need(input?.schemaVersion === 2 && input?.id === "ukraine-grid-regional-strikes-20261020" && input?.label === "Frozen evaluation fixture - Reuters-attributed regional grid reports" && input?.mode === "frozen-evaluation" && input?.live === false && input?.frozenOn === "2026-10-21", "fixture identity/frozen label mismatch"); + keys(input?.sources, ["reuters"], "sources"); + const origin = input?.sources?.reuters; + keys(origin, ["publisher", "organization", "url", "snapshotUrl", "retrieval", "publishedAt", "updatedAt", "retrievedAt", "snapshotFacts"], "Reuters source"); + need(origin?.publisher === "Reuters" && origin?.organization === "reuters" && origin?.url === "https://www.reuters.com/business/energy/russia-expands-attacks-energy-facilities-western-ukraine-2026-10-20/" && origin?.snapshotUrl === "https://uk.marketscreener.com/news/russia-expands-attacks-on-energy-facilities-to-western-ukraine-ce785cd8d88dfe2c" && origin?.retrieval === "Reuters-syndication-snapshot; direct Reuters page unavailable" && origin?.publishedAt === "2026-10-20T11:50:00Z" && origin?.updatedAt === "2026-10-20T11:55:00Z" && origin?.retrievedAt === "2026-10-21T18:00:55Z" && sameArray(origin?.snapshotFacts, SOURCE_FACTS), "Reuters source snapshot mismatch"); + const checkField = (field, path, value, claimantType = null, claimant = null, scope = null, eventDate = "2026-10-20") => { + keys(field, FIELD_KEYS, path); + if (!field) return; + const sourced = claimant !== null; + need(isDeepStrictEqual(field.value, value), `${path}: unsupported value`); + need(field.sourceId === (sourced ? "reuters" : null) && field.source === (sourced ? origin?.url : null) && field.publisher === (sourced ? "Reuters" : null) && field.publishedAt === (sourced ? origin?.publishedAt : null) && field.retrievedAt === (sourced ? origin?.retrievedAt : null) && field.provenance === (sourced ? origin?.retrieval : "not-sourced") && field.evidenceKind === (sourced ? "claim" : "unknown"), `${path}: provenance/evidence mismatch`); + need(field.claimantType === claimantType && field.claimant === claimant && field.scope === scope && field.eventDate === eventDate && field.observedAt === null && field.confidence === "unknown" && field.verification === "unverified", `${path}: attribution/time/verification mismatch`); + }; + const west = ["Zhytomyr", "Lviv", "Rivne", "Ternopil", "Khmelnytskyi"]; + const expectedRegions = [...west, "Kirovohrad", "Odesa"]; + need(input?.sites?.length === 7, "seven regional reports required"); + need(sameArray(input?.sites?.map(site => site.reportedTargetRegion?.value?.name), expectedRegions), "regional expansion missing or reordered"); + for (const [index, site] of (input?.sites || []).entries()) { + const name = expectedRegions[index]; + const area = west.includes(name) ? "western" : name === "Odesa" ? "southern" : "central"; + const scope = `${name} region, Ukraine`; + const path = site?.id || `site-${index}`; + keys(site, SITE_KEYS, path); + need(site?.id === `grid-${name.toLowerCase()}` && site?.name === `${name} regional energy report` && site?.siteScope === "regional-report; physical sites unidentified", `${path}: site identity mismatch`); + keys(site?.geography, ["label", "precision", "geometry"], `${path}.geography`); + need(site?.geography?.label === scope && site?.geography?.precision === "region-label-only" && site?.geography?.geometry === null, `${path}: precise site/geometry unsupported`); + checkField(site?.reportedAttack, `${path}.reportedAttack`, "reported-targeted", "national-authority", "Artem Nekrasov", scope); + for (const key of ["physicalDamageClaimed", "physicalDamageObserved", "casualties", "specificAsset", "physicalDamage", "outageStart", "restorationUpdate"]) checkField(site?.[key], `${path}.${key}`, null); + checkField(site?.operationalStatus, `${path}.operationalStatus`, "unknown"); + checkField(site?.commercialServiceEffects, `${path}.commercialServiceEffects`, "unknown"); + need(Array.isArray(site?.restorationUpdates) && site.restorationUpdates.length === 0 && site.restorationStatus === "unknown", `${path}: restoration unknown`); + keys(site?.dimensions, ["severity", "confidence", "impact", "corroboration", "freshness", "completeness"], `${path}.dimensions`); + need(site?.dimensions?.severity === "unknown" && site?.dimensions?.confidence === "unknown" && site?.dimensions?.impact === "unknown" && site?.dimensions?.corroboration === 0 && site?.dimensions?.freshness === "frozen" && site?.dimensions?.completeness === "partial", `${path}: assessment dimensions must remain separate`); + checkField(site?.reportedTargetRegion, `${path}.reportedTargetRegion`, { name, area }, "national-authority", "Artem Nekrasov", scope); + keys(site?.reportedTargetRegion?.value, ["name", "area"], `${path}.reportedTargetRegion.value`); + if (west.includes(name)) checkField(site?.reportedExpansion, `${path}.reportedExpansion`, "previously-untargeted-reported", "official-sources", "Ukrainian energy ministry officials and local authorities", "western regions (aggregate); Ukraine"); + else checkField(site?.reportedExpansion, `${path}.reportedExpansion`, null); + if (name === "Odesa") { + checkField(site?.reportedFacilityCount, `${path}.reportedFacilityCount`, 3, "company", "DTEK", "Odesa region; unidentified facilities"); + checkField(site?.customersAffected, `${path}.customersAffected`, { count: 32700, unit: "families", temporalScope: "point-in-time-at-report", permanence: "not-established", incidentAllocation: "not-established" }, "company", "DTEK", "Odesa regional count; no per-facility allocation"); + keys(site?.customersAffected?.value, ["count", "unit", "temporalScope", "permanence", "incidentAllocation"], `${path}.customersAffected.value`); + } else { + checkField(site?.reportedFacilityCount, `${path}.reportedFacilityCount`, null); + checkField(site?.customersAffected, `${path}.customersAffected`, null); + } + keys(site?.source, ["sourceId", "url"], `${path}.source`); + need(site?.source?.sourceId === "reuters" && site?.source?.url === origin?.url, `${path}: source reference mismatch`); + keys(site?.observationTime, ["exact", "reportedAsOfDate", "precision", "basis"], `${path}.observationTime`); + need(site?.observationTime?.exact === null && site?.observationTime?.reportedAsOfDate === "2026-10-20" && site?.observationTime?.precision === "day" && site?.observationTime?.basis === "report-day; exact source observation clock unknown", `${path}: observation clock unsupported`); + } + need(input?.nonSiteRecords?.length === 1, "one halt context record required"); + const halt = input?.nonSiteRecords?.[0]; + keys(halt, ["id", "kind", "evidence", "announcer", "announcementDate", "reportedStatementDate", "statementDateBasis", "cessationVerified", "priorFixtureContextId", "possiblePriorStatementContextId", "observationTime"], "halt"); + need(halt?.id === "energy-attack-halt" && halt?.kind === "context" && halt?.announcer === "Donald Trump" && halt?.announcementDate === null && halt?.reportedStatementDate === "2026-10-18" && halt?.statementDateBasis === "Sunday inferred from Reuters Tuesday 2026-10-20 publication" && halt?.cessationVerified === false && halt?.priorFixtureContextId === "st-petersburg-multi-site-20261018:ceasefire-announcement" && halt?.possiblePriorStatementContextId === "st-petersburg-multi-site-20261018:ukraine-energy-attacks", "announced halt is not verified cessation"); + checkField(halt?.evidence, "halt.evidence", "announced-energy-attack-halt", "national-authority", "Volodymyr Zelenskiy", "Zelenskiy's account of Donald Trump's announcement; Russia/Ukraine energy infrastructure", "2026-10-18"); + keys(halt?.observationTime, ["exact", "reportedAsOfDate", "precision", "basis"], "halt.observationTime"); + need(halt?.observationTime?.exact === null && halt?.observationTime?.reportedAsOfDate === "2026-10-18" && halt?.observationTime?.precision === "day" && halt?.observationTime?.basis === "statement-day inferred; announcement clock unknown", "halt statement time mismatch"); + return { valid: errors.length === 0, errors }; +} + +export function queryGridIncidentFixture(input) { + if (input?.schemaVersion !== 2) throw new Error("grid query requires multi-site schema v2"); + const result = validateMultiSiteIncidentFixture(input); + if (!result.valid) throw new Error(result.errors.join("; ")); + const odesa = input.sites.find(site => site.reportedTargetRegion.value.name === "Odesa"); + return { + newlyReportedWesternRegions: input.sites.filter(site => site.reportedExpansion.value !== null).map(site => site.reportedTargetRegion.value.name), + odesa: { + reportedFacilityCount: odesa.reportedFacilityCount.value, + customersAffected: odesa.customersAffected.value, + specificAsset: odesa.specificAsset.value, + physicalDamage: odesa.physicalDamage.value, + outageStart: odesa.outageStart.value, + restorationUpdate: odesa.restorationUpdate.value, + source: odesa.source, + observationTime: odesa.observationTime, + }, + energyAttackHalt: { announcer: input.nonSiteRecords[0].announcer, announcementDate: input.nonSiteRecords[0].announcementDate, reportedStatementDate: input.nonSiteRecords[0].reportedStatementDate, cessationVerified: input.nonSiteRecords[0].cessationVerified }, + }; +} diff --git a/tests/run-tests.mjs b/tests/run-tests.mjs index 0244fa1..2306184 100644 --- a/tests/run-tests.mjs +++ b/tests/run-tests.mjs @@ -1,5 +1,6 @@ import assert from "node:assert/strict"; import { runMultiSiteIncidentEvaluationTests } from "./multi-site-incident-evaluation-tests.mjs"; +import { runUkraineGridIncidentEvaluationTests } from "./ukraine-grid-incident-evaluation-tests.mjs"; import fs from "node:fs"; import { SEVERITIES } from "../src/config.js"; import { LAYER_CATALOG } from "../src/data/layers.js"; @@ -2089,5 +2090,6 @@ test("Chokepoint UI filtering, rendering, and event enrichment remain safe", () }); test("Frozen multi-site incident preserves claim and impact boundaries", runMultiSiteIncidentEvaluationTests); +test("Frozen grid multi-site incident keeps regions and report-time impact separate", runUkraineGridIncidentEvaluationTests); await runPendingTests(); console.log("All tests passed."); diff --git a/tests/ukraine-grid-incident-evaluation-tests.mjs b/tests/ukraine-grid-incident-evaluation-tests.mjs new file mode 100644 index 0000000..1cc6fcb --- /dev/null +++ b/tests/ukraine-grid-incident-evaluation-tests.mjs @@ -0,0 +1,66 @@ +import assert from "node:assert/strict"; +import { pathToFileURL } from "node:url"; +import { ukraineGridIncidentFixture as fixture } from "./fixtures/ukraine-grid-20261020.mjs"; +import { queryGridIncidentFixture, validateMultiSiteIncidentFixture } from "./helpers/multi-site-incident-evaluation.mjs"; + +export function runUkraineGridIncidentEvaluationTests() { + assert.deepEqual(validateMultiSiteIncidentFixture(fixture), { valid: true, errors: [] }); + const answer = queryGridIncidentFixture(fixture); + assert.deepEqual(Object.keys(answer), ["newlyReportedWesternRegions", "odesa", "energyAttackHalt"]); + assert.deepEqual(Object.keys(answer.odesa), ["reportedFacilityCount", "customersAffected", "specificAsset", "physicalDamage", "outageStart", "restorationUpdate", "source", "observationTime"]); + assert.deepEqual(answer.newlyReportedWesternRegions, ["Zhytomyr", "Lviv", "Rivne", "Ternopil", "Khmelnytskyi"]); + assert.equal(answer.odesa.reportedFacilityCount, 3); + assert.deepEqual(answer.odesa.customersAffected, { count: 32700, unit: "families", temporalScope: "point-in-time-at-report", permanence: "not-established", incidentAllocation: "not-established" }); + assert.equal(answer.odesa.observationTime.exact, null); + assert.equal(answer.odesa.observationTime.reportedAsOfDate, "2026-10-20"); + assert.equal(answer.odesa.outageStart, null); + assert.equal(answer.odesa.restorationUpdate, null); + assert.equal(answer.odesa.specificAsset, null); + assert.equal(answer.odesa.physicalDamage, null); + assert.equal(answer.energyAttackHalt.cessationVerified, false); + assert.equal(answer.energyAttackHalt.announcer, "Donald Trump"); + assert.equal(answer.energyAttackHalt.announcementDate, null); + assert.equal(fixture.nonSiteRecords[0].evidence.eventDate, "2026-10-18"); + assert.equal(fixture.sites[6].customersAffected.evidenceKind, "claim"); + assert.deepEqual(Object.keys(fixture.sites[6].dimensions), ["severity", "confidence", "impact", "corroboration", "freshness", "completeness"]); + let rejected = 0; + const rejects = (mutate, message) => { + const changed = structuredClone(fixture); + mutate(changed); + const result = validateMultiSiteIncidentFixture(changed); + assert.equal(result.valid, false); + assert.match(result.errors.join("; "), message); + assert.throws(() => queryGridIncidentFixture(changed)); + rejected++; + }; + rejects(c => { c.sites[0].reportedTargetRegion.value.name = "Unknown"; }, /regional expansion|unsupported value/); + rejects(c => { c.sites[6].customersAffected.value.temporalScope = "permanent"; }, /unsupported value/); + rejects(c => { c.sites[6].customersAffected.value.permanence = "permanent"; }, /unsupported value/); + rejects(c => { c.sites[6].customersAffected.value.count = 32700 * 3; }, /unsupported value/); + rejects(c => { c.sites[6].specificAsset.value = "Odesa substation A"; }, /unsupported value/); + rejects(c => { c.sites[6].physicalDamage.value = "confirmed"; }, /unsupported value/); + rejects(c => { c.sites[6].outageStart.value = "2026-10-20T00:00:00Z"; }, /unsupported value/); + rejects(c => { c.sites[6].restorationUpdate.value = "restored"; }, /unsupported value/); + rejects(c => { c.sites[6].observationTime.exact = "2026-10-20T11:50:00Z"; }, /observation clock/); + rejects(c => { c.nonSiteRecords[0].cessationVerified = true; }, /not verified cessation/); + rejects(c => { c.sites[6].geography.geometry = { type: "Point", coordinates: [30, 46] }; }, /precise site/); + rejects(c => { c.sources.reuters.organization = "independent-second-source"; }, /source snapshot/); + // Independent adversarial paths found in H3 round 1: extra keys must fail closed. + rejects(c => { c.sites[6].permanentOutage = true; }, /unexpected or missing keys/); + rejects(c => { c.nonSiteRecords[0].ceasefire = "verified"; }, /unexpected or missing keys/); + rejects(c => { c.sites[6].geography.coordinates = [30.7, 46.4]; }, /unexpected or missing keys/); + rejects(c => { c.sites[6].geography.label = "Odesa TPP-2, Ukraine"; }, /precise site/); + rejects(c => { c.label = "Live grid feed"; }, /frozen label/); + rejects(c => { c.corroboration = 2; }, /unexpected or missing keys/); + rejects(c => { c.sources.ap = {}; }, /unexpected or missing keys/); + rejects(c => { c.sources.reuters.snapshotFacts[3] = "Ceasefire verified"; }, /source snapshot/); + rejects(c => { c.sites[6].customersAffected.claimant = "independent observer"; }, /attribution/); + rejects(c => { c.nonSiteRecords[0].evidence.evidenceKind = "observation"; }, /provenance/); + rejects(c => { c.sources.reuters.updatedAt = "2026-10-20T12:00:00Z"; }, /source snapshot/); + rejects(c => { c.sites[0].reportedExpansion.claimant = "Reuters"; }, /attribution/); + rejects(c => { c.sites[6].reportedTargetRegion.value.toJSON = () => ({ name: "Odesa", area: "southern" }); c.sites[6].reportedTargetRegion.value.preciseAsset = "Odesa TPP-2"; }, /unexpected or missing keys|unsupported value/); + console.log(`Ukraine grid multi-site evaluation passed: 7 regional reports, 32,700 families at report time, ${rejected} rejected unsafe mutations.`); + console.log(JSON.stringify(answer)); +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) runUkraineGridIncidentEvaluationTests();