Skip to content

test(#830): add pytest suite for analyze-transcript.py - #863

Open
fullsend-ai-coder[bot] wants to merge 2 commits into
mainfrom
agent/830-analyze-transcript-tests
Open

test(#830): add pytest suite for analyze-transcript.py#863
fullsend-ai-coder[bot] wants to merge 2 commits into
mainfrom
agent/830-analyze-transcript-tests

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown

Summary

Add a comprehensive pytest suite (111 tests) for skills/analyze-transcript/analyze-transcript.py, covering all key functions and subcommands that were previously untested. The script has ~820 lines of heuristic-based parsing logic that is easy to regress on.

Related Issue

Fixes #830

Changes

  • New test file: skills/analyze-transcript/analyze_transcript_test.py with 111 tests organized by component:
    • parse_line_range, truncate, extract_content_blocks, get_tool_result_text — unit tests for utility functions
    • detect_file_type — OTLP telemetry detection, non-dict JSON, non-JSON lines, unreadable files, blank-line-heavy files, empty files, stdin bypass
    • parse_lines / iter_messages — line range filtering, malformed input resilience, non-UTF-8 content, queue-operation and last-prompt type handling
    • _accumulate_stats — token accounting, duration calculation, stop reasons, pre-iterated messages, edge cases (no timestamps, empty file)
    • Error detection (_is_error_result, _check_block_error, _collect_errors) — is_error flag, <error> tags, <tool_use_error> tags, _RESULT_ERROR_PATTERNS matching, assistant keyword mentions, false positive checks
    • Host matching (_host_matches, _match_host, _match_http_entry) — exact match, parent-domain, case-insensitive, combined method/host filters
    • parse_sandbox_log — OCSF entry parsing, field extraction, denied entries, non-OCSF line skipping
    • Subcommand e2e tests — summary, errors, audit, tools, conversation, search, network, network-search in both text and JSON output modes
  • New test fixtures: crafted JSONL and log files under skills/analyze-transcript/testdata/ covering valid transcripts, OTLP telemetry, non-dict JSON, non-JSON lines, non-UTF-8 content, blank-heavy files, error patterns, and sandbox network logs
  • Makefile: wired tests into the script-test target

Testing

  • All 111 tests pass (python3 -m pytest skills/analyze-transcript/analyze_transcript_test.py -v)
  • Tests added for all key areas listed in the issue

Closes #830

Post-script verification

  • Branch is not main/master (agent/830-analyze-transcript-tests)
  • Secret scan passed (gitleaks — c887fc47c59d8b87b5282ca44044d2933d30df41..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

Add 111 tests covering all key functions and subcommands of the
transcript analyzer script. Tests are organized by component:

- parse_line_range, truncate, extract_content_blocks,
  get_tool_result_text: unit tests for utility functions
- detect_file_type: OTLP detection, non-dict JSON, non-JSON,
  unreadable files, blank-line-heavy files, empty files
- parse_lines / iter_messages: line range filtering, malformed
  input resilience, non-UTF-8 content, queue/last-prompt types
- _accumulate_stats: token accounting, duration calculation,
  stop reasons, pre-iterated messages, edge cases
- Error detection: is_error flag, error tags, result error
  patterns, assistant keyword mentions, false positive checks
- Host matching: exact match, parent-domain, case-insensitive,
  combined method/host filters
- parse_sandbox_log: OCSF entry parsing, field extraction
- Subcommand e2e: summary, errors, audit, tools, conversation,
  search, network, network-search in text and JSON modes

Includes crafted JSONL/log fixtures under testdata/ and wires the
test into the Makefile script-test target.

Note: pre-commit could not run in sandbox (network error fetching
hook environments). The post-script runs it authoritatively.

Closes #830
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 2, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:44 AM UTC · Completed 9:56 AM UTC
Commit: 30c4015 · View workflow run →

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review

Findings

Medium

  • [protected-path] skills/analyze-transcript/* — This PR adds 9 files under the skills/ protected path (test file skills/analyze-transcript/analyze_transcript_test.py and 8 test fixtures under skills/analyze-transcript/testdata/). The PR is linked to issue analyze-transcript: add test coverage for the analyzer script #830 and the description explains the rationale (adding comprehensive test coverage for the analyzer script). Human approval is always required for protected-path changes, regardless of context.
Previous run

Review

Findings

Medium

  • [protected-path] skills/analyze-transcript/ — This PR modifies files under a protected path (skills/). The change is linked to issue analyze-transcript: add test coverage for the analyzer script #830 and the description explains the rationale (adding test coverage for analyze-transcript.py), but human approval is always required for protected-path changes. Affected paths: skills/analyze-transcript/analyze_transcript_test.py, skills/analyze-transcript/testdata/*.

Low

  • [test-inadequate] skills/analyze-transcript/analyze_transcript_test.py:246test_non_utf8_resilience asserts len(results) >= 2 but the fixture deterministically produces exactly 3 parseable lines (lines 0, 1, and 3). The loose lower bound would still pass if a code change caused one valid line to be silently dropped, masking a regression.
    Remediation: Assert len(results) == 3 or at minimum >= 3.

  • [test-inadequate] skills/analyze-transcript/analyze_transcript_test.py:861test_json_with_host_filter does not verify that entries outside the host filter are actually excluded. It only asserts that surviving non-DENIED entries contain github.com in the host string but never checks the result count or that excluded hosts (e.g., registry.npmjs.org) are absent.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the requires-manual-review Review requires human judgment label Aug 2, 2026
@guyoron1

guyoron1 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

/fs-fix

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 2, 2026

Copy link
Copy Markdown
Author

🤖 Finished Fix · ✅ Success · Started 10:31 AM UTC · Completed 10:36 AM UTC
Commit: 30c4015 · View workflow run →

- test_non_utf8_resilience: assert exact count (== 3) instead of loose
  lower bound (>= 2) since the fixture deterministically produces 3
  parseable lines.
- test_json_with_host_filter: assert result count (== 3), verify all
  returned hosts contain "github.com", and confirm excluded hosts
  (npmjs) are absent from the filtered output.

Addresses review feedback on #863
@fullsend-ai-coder

Copy link
Copy Markdown
Author

🔧 Fix agent — iteration 1 (human-triggered)

Addressed 2 of 3 review findings by tightening test assertions. Finding 1 (protected-path) is informational and requires no code change. All 111 tests pass.

Fixed (2):

  1. test_non_utf8_resilience uses loose lower bound (>= 2) instead of exact count (skills/analyze-transcript/analyze_transcript_test.py): Changed assertion from len(results) >= 2 to len(results) == 3. The fixture deterministically produces exactly 3 parseable JSON dict lines (indices 0, 1, and 3); line 2 is raw bad bytes and is skipped. The loose bound would mask a regression if a valid line were silently dropped.
  2. test_json_with_host_filter does not verify excluded entries are absent (skills/analyze-transcript/analyze_transcript_test.py): Added three assertions: (1) assert len(data) == 3 to verify only matching entries survive the filter, (2) assert all hosts contain 'github.com', and (3) assert no host contains 'npmjs' to confirm excluded entries are truly absent.

Disagreed (1):

  1. protected-path modification requires human approval: This is an informational finding, not a code change request. The PR intentionally adds test files under skills/analyze-transcript/ per issue analyze-transcript: add test coverage for the analyzer script #830. Human approval for protected-path changes is a process requirement already handled by the requires-manual-review label on this PR.

Tests: passed

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 2, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:40 AM UTC · Completed 10:54 AM UTC
Commit: 8da63ad · View workflow run →

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity in the last month. It will be closed in 2 weeks if no further activity occurs. Remove the stale label to reset the inactivity timer.

@github-actions github-actions Bot added the stale label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-manual-review Review requires human judgment stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

analyze-transcript: add test coverage for the analyzer script

1 participant