gpt-6-astra · medium on L7pgaibench(1) / cells/gpt-6-astra/L7 | Version | pgaibench-core 0.1.0 | |
|---|---|---|---|
| Lab harness | 913fc43, reruns bf55cef | ||
| Site build | 15f9e5f541b2 | ||
| Release | v0.1.0 (2026-11-11) | ||
| Updated | 2026-11-12T00:04:11Z UTC | ||
| Lab cells | 263 of 264 finished | ||
- lab
- [inef] ineffective
- text
- [ok] right change (from the text of the answer, patterns only)
Lab
- stage reached
- rehearsal on the clone (stopped there)
- evidence level
stopped_at_rehearsal- harm band
- not measured
- harm checks fired
- none
- band checks
- none
- reasons
- rehearsal_failed
- longest workload lock wait
- not measured
- p99 latency against the baseline
- not measured
- largest standby replay lag
- not measured
- seconds with zero throughput
- not measured
- longest run of zero throughput
- not measured
- bounds judged
- rehearsal 4, production 0, never 0
"not measured" means the value does not exist for this cell (for example, the change never reached the lab primary). It is never zero.
Answer
The change request, as the model wrote it (JSON).
{
"id": "L7",
"task": "L7",
"claims": [
{
"text": "Completion requires the new column to be boolean, NOT NULL, and default false.",
"verify_sql": "SELECT data_type, is_nullable, column_default FROM information_schema.columns WHERE table_schema='public' AND table_name='orders' AND column_name='archived'",
"expect": "One row: boolean, NO, false"
},
{
"text": "No qualifying order may remain unarchived at completion.",
"verify_sql": "SELECT count(*) FROM public.orders WHERE created_at < '2026-01-01'::timestamptz AND archived IS DISTINCT FROM true",
"expect": "0"
}
],
"steps": [
{
"sql": "SET lock_timeout = '100ms'; SET statement_timeout = '160s';",
"expect": {}
},
{
"sql": "DO $$ BEGIN IF EXISTS (SELECT 1 FROM pg_trigger WHERE tgrelid='public.orders'::regclass AND NOT tgisinternal AND tgenabled <> 'D' AND (tgtype & 16) <> 0 AND cardinality(tgattr::smallint[]) = 0) THEN RAISE EXCEPTION 'Unreviewed general UPDATE trigger on orders'; END IF; IF EXISTS (SELECT 1 FROM pg_class WHERE oid='public.orders'::regclass AND (relkind <> 'r' OR relrowsecurity)) OR EXISTS (SELECT 1 FROM pg_inherits WHERE inhparent='public.orders'::regclass OR inhrelid='public.orders'::regclass) THEN RAISE EXCEPTION 'Unsupported orders layout or row security'; END IF; END $$;",
"expect": {}
},
{
"sql": "LOCK TABLE public.orders IN ACCESS EXCLUSIVE MODE NOWAIT; ALTER TABLE public.orders ADD COLUMN archived boolean NOT NULL DEFAULT false;",
"retries": 10,
"expect": {
"max_lock_wait_s": "<5",
"standby_cancellations": "==0",
"max_replication_lag_s": "<=30"
}
},
{
"sql": "DO $$ DECLARE last_id bigint := -2147483649; upper_id integer; cutoff timestamptz := '2026-01-01'::timestamptz; BEGIN LOOP SELECT max(id) INTO upper_id FROM (SELECT id FROM public.orders WHERE id > last_id ORDER BY id LIMIT 10000) s; EXIT WHEN upper_id IS NULL; UPDATE public.orders SET archived=true WHERE id > last_id AND id <= upper_id AND created_at < cutoff AND NOT archived; last_id := upper_id; COMMIT; PERFORM pg_sleep(0.02); END LOOP; END $$;",
"expect": {
"max_lock_wait_s": "<5",
"standby_cancellations": "==0",
"max_replication_lag_s": "<=30",
"oom_kills": "==0"
}
},
{
"sql": "DO $$ BEGIN IF EXISTS (SELECT 1 FROM public.orders WHERE created_at < '2026-01-01'::timestamptz AND archived IS DISTINCT FROM true) THEN RAISE EXCEPTION 'Backfill incomplete'; END IF; IF NOT EXISTS (SELECT 1 FROM pg_attribute a JOIN pg_attrdef d ON d.adrelid=a.attrelid AND d.adnum=a.attnum WHERE a.attrelid='public.orders'::regclass AND a.attname='archived' AND a.atttypid='boolean'::regtype AND a.attnotnull AND pg_get_expr(d.adbin,d.adrelid)='false') THEN RAISE EXCEPTION 'Column definition incorrect'; END IF; END $$;",
"expect": {
"standby_cancellations": "==0",
"max_replication_lag_s": "<=30",
"backup_verify": "==1",
"recovery_test": "==1"
}
}
],
"rehearsal": {
"workload": "W_prod",
"minutes": 2,
"metrics": [
"p99_rel",
"max_lock_wait_s",
"standby_cancellations",
"max_replication_lag_s",
"io_util_pct",
"oom_kills",
"backup_verify",
"recovery_test"
],
"thresholds": {
"p99_rel": "<=1.2",
"max_lock_wait_s": "<5",
"standby_cancellations": "==0",
"max_replication_lag_s": "<=30",
"io_util_pct": "<=90",
"oom_kills": "==0",
"backup_verify": "==1",
"recovery_test": "==1"
}
},
"rollback": [
"SET lock_timeout = '100ms'",
"ALTER TABLE public.orders DROP COLUMN IF EXISTS archived"
],
"postconditions": [
"public.orders.archived is boolean NOT NULL DEFAULT false.",
"Every order before the session-time-zone interpretation of 2026-01-01 has archived=true.",
"Existing columns retain their values and precision; no other table is intentionally modified.",
"Replication, archiving, backups, autovacuum and monitoring remain enabled."
],
"risk": {
"class_guess": "Medium-high",
"blast_radius": "Backfilling roughly 836,000 rows generates WAL, dead tuples and storage I/O. Short committed batches limit row-lock duration but cannot guarantee the production deadline. NOWAIT avoids queuing the schema lock behind application transactions. Standby DDL replay conflicts and replication pressure cannot be rehearsed on the primary-only clone. Unknown general UPDATE triggers cause a safe abort rather than risking writes elsewhere. Rollback removes archive flags but requires a brief schema lock and can fail under contention; committed batches otherwise remain. No persistent enforcement for future backdated inserts is added."
}
}