Files
MrAlders0n 94b4b40f9b planguard: plan and result regression checks, fixture tier in CI, read-only mode (#240)
* feat(planguard): read sqlc statement text and load a strict plan corpus

* fix(planguard): fail on unextracted statements, keep fragments mode-neutral

* feat(planguard): plan assertions, scoped sort exemptions and narrow retired-index verdicts

* fix(planguard): an errored run always fails

* fix(planguard): keep subplan conds off their parent scan; fail on unanalyzed budgets

* feat(planguard): read-only plan runner, reports and the run command

* fix(planguard): validate identifiers in emitted scripts; prove read-only runs

* feat(planguard): end-state corpus, planted regressions and the generated cached-plan policy

* fix(planguard): derive observer cases from data; mark legacy generic plans

* fix(planguard): bound the dense-region route resolvers; test policy refusals

* fix(planguard): re-measure the dense-region route cases; cover every policy refusal

* feat(planguard): synthetic fixture built through the migrations, checked in CI

* ci(planguard): build the fixture once; guard fixture data for identifiers

* fix(planguard): hash every fixture generator input; harden the fixture guard

* feat(planguard): snapshot diff over every column, named result classes and cursor walks

* fix(planguard): bound the relaxed diff classes; derive the cursor tie from data

* fix(planguard): refuse multi-statement text in the corpus runner

* feat: read-only server mode and an HTTP page diff between two builds

* fix(planguard): refuse escape strings and psql meta-commands in corpus text

* fix: storediff follows each build's own cursor; prove read-only gates via the log

* fix(planguard): match the PostgreSQL lexer on high-bit bytes; check every emitted line

* feat(admin): daily read-only plan check on the maintenance pool, its metric and report

* feat(planguard): daily prod check behind planguard.daily_check

* fix(planguard): cancel fresh runs at shutdown; expose a never-ran check

* ci(planguard): pin the fixture server and collation; refresh baselines

* fix(planguard): calibrate route budgets on one dataset; skip entries whose index is absent
2026-10-19 13:45:39 -04:00

35 lines
2.2 KiB
SQL

-- Copyright 2026 Beacon Contributors
-- SPDX-License-Identifier: AGPL-3.0-or-later
-- The tables testdata/<name>.csv loads into (schema planguard_src). The CSVs hold aggregate distributions of a
-- production-sized copy only: counts by region, hour, type, rank and percentile. They hold no rows, keys, names
-- or identifiers; observers, scopes and channels appear as ranks.
SET search_path = planguard_src;
-- known_routes
CREATE TABLE routes_regions (iata char(3) NOT NULL, prod_rows bigint NOT NULL); -- routes per region
CREATE TABLE routes_iata_hop (iata char(3) NOT NULL, hop_count int NOT NULL, n bigint NOT NULL);
CREATE TABLE routes_age_obs (age_h int NOT NULL, obs_ge3 boolean NOT NULL, n bigint NOT NULL);
CREATE TABLE routes_obs (obs bigint NOT NULL, ge3 boolean NOT NULL, n bigint NOT NULL);
CREATE TABLE routes_relay (rank int NOT NULL, n bigint NOT NULL); -- relay popularity, densest region
-- packets
CREATE TABLE packets_hour (age_h int NOT NULL, n bigint NOT NULL);
CREATE TABLE packets_types (payload_type smallint NOT NULL, route_type smallint NOT NULL, n bigint NOT NULL,
n_channel bigint NOT NULL, n_origin bigint NOT NULL, n_trace bigint NOT NULL, n_scoped bigint NOT NULL);
CREATE TABLE packets_scope (rank int NOT NULL, n bigint NOT NULL);
CREATE TABLE packets_obscount (obs int NOT NULL, n bigint NOT NULL);
CREATE TABLE packets_life (p int NOT NULL, life_s float8 NOT NULL);
-- packet_observations
CREATE TABLE po_iata (iata char(3) NOT NULL, n bigint NOT NULL);
CREATE TABLE po_sites_per_packet (n_sites int NOT NULL, packets bigint NOT NULL);
CREATE TABLE po_observer (rank int NOT NULL, n bigint NOT NULL, home_iata char(3) NOT NULL); -- each observer hears at its home site
CREATE TABLE po_hop (hop_count smallint NOT NULL, n bigint NOT NULL);
CREATE TABLE po_whole_second (whole_second_pct numeric NOT NULL);
-- channel messages by channel rank, with the site that hears each channel most
CREATE TABLE cm_channel (rank int NOT NULL, n bigint NOT NULL, home_iata char(3), home_n bigint);
-- nodes
CREATE TABLE nodes_types (node_type smallint NOT NULL, n bigint NOT NULL, n_drift60 bigint NOT NULL, n_drift bigint NOT NULL);
CREATE TABLE node_iatas_iata (iata char(3) NOT NULL, n bigint NOT NULL);
RESET search_path;