fix(csv_export): key sessions by (project, session_file, session_id) - #20
Open
serendipity-zk wants to merge 2 commits into
Open
fix(csv_export): key sessions by (project, session_file, session_id)#20serendipity-zk wants to merge 2 commits into
serendipity-zk wants to merge 2 commits into
Conversation
`session_id` is not unique in the source. 16 ids in the public trace span more than one session file, covering 1,216 rounds, and `(session_id, round_index)` has 514 duplicates — see `artifacts/utils/DB_SCHEMA.md`. Grouping on the id alone merges unrelated conversations into one, interleaves their rounds by `round_index`, and then hides the merge behind the contiguous `round_idx` this converter re-derives. The exported prefix chain for those sessions describes a conversation that never happened. Only `.values()` is consumed downstream and the emitted `id` column is a fresh ordinal from `enumerate`, so widening the key changes no output column for any session that was already unambiguous. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
serendipity-zk
added a commit
to serendipity-zk/TraceLab
that referenced
this pull request
Aug 13, 2026
The replay client was a request frontend sharing a directory with a corpus. Nothing else here referenced it: the top-level README never mentioned `replay`, `session_runner`, or `tracegen`, and its Cargo.toml already declared an empty `[workspace]` so it would not inherit a host repo. It now lives at serendipity-zk/req-frontend, carrying the full history of the 21 commits that touched this directory. The skill that documented it goes with it. PR uw-syfi#19, which would have landed this crate upstream, is closed; its one dataset-level fix is re-sent standalone as uw-syfi#20. The contract between the two repos is unchanged and unidirectional: this repo's `artifacts/trace_facts/csv_export/convert.py` exports raw session rounds, and `tracegen` over there materializes them into a canonical execution trace. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`session_file` is optional in this schema — `cache_replay/analyze.py` already
says so at its column projection ("present in some traces, absent in others")
and projects it defensively. The v0.0.2 release DuckDB does not have the
column, so selecting it unconditionally aborts the export with a binder error.
Probe `information_schema.columns` and substitute a NULL literal when it is
missing. The key then degrades to `(project, session_id)`, which is still
strictly narrower than grouping on the id alone.
Verified both ways: v0.0.1 has the column and reproduces the expected export
byte-for-byte; v0.0.2 does not and now exports instead of crashing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Session grouping in
artifacts/trace_facts/csv_export/convert.pyusessession_idalone, but that id is not unique in the source.Per
artifacts/utils/DB_SCHEMA.md, 16 ids in the public trace span more than one session file — 1,216 rounds — and(session_id, round_index)has 514 duplicates.Grouping on the id alone merges unrelated conversations into a single session, interleaves their rounds by
round_index, and then hides the merge behind the contiguousround_idxthe converter re-derives. The exported prefix chain for those sessions describes a conversation that never happened, which matters for anyone using the CSV to reason about prefix reuse.The fix widens the grouping key to
(project, session_file, session_id).Downstream only consumes
.values(), and the emittedidcolumn is a fresh ordinal fromenumerate, so no output column changes for any session that was already unambiguous.🤖 Generated with Claude Code