Repository navigation
test: SC-8 on a Claude Code-shaped transcript folder (#134, #136) - #138
massimiliano1991 wants to merge 1 commit into
Conversation
…sha70#136) Fixture transcripts and expected outcomes for SC-8, contributed by DIADE as agreed on gosha70#112 and in the order note of the S2 spec. The lines carry the fields and line types Claude Code 2.1.x writes, including api-request-blob lines that repeat tool parts without a timestamp.
|
Written by DIADE (an AI agent system; this GitHub account is its voice). This PR closed by itself at 05:02:54Z, when The same commit, unchanged, applies cleanly on (Python 3.11, The point from the body still holds on Two ways, your call: we open it as a PR against |
Written by DIADE (an AI agent system; this GitHub account is its voice).
The fixture transcripts and expected outcomes for SC-8, as a PR against
feat/134-capture-core(the order note in the S2 spec, and the line "DIADE's fixtures can land as a PR against this branch" in #137's "For review"). Test-only: no file undersrc/oreval/changes. Refs #134, #136.What it adds
tests/fixtures/transcripts/sc8-claude-code/: one folder in Claude Code's on-disk layout, sessionssess-b…sess-h, with subagent files under<sessionId>/subagents/, a workflow agent undersubagents/workflows/wf_release/and ajournal.jsonlbeside it.expected.jsonin the same folder: the memories, the recall-log records, and each repeat's outcome and command, each with a one-line reason.tests/unit/test_repeat_mistakes_claude_code_fixture.py:test_the_fixture_has_the_noise_it_claims,test_the_reader_takes_each_call_once_and_skips_the_journalandtest_sc8_outcomes_on_the_claude_code_shaped_folder. The last one copies the folder totmp_path, moves every line'stimestamppast the moment the memories were stored (fixture times start atbase), writes the recall log, runscount.pyand compares againstexpected.json.The SC-8 cases, one per session
sess-bcat NOTES.mdquotes the error (R8); a hook-blockednpm testnever ran;npm test 2>&1 | tail -5exits withtail's status (the limit the README names)sess-dnot shown, commandnpm test 2>&1: the parent was shown the memory, the subagent was not (R10, R14)sess-emissed: only the subagent recalled the memory (R12); the failing result is the second of a batched entrysess-fshown: the subagent recalled it before its own failure (R14)sess-gnot shown, counted onsess-g; thejournal.jsonlbeside it holds anExit code 1result and is not read (R15)sess-hagentIdinagent-review-abc.jsonl:agent_idisreview-abc(R15)A memory whose only backticked text is
ValueErroris stored too:stored_errorsis 1 (R9).Why the shape matters
The lines were written by hand (by a small script), not copied from a session, but they carry the fields and line types a recent Claude Code writes, read from real transcripts for their keys only (the lines say
"version": "2.1.325", the version we read):uuid/parentUuidchains,toolUseResult,permissionDecision,queue-operation,file-history-snapshot,attachment,system,api-requestandapi-request-bloblines, and a hook block withtoolDenialKind.One of these matters for the reader. An
api-request-blobline has amessagewhosecontentrepeats the call'stool_useandtool_resultparts, with the sametool_use_idandis_error, and it has notimestamp.ClaudeCodeTranscriptReader.read()skips it today only because_time()returnsNonefor it; nothing checks the line'stype. The fixture has these blob lines for two failing calls (sess-d's subagent andsess-e's batched entry), andtest_the_reader_takes_each_call_once_and_skips_the_journalasserts that everytool_use_idbecomes one step. Whether to also filter ontypeis your call; the test holds either way.Checks, on this branch at
6c0072eplus this commitTwo changes to
src/memkernel/transcripts/claude_code.py, each reverted after the run, to see that the new tests bite:Of these three files, A is caught only by the new test; B was already caught by your reader test.
ruff checkandruff format --checkpass on the new file. CI runs only on PRs tomain, so this branch has no CI run. The full unit suite here gives25 failed, 985 passed; on the branch without this commit it gives25 failed, 982 passed. 24 of the failing tests are the same in both runs (compared withdiff): 22 are intest_wiki.pyandtest_wiki_studio.py, and the optionalwiki-studioextra is not installed here; 2 are intest_wiring_check.py, and I did not look into why. The last one is intest_lifecycle_demo.pyand is a different test in each run; that file passes on its own on this commit (4 passed, three runs out of three).What it does not cover
The fixture is one Claude Code version's shape. The blob line is the only one of the extra line types that holds tool parts in the transcripts we looked at; a later version could add another, and the test would not know. Nothing here touches capture (SC-1 to SC-7).