From 7fe7d8c4c4afd98b222ab6262e4e264b889999ad Mon Sep 17 00:00:00 2001 From: Michael B Reiser Date: Sun, 6 Sep 2026 17:57:18 -0400 Subject: [PATCH] =?UTF-8?q?feat(studio):=20gzip=20run-log=20commits=20(.js?= =?UTF-8?q?onl.gz),=20behavior=5Fv2=20default,=20bridge=20log-level=20ack?= =?UTF-8?q?=20(PR=202=20of=20runlog-behavior-v2-plan)=20=E2=80=94=20Studio?= =?UTF-8?q?=20v0.72?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Studio side of docs/development/runlog-behavior-v2-plan.md (Part 1 §5 + Part 2). Stacks on PR #183 (bridge). Readers (dashboard / replay viewer) are PR 3 — until it lands, .jsonl.gz files need gunzip or `bridge.py --convert`. - js/fictrac-bridge-client.js: LOG_LEVELS [behavior_v2, behavior_v1, full] (v2 default); handles hello_ack (bridgeInfo, bridgeSupportsLevel) and log_control_ack (ackedLogLevel, cleared on every setLogging and on close); new 'loglevel' event + an err log line when the bridge cannot write the requested level; waitForLogLevelAck(ms) → acked level or null (old bridge). - js/studio-github.js: gzipBytes (CompressionStream) + isGzip; Git Database builders (reqCreateBlob/reqGetCommit/reqCreateTree/reqCreateCommit/ reqUpdateRef, allowlisted, fast-forward only); directCommitLarge (7-call blob→tree→commit→ref sequence, per-step errors); commitFile routes by size (LARGE_FILE_BYTES = 30 MiB) and reports via + bytes. - arena_studio.html v0.72: File ▾ → Run logging offers behavior_v2 (default) / behavior_v1 (legacy) / full; Console mirror follows the bridge's ack (⚠ on mismatch); run start awaits the ack ≤ 800 ms, names the level in the banner + transcript and warns "bridge too old for behavior_v2 — logging behavior_v1" (or "did not confirm" for a pre-3.0 bridge); run_metadata gains log_format; commitRunLog gzips the export → runlogs//.jsonl.gz via GH.commitFile (raw .jsonl fallback without CompressionStream) and shows raw → gz size + the path used. - Tests: test-fictrac-bridge-client.js 42 → 71 checks (levels, hello_ack, log_control_ack, mismatch, waiters, close reset); test-studio-github.js 118 → 160 (gzip round trip via zlib, git-db builders + token containment, directCommitLarge sequence + failure step, commitFile routing, Studio wiring assertions on the HTML). - Docs: release notes v0.72, cshl-pipeline-test-plan size-limits, CLAUDE.md Studio rule, plan doc status + PR 2 notes (merge with/after PR 3). Co-Authored-By: Claude Fable 5.1 --- CLAUDE.md | 11 + arena_studio.html | 111 +++++-- .../development/arena-studio-release-notes.md | 23 ++ docs/development/cshl-pipeline-test-plan.md | 14 +- docs/development/runlog-behavior-v2-plan.md | 38 ++- js/fictrac-bridge-client.js | 172 +++++++++- js/studio-github.js | 185 ++++++++++- tests/test-fictrac-bridge-client.js | 160 ++++++++- tests/test-studio-github.js | 307 ++++++++++++++++++ 9 files changed, 973 insertions(+), 48 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index f00ce17..2614fb4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -292,6 +292,17 @@ fix flows to every page automatically; two hand-written HTML pages never will. recurring mistake. The changelog lives ONLY in `docs/development/arena-studio-release-notes.md` — add an entry there for user-visible changes. +- **Run logs are `.jsonl.gz` (v0.72+, `docs/development/runlog-behavior-v2-plan.md`).** + `commitRunLog` gzips the bridge export (`GH.gzipBytes`) and commits + `runlogs//.jsonl.gz` via `GH.commitFile`, which routes >30 MiB payloads + through the Git Database API (`GH.directCommitLarge`) because the Contents API + rejects ~35 MiB+ files. Every reader (dashboard, replay viewer, adapter) must inflate + on the gzip magic and accept both `behavior_v1` and `behavior_v2` line formats. The + log level is a runtime setting (File ▾ → Run logging, localStorage `studio_log_level`, + default `behavior_v2`); the runner asserts it via `log_control` and the bridge ACKS + the level it will actually write (`bridge.waitForLogLevelAck`) — a pre-3.0 bridge + never acks, so treat "no ack" as behavior_v1. Never write `log_format` into + `run_metadata` from anything but the acked/inferred level. - Bump the footer version/timestamp on every edit; never Prettier the HTML. ## Pattern Designer (`pattern_editor.html`) diff --git a/arena_studio.html b/arena_studio.html index dc56446..a5928ab 100644 --- a/arena_studio.html +++ b/arena_studio.html @@ -2134,8 +2134,9 @@
- + +
→ writes a local .yaml file (sign in to GitHub to open a PR instead)
@@ -2249,7 +2250,7 @@

Sequence · test any single condition ▶ Clear - + @@ -2917,7 +2918,7 @@

Import error