fix(adapter): close the review findings against the Claude Code capture - #42
Merged
Conversation
Twelve defects found by the adversarial review of the first capture adapter,
each filed as its own issue after that adapter shipped. Measured against a
local store of 733 project-root transcripts, before and after.
Wrong numbers reaching a verdict:
- Input tokens counted one of three fields. The two cache fields carry
99.97% of the input on the measured store, so the figure a token-band
assertion ran against was 3.9M where the harness billed for 12.47B.
- Wall duration was last minus first with no guard: negative on two
transcripts, and saturated to 292 years when a timestamp was missing.
Now the span between the timestamps that exist.
- Model.Provider was filled with a constant no record states, asserting a
backend that was never observed.
- Discover with a Dir query matched almost nothing: the store replaces
every character outside [A-Za-z0-9-] in a path and this replaced only
the separator. 185 of the store's directories now answer, 0 miss.
The comparison was also a substring test and is now equality.
Sentinels and claims:
- An over-long line reported ErrMalformed for an intact source; it is
ErrUnsupported, which is this adapter's own limit rather than damage.
- An empty or bookkeeping-only file loaded as a complete zero-turn
session, claiming to know the complete order of nothing.
- A null or type-less line was refused as an unknown record type "".
- CanSeeWorkspace was declared whole while four of its six governed
fields are never filled; it is now partial.
- Fidelity.Version joined several releases into one string, which the
equality check it exists for can never match. It names one release.
Structure:
- Delegated work never had its results paired or its tokens counted: the
sidechain branch returned before both. Sub-agent usage now lands on the
delegation it belongs to rather than being dropped.
- Tool-call pairing keyed by pointer into a turn's tool slice, which any
later change appending a call to a stored turn would orphan silently.
Keyed by position and resolved after the file is read.
- A result whose call the transcript does not hold now withdraws the
order claim instead of being discarded in silence.
- Each message body was unmarshalled twice, on lines reaching 4.2 MiB.
- Usage is kept from records that produce no turn; the harness billed for
them either way.
The conformance kit's claim to make a capability declaration binding is
corrected: it binds against reporting the unobservable, and a capability
declared whole and never filled still passes. That is the finding in #39,
which stays open for the fixture work it needs.
Closes #26, #28, #29, #30, #31, #32, #33, #34, #35, #36, #37, #38
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ew64uotJqtvVDN3twMAVEQ
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Jul 27, 2026
Closed
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.
Twelve of the thirteen issues filed against the first capture adapter after it
shipped. Each was reproduced before it was fixed, and the effect of every fix is
measured against a local store of 733 project-root transcripts.
Measured, before and after
WallDirquery findsThe last row is the orphan-result rule finding one file the compaction markers
did not.
Wrong numbers reaching a verdict
InputTokensread one of three fields.cache_read_input_tokensandcache_creation_input_tokenscarry 99.97% of the input on the measured store,so a token-band assertion ran against a figure three orders of magnitude
small, and a change in the harness's caching — one of the things an exam is
re-administered to detect — was invisible in it.
Wallwas last minus first, unguarded. A missing timestamp saturatedit to
time.Duration's maximum; records out of order, which 445 of 728transcripts have, made it negative on two. It is now the span between the
timestamps that exist, and
assay.Usagesays what that does and does notmeasure.
Model.Providerwas set to a constant. No record names a provider,and the harness writes the same transcript against three backends.
Discoverwith aDirquery missed most directories: the storereplaces every character outside
[A-Za-z0-9-], this replaced only theseparator. The comparison was also
strings.Contains, so/workmatched aproject named for
/workspace/other; it is equality now.Sentinels and claims
ErrMalformed— damage — for an intactsource. It is this adapter's own limit, so
ErrUnsupported. Anullortype-less line, which unmarshalled into a zero record and was refused as
unknown record type "", is now malformed with a reason that names the cause;a leading byte order mark is no longer refused.
session — indistinguishable from a session in which nothing happened, and
claiming to know the complete order of that nothing.
CanSeeWorkspacewas declared whole while four of its six governedfields are never filled. It is partial, with the reason stated.
Fidelity.Versionjoined releases into"2.1.219,2.1.220", which theequality check the field exists for can never match. It names the release the
session's last record was written by;
Verifiedstill covers all of them.Structure
sidechain branch returned before both. Sub-agent usage now lands on the
delegation rather than being dropped, and
capture.godrops the claim thatthe inline form was read correctly.
orphaned in silence by any later change that appends a call to a stored turn.
Keyed by position, resolved after the file is read.
discarded; an unknown record type is truncated before it is formatted into an
error. The other four bullets are documented rather than changed:
attachmentrecords keep their payload on a key this adapter does not read;startedandresultturn out to live only in workflow journals, which arenot transcripts, so refusing them with
ErrUnsupportedis correct;fallbackblocks record a model substitution on a record that becomes no turn, and there
is nowhere neutral to put it; the pending map is bounded by one file.
One walk now produces the turn and the identifiers.
Left open
#39 — the conformance kit catches an adapter reporting what it cannot see,
and cannot catch one declaring a capability it never fills. The comment claiming
otherwise is corrected in
coverage.goandverify.go. The check itself needsa fixture per capability known to carry the evidence for it, which does not
exist yet, so the issue stays open rather than being closed by a comment.
Tests
Fifteen new cases, each written first and watched fail. All fixtures are
synthetic; no transcript is committed.
make verifypasses: race tests,coverage 88.9%, lint 0 issues, govulncheck clean.
Closes #26, #28, #29, #30, #31, #32, #33, #34, #35, #36, #37, #38
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ew64uotJqtvVDN3twMAVEQ