test: add 9 tests for inspectTranscript#12
Merged
protosphinx merged 1 commit intomainfrom May 3, 2026
Merged
Conversation
`mcprec inspect <file>` is the operator's first-look summary of a recorded transcript — number of frames, request/response pair count, per-method counts, errors flagged. Until now it had no tests; the existing suite covered every other src/* module (10 test files for 10 src files except `inspect.ts`, `record.ts`, `cli.ts`, `index.ts`, `types.ts`). A regression here is silent in production — operators see a wrong frame count or a missing method and don't realise the formatter dropped data, not the recording. Coverage: - Renders one line per frame plus a summary footer (basic shape). - Counts requests by method, descending — pin the documented ordering (chatty methods first) so a regression to insertion order or alphabetical doesn't silently change the report. - Ignores responses when computing method counts; only `→` frames carry a `method` and they're the only ones that should count. A regression that double-counted both directions would inflate every per-method number. - Renders error responses with a visible "error" marker (operators scanning a transcript want errors to stand out, not blend into generic "response"). - Reports the request/response pair count in the footer (matches what `pairFrames` returns). - Handles a notification (no id, no response) without adding a pair (notifications are not requests). - Empty transcript renders a sensible summary (zero counts, no crash) — the inspect command must not blow up on a fresh-but- empty recording. - Timestamps render with the documented fixed-width 8-char prefix so multi-frame output aligns in the terminal; a regression to variable-width would shift columns on long transcripts. Verified locally on Node 22: - `npm test` -> 80 passed (was 71; +9 net new) - `npm run lint` (tsc --noEmit) clean
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
`mcprec inspect ` is the operator's first-look summary of a recorded transcript — frame count, request/response pair count, per-method counts, error flagging. Until now it had no tests; the existing suite covered every other `src/*` module (10 test files for 10 src files except `inspect.ts`, `record.ts`, `cli.ts`, `index.ts`, `types.ts`).
A regression here is silent in production — operators see a wrong frame count or a missing method and don't realise the formatter dropped data, not the recording.
Coverage (9 tests)
Verification