Files
felhom.eu/documentation/audits/night-2026-09-23/bigdb.py
T
admin 3e58c184f6
gates / gates (push) Successful in 27s
night shift 2026-09-23: the record, the register, the morning note
DRILL-night-2026-09-23.md: Parts A-E. 09 §3 decisions 21 (operator word),
22 and 23 (CC unattended, operator may reverse); §6.4 parts 4 and 6
(catalog half) shipped; §6.1a residuals R-658/R-659. Register 330 -> 336:
R-651..R-660 opened (R-658 and R-659 P1), R-650/R-640/R-499/R-626 closed.
Capability map, nightly rotation (opengist), STATUS (one question: the
floor), CONTEXT, REPORT. The floor stays 0.266.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-09-24 00:24:04 +02:00

32 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Make docmost the BIG database of the chaos hour, through its own API with ONE login (its login is
rate-limited: 290 of 300 per-call logins answered 401 in setup). Spaces with a 4 KB description each,
then the database size asked of PostgreSQL itself."""
import json, os, sys, time
sys.path.insert(0, ".")
import walk as w
from chaos import load, save, sub_of
s = load(); A = s["apps"]["docmost"]["A"]; sub = sub_of("docmost")
w.login()
jar = f"{w.SC}/big.jar"
rc, code, out = w.app_curl(sub, "/api/auth/login", "-c", jar, "-H", "Content-Type: application/json",
data=json.dumps({"email": A["email"], "password": A["pw"]}), method="POST")
w.say(f"login http={code}")
ok = 0
desc = ("chaos-hour big database filler " * 140)[:4000]
for i in range(400):
name = f"big{i:03d}{os.urandom(2).hex()}"
rc, code, out = w.app_curl(sub, "/api/spaces/create", "-b", jar, "-H", "Content-Type: application/json",
data=json.dumps({"name": name, "slug": name, "description": desc}), method="POST")
if code in ("200", "201"):
ok += 1
elif i < 5 or i % 50 == 0:
w.say(f" {i}: http={code} {out[:120]}")
w.say(f"created {ok} spaces with one login")
size = w.guest("docker exec docmost-postgres psql -U docmost -d docmost -Atc \"select pg_size_pretty(pg_database_size('docmost')), (select count(*) from spaces)\"")
w.say(f"docmost database: {size.strip()}")
s["apps"]["docmost"]["big_extra_spaces"] = s["apps"]["docmost"].get("big_extra_spaces", 0) + ok
s["apps"]["docmost"]["db_size"] = size.strip()
save(s)
open("chaos/00-bigdb.log", "w").write("\n".join(w.LOG) + "\n")