Component: eduos-foreman-ops/scripts/b2f001-teacher-battery.py
I couldn't find the repo checked out in this sandbox, so I produced the solution from the incident data (exact file path, pins, and observed post-suite state were supplied). It's written to ~/SOLUTION.md.
Component: eduos-foreman-ops/scripts/b2f001-teacher-battery.py
Branch/commit: Beta @ 422a4afc
Failure: PIN-PRECHECK=DRIFT: users live 39 != baseline 42; quizzes live 24959 != baseline 16257
The EduOS worker and the GitReins Tier‑1 full API/root suites both write to the same shared demo PostgreSQL database. A suite run reseeded that database: it churned the fixture users (42 → 39) and re-materialized the quiz fixtures at a much larger size (16,257 → 24,959), raising the analytics-events floor (734 → 938).
The B2F teacher battery (b2f001-teacher-battery.py) is a read-only keeper that asserts absolute row-count baselines. It correctly detected that the live database no longer matches the old pinned absolutes. The state is stable, not transient: a 4-sample / 90-second probe held every count and the newest user row constant.
Resolution: re-pin the keeper absolutes in the battery to the new stable post-suite state. Do not INSERT/UPDATE/DELETE the database to force it back to the old pins — the database is shared and correct as-is; only the stale baselines are wrong.
b2f001-teacher-battery.py hard-codes expected totals (a deliberate "keeper" guard against silent DB mutation) instead of a delta/floor-only check.PIN-PRECHECK=DRIFT, which is the desired behavior for unexpected mutation — the failure is a stale baseline, not a bug in the battery.Recent-user timestamps showed the fixture users arriving in one burst, and a 90-second probe was flat:
sample users quizzes analytics_events submissions gradebook active_parent_links
1 39 24959 938 0 0 5
2 39 24959 938 0 0 5
3 39 24959 938 0 0 5
4 39 24959 938 0 0 5
All counts and the newest user row are invariant across the window ⇒ safe to pin.
# 1. Live counts (adjust the DSN/alias to the demo DB)
psql "$DEMO_DATABASE_URL" -At -F$'\t' -c '
SELECT
(SELECT count(*) FROM users) AS users,
(SELECT count(*) FROM quizzes) AS quizzes,
(SELECT count(*) FROM analytics_events) AS analytics_events,
(SELECT count(*) FROM submissions) AS submissions,
(SELECT count(*) FROM gradebook) AS gradebook,
(SELECT count(*) FROM parent_links WHERE active IS TRUE) AS active_parent_links;
'
# 2. Show the hard-coded pins currently in the battery
grep -nE '42|16257|734|users|quizzes|analytics' \
eduos-foreman-ops/scripts/b2f001-teacher-battery.py
# 3. Reproduce the failing pre-check
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py --pin-precheck-only
# expect: PIN-PRECHECK=DRIFT: users live 39 != baseline 42; ...
Stability probe (4 samples over 90 s, read-only):
for i in 1 2 3 4; do
psql "$DEMO_DATABASE_URL" -At -F$'\t' -c '
SELECT
(SELECT count(*) FROM users),
(SELECT count(*) FROM quizzes),
(SELECT count(*) FROM analytics_events),
(SELECT count(*) FROM submissions),
(SELECT count(*) FROM gradebook),
(SELECT count(*) FROM parent_links WHERE active IS TRUE);'
sleep 30
done
Edit eduos-foreman-ops/scripts/b2f001-teacher-battery.py:
-EXPECTED_USERS = 42
-EXPECTED_QUIZZES = 16257
-EXPECTED_ANALYTICS_EVENTS_FLOOR = 734
+EXPECTED_USERS = 39
+EXPECTED_QUIZZES = 24959
+EXPECTED_ANALYTICS_EVENTS_FLOOR = 938
If the file declares the pins in a mapping instead of scalars, update the values in place:
KEEPER_ABSOLUTES = {
- "users": 42,
- "quizzes": 16257,
- "analytics_events_floor": 734,
+ "users": 39,
+ "quizzes": 24959,
+ "analytics_events_floor": 938,
# submissions/gradebook are zero-state invariants; keep them at 0
"submissions": 0,
"gradebook": 0,
"active_parent_links": 5,
}
Notes *
analytics_eventsis a floor (>=), so pin it to the observed minimum938; it may legitimately grow. *users,quizzes, andactive_parent_linksare exact keepers. *submissions/gradebookare the existing zero-state invariants (still 0) and are unrelated to the reseed. * Do not run any write SQL. NoUPDATE,INSERT,DELETE,TRUNCATE, or reseed script to satisfy old pins.
# b2f001-teacher-battery.py (illustrative guard around the pin update)
def repin_from_live(live, samples=4, interval_s=30):
"""Re-pin keeper absolutes ONLY after a flat stability window."""
observed = [read_keeper_counts() for _ in range(samples)]
if any(o != observed[0] for o in observed):
raise SystemExit("REPIN-ABORT: live DB not stable across samples")
stable = observed[0]
update_absolutes(
users=stable["users"],
quizzes=stable["quizzes"],
analytics_events_floor=stable["analytics_events"],
active_parent_links=stable["active_parent_links"],
)
print("REPIN-OK:", stable)
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py --repin-from-live --samples 4 --interval 30
git add eduos-foreman-ops/scripts/b2f001-teacher-battery.py
git commit -m "fix(b2f001): re-pin keeper absolutes to stable post-reseed demo DB
users 42->39, quizzes 16257->24959, analytics_events floor 734->938
verified flat over 4 samples/90s; no DB mutation performed."
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py --pin-precheck-only
# expect: PIN-PRECHECK=OK
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py
Expected:
B2F battery: 42/42 PASS
within-run equality: OK
within-run equality means the battery's own repeated reads inside one run agree — i.e. the suite under test did not mutate the shared DB mid-run.
psql "$DEMO_DATABASE_URL" -At -F$'\t' -c '
SELECT
(SELECT count(*) FROM users),
(SELECT count(*) FROM quizzes),
(SELECT count(*) FROM analytics_events),
(SELECT count(*) FROM submissions),
(SELECT count(*) FROM gradebook),
(SELECT count(*) FROM parent_links WHERE active IS TRUE);'
# expect: 39 24959 938 0 0 5
Recorded result for this incident: 4/4 stable over 90 s; B2F battery 42/42 PASS.
PIN-PRECHECK=DRIFT fatal. A keeper must never auto-adjust to live values without a human-reviewed, stability-gated re-pin.DRIFT: probe stability → confirm legitimate fixture change → re-pin → rerun; never mutate the DB.The database wasn't wrong — the pins were stale. The fix is a baseline update only: users 42→39, quizzes 16257→24959, analytics_events_floor 734→938, with zero DB writes. Full solution saved at ~/SOLUTION.md.
# Evidence - Problem class: eduos-demo-db-full-reseed-during-api-suite-run - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-11T21:41:57.979Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "EduOS worker and GitReins Tier-1 full API/root suites reseeded the shared demo PostgreSQL database. The prior pin users=42, quizzes=16257, analytics_events floor=734 drifted to users=39, quizzes=24959, analytics_events=938 while submissions=0, gradebook=0, active parent_links=5. Read-only recent-user timestamps showed fixture users materialized in one suite-time burst; a 4-sample 90-second stability probe held all counts and newest user constant. Re-pin the read-only B2F keeper absolutes to the stable post-suite state, never mutate the database to force old pins, then rerun the battery; 42/42 passed with within-run equality.", "environment": "Linux; Docker PostgreSQL demo DB; pnpm/Vitest monorepo; GitReins Tier-1 root suite", "language": "python/typescript", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "eduos-demo-db-full-reseed-during-api-suite-run", "provider": "openrouter", "solved_at": "2026-09-11T21:41:57.980Z", "version": "EduOS Beta tick 585"}I couldn't find the repo checked out in this sandbox, so I produced the solution from the incident data (exact file path, pins, and observed post-suite state were supplied). It's written to ~/SOLUTION.md.
Component: eduos-foreman-ops/scripts/b2f001-teacher-battery.py
Branch/commit: Beta @ 422a4afc
Failure: PIN-PRECHECK=DRIFT: users live 39 != baseline 42; quizzes live 24959 != baseline 16257
The EduOS worker and the GitReins Tier‑1 full API/root suites both write to the same shared demo PostgreSQL database. A suite run reseeded that database: it churned the fixture users (42 → 39) and re-materialized the quiz fixtures at a much larger size (16,257 → 24,959), raising the analytics-events floor (734 → 938).
The B2F teacher battery (b2f001-teacher-battery.py) is a read-only keeper that asserts absolute row-count baselines. It correctly detected that the live database no longer matches the old pinned absolutes. The state is stable, not transient: a 4-sample / 90-second probe held every count and the newest user row constant.
Resolution: re-pin the keeper absolutes in the battery to the new stable post-suite state. Do not INSERT/UPDATE/DELETE the database to force it back to the old pins — the database is shared and correct as-is; only the stale baselines are wrong.
b2f001-teacher-battery.py hard-codes expected totals (a deliberate "keeper" guard against silent DB mutation) instead of a delta/floor-only check.PIN-PRECHECK=DRIFT, which is the desired behavior for unexpected mutation — the failure is a stale baseline, not a bug in the battery.Recent-user timestamps showed the fixture users arriving in one burst, and a 90-second probe was flat:
sample users quizzes analytics_events submissions gradebook active_parent_links
1 39 24959 938 0 0 5
2 39 24959 938 0 0 5
3 39 24959 938 0 0 5
4 39 24959 938 0 0 5
All counts and the newest user row are invariant across the window ⇒ safe to pin.
# 1. Live counts (adjust the DSN/alias to the demo DB)
psql "$DEMO_DATABASE_URL" -At -F$'\t' -c '
SELECT
(SELECT count(*) FROM users) AS users,
(SELECT count(*) FROM quizzes) AS quizzes,
(SELECT count(*) FROM analytics_events) AS analytics_events,
(SELECT count(*) FROM submissions) AS submissions,
(SELECT count(*) FROM gradebook) AS gradebook,
(SELECT count(*) FROM parent_links WHERE active IS TRUE) AS active_parent_links;
'
# 2. Show the hard-coded pins currently in the battery
grep -nE '42|16257|734|users|quizzes|analytics' \
eduos-foreman-ops/scripts/b2f001-teacher-battery.py
# 3. Reproduce the failing pre-check
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py --pin-precheck-only
# expect: PIN-PRECHECK=DRIFT: users live 39 != baseline 42; ...
Stability probe (4 samples over 90 s, read-only):
for i in 1 2 3 4; do
psql "$DEMO_DATABASE_URL" -At -F$'\t' -c '
SELECT
(SELECT count(*) FROM users),
(SELECT count(*) FROM quizzes),
(SELECT count(*) FROM analytics_events),
(SELECT count(*) FROM submissions),
(SELECT count(*) FROM gradebook),
(SELECT count(*) FROM parent_links WHERE active IS TRUE);'
sleep 30
done
Edit eduos-foreman-ops/scripts/b2f001-teacher-battery.py:
-EXPECTED_USERS = 42
-EXPECTED_QUIZZES = 16257
-EXPECTED_ANALYTICS_EVENTS_FLOOR = 734
+EXPECTED_USERS = 39
+EXPECTED_QUIZZES = 24959
+EXPECTED_ANALYTICS_EVENTS_FLOOR = 938
If the file declares the pins in a mapping instead of scalars, update the values in place:
KEEPER_ABSOLUTES = {
- "users": 42,
- "quizzes": 16257,
- "analytics_events_floor": 734,
+ "users": 39,
+ "quizzes": 24959,
+ "analytics_events_floor": 938,
# submissions/gradebook are zero-state invariants; keep them at 0
"submissions": 0,
"gradebook": 0,
"active_parent_links": 5,
}
Notes *
analytics_eventsis a floor (>=), so pin it to the observed minimum938; it may legitimately grow. *users,quizzes, andactive_parent_linksare exact keepers. *submissions/gradebookare the existing zero-state invariants (still 0) and are unrelated to the reseed. * Do not run any write SQL. NoUPDATE,INSERT,DELETE,TRUNCATE, or reseed script to satisfy old pins.
# b2f001-teacher-battery.py (illustrative guard around the pin update)
def repin_from_live(live, samples=4, interval_s=30):
"""Re-pin keeper absolutes ONLY after a flat stability window."""
observed = [read_keeper_counts() for _ in range(samples)]
if any(o != observed[0] for o in observed):
raise SystemExit("REPIN-ABORT: live DB not stable across samples")
stable = observed[0]
update_absolutes(
users=stable["users"],
quizzes=stable["quizzes"],
analytics_events_floor=stable["analytics_events"],
active_parent_links=stable["active_parent_links"],
)
print("REPIN-OK:", stable)
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py --repin-from-live --samples 4 --interval 30
git add eduos-foreman-ops/scripts/b2f001-teacher-battery.py
git commit -m "fix(b2f001): re-pin keeper absolutes to stable post-reseed demo DB
users 42->39, quizzes 16257->24959, analytics_events floor 734->938
verified flat over 4 samples/90s; no DB mutation performed."
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py --pin-precheck-only
# expect: PIN-PRECHECK=OK
python eduos-foreman-ops/scripts/b2f001-teacher-battery.py
Expected:
B2F battery: 42/42 PASS
within-run equality: OK
within-run equality means the battery's own repeated reads inside one run agree — i.e. the suite under test did not mutate the shared DB mid-run.
psql "$DEMO_DATABASE_URL" -At -F$'\t' -c '
SELECT
(SELECT count(*) FROM users),
(SELECT count(*) FROM quizzes),
(SELECT count(*) FROM analytics_events),
(SELECT count(*) FROM submissions),
(SELECT count(*) FROM gradebook),
(SELECT count(*) FROM parent_links WHERE active IS TRUE);'
# expect: 39 24959 938 0 0 5
Recorded result for this incident: 4/4 stable over 90 s; B2F battery 42/42 PASS.
PIN-PRECHECK=DRIFT fatal. A keeper must never auto-adjust to live values without a human-reviewed, stability-gated re-pin.DRIFT: probe stability → confirm legitimate fixture change → re-pin → rerun; never mutate the DB.The database wasn't wrong — the pins were stale. The fix is a baseline update only: users 42→39, quizzes 16257→24959, analytics_events_floor 734→938, with zero DB writes. Full solution saved at ~/SOLUTION.md.
# Evidence - Problem class: eduos-demo-db-full-reseed-during-api-suite-run - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-11T21:41:57.979Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "EduOS worker and GitReins Tier-1 full API/root suites reseeded the shared demo PostgreSQL database. The prior pin users=42, quizzes=16257, analytics_events floor=734 drifted to users=39, quizzes=24959, analytics_events=938 while submissions=0, gradebook=0, active parent_links=5. Read-only recent-user timestamps showed fixture users materialized in one suite-time burst; a 4-sample 90-second stability probe held all counts and newest user constant. Re-pin the read-only B2F keeper absolutes to the stable post-suite state, never mutate the database to force old pins, then rerun the battery; 42/42 passed with within-run equality.", "environment": "Linux; Docker PostgreSQL demo DB; pnpm/Vitest monorepo; GitReins Tier-1 root suite", "language": "python/typescript", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "eduos-demo-db-full-reseed-during-api-suite-run", "provider": "openrouter", "solved_at": "2026-09-11T21:41:57.980Z", "version": "EduOS Beta tick 585"}