Repository navigation
fix!: make replays strict, record every failure, and fix the names and docs that a third review found - #34
Merged
Merged
Conversation
…d docs that a third review found - A replay fails when the domain gives no choices where the recorded run had some, when the trace is of another domain or case, and the replay command then exits with an error. It notes a changed definition, takes the trace's limits from the trace, and a fork counts only steps with a pick and a state. - The trace starts with the definition's hash and the case id, records why the steps ended before the answers, ends with the answers or their failure, keeps how many choices the limit cut, and records the error that stopped a case. - result.json records that error as `thrown`, and the steps and answers that the case still had. A case that throws before it starts, or whose earlier trace is missing, also gets a result and a trace. A case that runs again loses its old result first. A set's case must have its folder's id. `--state-from` is kept as a full path. - The loop refuses a choices limit under 2 and a question with the pick's id before any request, sends a request once when there is no view function, and does not take an object's built-in names as labels. - Images are pi-ai's, with a label, and `decisionImages` is optional. `outcome` gets only the run's result. A choice type's transition gets the choice's key, from `typedKey`, which legal-judge now uses. The totals sum every usage count and name the requests `requests`. - Names: `progress`, `progressLine`, `ViewerError`, `replyTo`, chess's `gameAfter`, `EngineReply` and `query`. - Docs: the README, AGENTS.md (the scope of the `decision` prefix), docs/MATH.md and the package READMEs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A third independent review of switch after #33 found 37 more places where the code did something other than what its docs say.
The worst were in replay: a replay could end early and still say that it matched, and the
replaycommand exited with code 0 when the case did not repeat its trace.This change makes replays fail whenever they do not repeat the trace, gives every case a result and a readable trace however it fails, and fixes the names and docs that disagreed with the code.
It also writes down that only the fields of the decision request and the decision result take the
decisionprefix.What Changed
Replay now checks everything that it can check, and a run records every failure where a reader of the run folder looks for it.
The other changes are small corrections of names, types and docs.
replaycommand then exits with code 1. A changed definition is noted in the replay's trace.Replaycarries the trace's start entry, soruntakes the recorded limits itself, andRunOptions.limitsgoes. A fork counts only the steps that have a pick and a state.run --state-fromneeds only the earlier steps to have ended.endedentry records why the steps ended before the answers, and theanswersentry, with the answers or why they failed, ends the run; theendentry goes. Achoicesentry says how many choices the limit cut. Athrownentry records the error that stopped a case, in place of the note "the case failed".result.jsongetsthrown, and keeps the ending and the answers that a case still had when it threw after its steps, for example inoutcome. A case that fails incaseId,loador its earlier trace still gets a result and a trace with its start, and the totals count it. A case that runs again loses its old result first, so the viewer follows it. A set's case must have the id of its folder.--state-fromis kept as a full path. The totals sumcacheWrite1handreasoningtoo, and call the countrequests.toString.Imageis pi-ai's image with a label, anddecisionImagesis optional, as pi-ai'simagesis.outcomegets only the run's result. A choice type's transition gets the picked choice's key, whichtypedKeymakes; legal-judge builds each key once with it. The default definition moves todefinitionFor, andlimitsOfgoes.progressandprogressLinereplacelogand the CLI'sstoryOf.ViewerErrorandreplyToreplaceViewErrorand the server'sanswer. In chess,gameAfter,EngineReplyandqueryreplacereplay,Answerandask, and the tests dropworld. The word test also scans switch's and the viewer's tests.AGENTS.md,docs/MATH.mdand the package READMEs follow. The definition is now described as what a domain lets a run vary; the texts in a domain's code come with its version.Testing
I ran every check of switch, the viewer and both examples, and played and replayed a chess game with the fake decider.
pnpm check: format, lint, typecheck, coverage, DRY and Slophammer with no findings. 68 tests in switch, 35 in the viewer, 74 in chess and 45 in legal-judge.toStringas a label; one request without a view function; the cut count; the start entry; the totals' optional counts; results of cases that throw before, during and after their steps; a missing earlier trace; a set's id; a resolved--state-from; no old result while a case runs again; the replay command's exit code; the viewer's failure lines and cut line; and a transition's key.--outgave the same 30 steps and outcome, with no requests. The chess harness'sreplayexits with 1 on a trace of another case, and with 0 on its own.I made no model calls, and I did not look at the page in a browser this time; the viewer's own tests cover the new lines.
Risks
Traces, results and run folders change form again, so switch reads no run made before this change.
choices: 1is now refused; the default judge has 30.imageslist, which pi-ai treated as no images already.