From 77bd349ab8e0fed409c9fd38903dfb78444275c6 Mon Sep 17 00:00:00 2001 From: ProjectFuritsu Date: Fri, 27 Nov 2026 13:00:30 +0800 Subject: [PATCH] v2 is the main version: freeze the converter, require data-v2 - scripts/convert-v2.mjs: frozen; stops unless run with --unfreeze, since a re-run would undo direct v2 edits. Its last run after PR #18 changed nothing. - validate.mjs and the Worker tests now fail if data-v2/ is missing, so the v2 checks always run. - MAINTAINING.md and CHANGELOG.md: v2 is the source of truth; v1 (data/) is frozen and stays online read-only until a stop date is agreed. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 +++ MAINTAINING.md | 2 ++ scripts/convert-v2.mjs | 8 ++++++++ scripts/validate.mjs | 2 ++ worker/test/worker.test.mjs | 5 +++-- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2a3513..5135d7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ Dates are Philippine time (UTC+8). See [MILESTONES.md](MILESTONES.md) for the bi - AMUMA: removed the landline (082) 295-2133. PhilHealth's official directory lists it as PhilHealth Regional Office XI's trunkline. - SSS (Financial #2): `bgImageURL` is now empty. The old link (https://www.sss.gov.ph/sss/images/SSS_Building.jpg) returns 404 (checked 2026-11-27). Apps show no background image until an official one is found. +### Repo: v2 is the main version +- `data-v2/` is now the source of truth: v2 is edited directly, and validate and the Worker tests require it. `data/` (v1) is frozen and stays online read-only until a stop date is agreed. `scripts/convert-v2.mjs` is frozen (it stops unless run with `--unfreeze`); its last run after PR #18 changed nothing. + ### v2 (in development, not public) A new data shape, to be served at `/v2/…` next to v1. Not live yet; v1 is unchanged by it. - Institutions get `branches` (address, map point, hours and contacts per office). diff --git a/MAINTAINING.md b/MAINTAINING.md index 6ebcd02..bacc5ea 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -68,6 +68,8 @@ The smoke test fetches every file from the public URL and checks status `200`, t ## Changing the data +**v2 is the source of truth (since 2026-11-27).** Edit `data-v2/` and its schemas directly. `data/` (v1) and `scripts/convert-v2.mjs` are frozen: v1 stays online read-only, marked deprecated, until a stop date agreed with the app team. The converter stops unless run with `--unfreeze`, because a re-run would undo v2 edits. Validate and the Worker tests fail if `data-v2/` is missing. + Check locally before you push: ```bash diff --git a/scripts/convert-v2.mjs b/scripts/convert-v2.mjs index 0f3f459..42c9015 100644 --- a/scripts/convert-v2.mjs +++ b/scripts/convert-v2.mjs @@ -1,3 +1,7 @@ +// FROZEN since 2026-11-27. v2 is the source of truth: edit data-v2/ and its +// schemas directly. A re-run would overwrite those edits with v1, so the script +// stops unless --unfreeze is given. The last run (after PR #18) changed nothing. +// // Converts the v1 data in data/ to the v2 shape in data-v2/. // Values are copied as written. Nothing is guessed: a value the v1 data // doesn't have becomes null or an empty list ("Not given" in apps). @@ -13,6 +17,10 @@ import { join } from "node:path"; import { execFileSync } from "node:child_process"; const args = process.argv.slice(2); +if (!args.includes("--unfreeze")) { + console.error("convert-v2.mjs is frozen (2026-11-27): edit data-v2/ directly. A re-run would undo v2 edits. Use --unfreeze only to compare."); + process.exit(1); +} const provDir = args.includes("--provenance") ? args[args.indexOf("--provenance") + 1] : null; const read = (p) => JSON.parse(readFileSync(p, "utf8")); diff --git a/scripts/validate.mjs b/scripts/validate.mjs index 08c6af8..9c64882 100644 --- a/scripts/validate.mjs +++ b/scripts/validate.mjs @@ -13,6 +13,8 @@ import { const DATA_DIR = "data"; // v2 data (served at /v2/) lives in data-v2/ with the same layout and rules. +// v2 is the main version since 2026-11-27, so data-v2/ must exist. v1 (data/) is frozen. +if (!existsSync("data-v2")) { console.error("FAIL data-v2/ is missing: v2 is the main version"); process.exit(1); } const DATA_DIRS = [DATA_DIR, "data-v2"].filter(d => existsSync(d)); const datasetDirs = () => DATA_DIRS.flatMap(base => readdirSync(base, { withFileTypes: true }).filter(f => f.isDirectory()).map(f => join(base, f.name))); diff --git a/worker/test/worker.test.mjs b/worker/test/worker.test.mjs index ffe71fa..0a6e933 100644 --- a/worker/test/worker.test.mjs +++ b/worker/test/worker.test.mjs @@ -93,8 +93,9 @@ execFileSync("node", ["scripts/build-site.mjs"], { cwd: root, stdio: "inherit", rmSync(imgDir, { recursive: true, force: true }); const index = JSON.parse(readFileSync(join(here, "..", "dist", "index.json"), "utf8")); const files = index.datasets.flatMap(d => [d.data, d.schema]).map(p => p.slice(1)); -// v2 is built only when data-v2/ exists; its tests run only then. -const hasV2 = existsSync(join(root, "data-v2")); +// v2 is the main version since 2026-11-27: data-v2/ must exist, so its tests always run. +if (!existsSync(join(root, "data-v2"))) throw new Error("data-v2/ is missing: v2 is the main version"); +const hasV2 = true; const indexV2 = hasV2 ? JSON.parse(readFileSync(join(here, "..", "dist", "v2", "index.json"), "utf8")) : null; const filesV2 = hasV2 ? indexV2.datasets.flatMap(d => [d.data, d.schema]).map(p => p.slice(1)) : [];