Add reviews view, work-type UI updates, and permanent deploy workflow (ces-control)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
This commit is contained in:
2026-10-22 14:50:03 +00:00
parent 0a8c7fd4de
commit f5d014a022
10 changed files with 535 additions and 108 deletions
+6 -1
View File
@@ -17,7 +17,7 @@ ROLES, AGENT_AREAS, GEN_AREAS = W["roles"], W["agent_areas"], W["general_areas"]
SCHEMA = """
DROP TABLE IF EXISTS roles; DROP TABLE IF EXISTS areas; DROP TABLE IF EXISTS work_types; DROP TABLE IF EXISTS paper_work_types;
DROP TABLE IF EXISTS paper_meta; DROP TABLE IF EXISTS benchmarks; DROP TABLE IF EXISTS paper_benchmarks; DROP TABLE IF EXISTS results; DROP TABLE IF EXISTS type_notes;
DROP TABLE IF EXISTS paper_meta; DROP TABLE IF EXISTS benchmarks; DROP TABLE IF EXISTS paper_benchmarks; DROP TABLE IF EXISTS results; DROP TABLE IF EXISTS type_notes; DROP TABLE IF EXISTS type_reviews;
CREATE TABLE roles(id TEXT PRIMARY KEY, label TEXT, descr TEXT, fixes TEXT, varies TEXT, pattern TEXT, sort INT);
CREATE TABLE areas(id TEXT PRIMARY KEY, label TEXT, kind TEXT, sort INT);
CREATE TABLE work_types(id TEXT PRIMARY KEY, area TEXT REFERENCES areas(id), role TEXT REFERENCES roles(id), n_papers INT, n_llm_labeled INT);
@@ -26,6 +26,7 @@ CREATE TABLE paper_meta(paper_id INTEGER PRIMARY KEY, summary TEXT, fixes TEXT,
CREATE TABLE benchmarks(id INTEGER PRIMARY KEY, key TEXT UNIQUE, name TEXT, n_papers INT, n_new INT);
CREATE TABLE paper_benchmarks(paper_id INT, bench_id INT, purpose TEXT, is_new INT, source TEXT, PRIMARY KEY(paper_id, bench_id));
CREATE TABLE results(id INTEGER PRIMARY KEY, paper_id INT, bench_id INT, system TEXT, base_model TEXT, setting TEXT, metric TEXT, score REAL, unit TEXT);
CREATE TABLE type_reviews(type_id TEXT PRIMARY KEY, json TEXT);
CREATE TABLE type_notes(type_id TEXT PRIMARY KEY, why_same TEXT, workflow TEXT, bench_summary TEXT, narrative TEXT);
CREATE INDEX idx_pwt_type ON paper_work_types(type_id);
CREATE INDEX idx_pb_bench ON paper_benchmarks(bench_id);
@@ -149,7 +150,11 @@ def main():
if os.path.exists(nf):
for tid, n in json.load(open(nf)).items():
db.execute("INSERT OR REPLACE INTO type_notes VALUES(?,?,?,?,?)", (tid, n.get("why_same", ""), json.dumps(n.get("workflow", [])), n.get("bench_summary", ""), n.get("narrative", "")))
for f in sorted(glob.glob(os.path.join(ROOT, "data", "reviews", "*.json"))):
r = json.load(open(f))
db.execute("INSERT OR REPLACE INTO type_reviews VALUES(?,?)", (r["type_id"], json.dumps(r, ensure_ascii=False)))
db.commit()
print("reviews:", db.execute("SELECT COUNT(*) FROM type_reviews").fetchone()[0])
print("llm-labelled:", len(labelled), " rule-labelled:", n_rule, " work types:", db.execute("SELECT COUNT(*) FROM work_types").fetchone()[0],
" benchmarks:", db.execute("SELECT COUNT(*) FROM benchmarks").fetchone()[0], " results:", db.execute("SELECT COUNT(*) FROM results").fetchone()[0])
db.execute("VACUUM"); db.close()
+50
View File
@@ -0,0 +1,50 @@
#!/bin/sh
# Permanent deploy on the ces-control host: /opt/llm-survey/releases/<sha>, `current` symlink,
# systemd unit `llm-survey`. Port is never 3000 or 18131 (taken).
set -eu
SHA="${1:?usage: deploy.sh <git-sha>}"
APP=llm-survey
ROOT=/opt/$APP
PORT="${APP_PORT:-18231}"
case "$PORT" in 3000|18131) echo "refusing reserved port $PORT" >&2; exit 1;; esac
command -v node >/dev/null || { echo "node is not installed on this host" >&2; exit 1; }
node -e 'process.exit(+process.versions.node.split(".")[0] >= 18 ? 0 : 1)' || { echo "need node >= 18" >&2; exit 1; }
# port must be free, or held by our own service
if ss -ltnH "sport = :$PORT" | grep -q . && ! systemctl is-active --quiet "$APP"; then
echo "port $PORT is in use by another process" >&2; exit 1
fi
REL="$ROOT/releases/$SHA"
mkdir -p "$ROOT/releases"
rm -rf "$REL"; mkdir -p "$REL"
tar --exclude=.git --exclude=node_modules --exclude=.next -cf - . | tar -xf - -C "$REL"
cd "$REL"
test -s data/papers.db || { echo "data/papers.db missing or empty" >&2; exit 1; }
npm ci --no-audit --no-fund
npm run build
node -e 'const D=require("better-sqlite3");const d=new D("data/papers.db",{readonly:true});console.log("papers:",d.prepare("select count(*) c from papers").get().c)'
ln -sfn "$REL" "$ROOT/current.new" && mv -T "$ROOT/current.new" "$ROOT/current"
cat > /etc/systemd/system/$APP.service <<UNIT
[Unit]
Description=LLM research survey (Next.js)
After=network.target
[Service]
WorkingDirectory=$ROOT/current
Environment=NODE_ENV=production PORT=$PORT
ExecStart=$(command -v node) node_modules/next/dist/bin/next start -p $PORT -H 0.0.0.0
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
UNIT
systemctl daemon-reload
systemctl enable "$APP" >/dev/null 2>&1
systemctl restart "$APP"
for i in 1 2 3 4 5 6 7 8 9 10; do
curl -fsS -o /dev/null "http://127.0.0.1:$PORT/" && { echo "healthy on :$PORT ($SHA)"; ok=1; break; }; sleep 2
done
[ "${ok:-0}" = 1 ] || { journalctl -u "$APP" -n 40 --no-pager; exit 1; }
ls -1dt "$ROOT"/releases/* | tail -n +4 | xargs -r rm -rf