Skip to content

Run records: one typed record per program run, with its build, settings and log - #132

Draft
dayfine wants to merge 17 commits into
mainfrom
common/run-records
Draft

dayfine wants to merge 17 commits into
mainfrom
common/run-records

Conversation

@dayfine

@dayfine dayfine commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Records every run of a program as a typed record with exactly one outcome, so tools such as the lab channel can say what a run did without reading the log; this is the framework half of #116, split out so it does not depend on lab tooling.

  • CommonFramework/RunRecord.h: RunRecord, RunEvent, RunResult; RunRecordStore, the last 32 runs in memory; SessionRunRecorder, the logger the session's and its consoles' loggers chain through. The first commit moves this from Lab: run records, one folder per program run #116 unchanged.
  • ProgramSession opens a run when a start is accepted and closes it with one result: completed, cancelled or failed, with the exception's message and frame. Programs report progress with the free function record_run_event(env, event).
  • Each record names the app's version, its executable path and the program's settings JSON.
  • The log is numbered line by line, so a reader can copy it out as it grows: a 256 KiB tail in memory, at most 8 MiB per run.
  • The app's store (app_run_records()) records nothing until enable_app_run_records() is called, so release users see no change. Lab: run records, one folder per program run #116 calls it when the profile has a Lab/ folder.
  • No public method is added to ProgramSession or ProgramEnvironment, and no CMake change.

Design: docs/design/Lab-RunRecords.md on #116.

Testing

  • RunRecord unit tests: store, events, numbered log and its cap, disabled store, version and settings, session recorder, and the lifecycle through a scripted fake program.
  • Full local build on macOS (Apple Clang); code-health gate passes against main. CI: see the runs linked below.
  • No console run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 2 commits November 1, 2026 13:01
The framework half of fork PR #116 (5ffec9d), unchanged: RunRecord.h
with RunRecordStore and SessionRunRecorder, ProgramSession recording
every accepted run with exactly one result, ProgramEnvironment::
run_recorder(), the console sessions' loggers chained through the run
logger, and the RunRecord unit tests. Nothing here depends on the lab
channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…efault

- Each record names the app's version, the git commit it was built from
  (PROGRAM_COMMIT, written into BuildCommit.cpp by cmake/BuildCommit.cmake
  on every build and rewritten only when the commit changes) and the
  program's settings as the settings file stores them.
- The log is numbered line by line, so a reader can copy it out as it
  grows: the store keeps a 256 KiB tail and records at most 8 MiB per run,
  counting the lines past that.
- The app's store records nothing until it is enabled; whoever reads the
  records enables it. Tests build their own, enabled stores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
…h Lab/

- The lab channel enables the app's run store when it finds the Lab/
  folder; without it nothing is recorded.
- meta.json, written when a run starts, names the program, the app's
  version, the git commit it was built from and its settings.
- log.txt is appended on each poll from the store's numbered log, up to
  8 MiB; lines the writer missed, and lines past the cap, are counted in
  the file. result.json has log_lines and dropped_log_lines in place of
  log_truncated.
- The design doc takes in RunRecords.md (the prototype's scope review),
  records the decisions and the split into #132 and #116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
…s logged

The [Segment], [Checkpoint] and [Event] lines went only to the program's
log, and an event whose game step threw left the runner with no "failed"
line. SegmentHooks gains an optional status sink that gets every line
again without its tag ("00.03/2 below_oaks_trigger: start"), for the
video overlay and, once run records land (#132), for the run's events.
An exception out of an event is logged as "[Event] ... failed: <what>"
and "[Checkpoint] ... failed at <n> <event>: <what>", then rethrown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@dayfine dayfine added game:shared Shared or game-neutral code lab-tooling Lab channel, CFR, scripts, run records, build labels Nov 1, 2026
- The progress hook is a free function, record_run_event(env, event), in
  place of the single-method RunRecorder interface; ProgramSession and
  ProgramEnvironment gain no public method (the lab reads run IDs from
  the store).
- The app's store is app_run_records(), switched on by
  enable_app_run_records(); a store takes an optional flag in place of a
  defaulted bool and set_enabled().
- start_program() and run_program() hand their accepted-start,
  preparation, download and end steps to private helpers, so neither
  grows past its old size or nesting.
- The store's events and log tests are two tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
The code-health fixes of #132.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
The code-health fixes of #132.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
- The lab channel switches on the app's store with
  enable_app_run_records() and reads the newest run ID from it (a lab app
  runs one program at a time) instead of ProgramSession::last_run_id().
- The run-writer test is four tests over a shared temporary folder:
  a running run, an ended run with its probe, missed log lines, pruning.
- Docs name record_run_event(env, event).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
For lab builds: lab/tooling (#107) with the run records. #116's branch
already joins main and #132 (common/run-records), so this is lab/tooling
plus exactly that tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
The code-health fixes of #132 and #116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Per the decision on the design: main takes no CMake change. A record
names the app's version and the path of its executable (a lab build's
folder names the build); the git commit (cmake/BuildCommit.cmake) moves
to the lab half, #116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
#132 names the executable; the git commit moves to #116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
#132 names the executable; the git commit moves here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
Per the decision on the design, the git commit lives in the lab half:
cmake/BuildCommit.cmake (moved from #132) writes PROGRAM_COMMIT on every
build, rewriting BuildCommit.cpp only when the commit changes. meta.json
names it beside the record's version and executable path. The design doc
records the five decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 1, 2026
The executable path from #132; the build commit in #116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 8 commits November 2, 2026 07:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 4 commits November 11, 2026 07:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

game:shared Shared or game-neutral code lab-tooling Lab channel, CFR, scripts, run records, build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant