Skip to content

test: broaden coverage of analysis, OTel merge, and rendering#24

Merged
dbroeglin merged 1 commit into
mainfrom
dbroeglin/analysis-test-coverage
Jun 27, 2026
Merged

test: broaden coverage of analysis, OTel merge, and rendering#24
dbroeglin merged 1 commit into
mainfrom
dbroeglin/analysis-test-coverage

Conversation

@dbroeglin

Copy link
Copy Markdown
Owner

Follow-up to #23 (merged): a thorough test-coverage review of the
session-analysis, session-reading, and OTel-merge code paths. Tests only — no
production code changes.

What's added (43 offline tests)

  • analyze_trajectory (ATIF) — driven by synthetic, hand-controlled
    inputs. The real trajectory.json is produced by this package's own Pier
    converter, so it can't serve as authoritative golden data; these tests
    exercise the parsing/aggregation logic directly: metadata, tool histogram +
    failure detection ("code":"failure", permission-denied markers),
    final_metrics → economics (aiu/reasoning/peak/compactions), summed-output
    fallbacks, and malformed-input guards.
  • _apply_otel_records merge — shutdown stays authoritative while turns are
    still enriched; OTel-only reconstruction without a shutdown; unmatched
    turn_id and no-chat-span paths.
  • OTel decoders_otel_attrs (dict + OTLP list), _otel_value typed
    scalars + array/kvlist, _otel_attr_value flat + nested dotted lookup,
    _parse_otel_time across ISO / [sec,nanos] / epoch s·ms·ns, and
    llm_calls_from_otel over OTLP list-format attributes.
  • sessionlogload_events blank/invalid skipping, copy_events
    roundtrip + missing-source, compaction_start peak tracking without a
    shutdown.
  • renderrender_session_analysis overview incl. the multi-model
    "Per model" table and the no-economics path; remaining LiveEventFormatter
    branches.

Coverage

Module Before After
analysis.py 77% 90%
render.py 87% 93%
sessionlog.py 90% 93%

Full suite: 203 passed. Ruff clean + formatted.

Add offline unit tests targeting the session-analysis internals that were
thinly covered:

- analyze_trajectory (ATIF) driven by synthetic, hand-controlled inputs
  (metadata, tool histogram + failure detection, final_metrics economics,
  summed-output fallbacks, malformed-input guards). Real trajectory.json is
  produced by this package's own converter, so it can't serve as authoritative
  golden data; these tests exercise the parsing logic directly.
- _apply_otel_records merge: shutdown stays authoritative while turns are still
  enriched; OTel-only reconstruction without a shutdown; unmatched turn_id and
  no-chat-span paths.
- OTel decoders: _otel_attrs (dict + OTLP list), _otel_value typed scalars and
  array/kvlist, _otel_attr_value flat + nested dotted lookup, _parse_otel_time
  across ISO / [sec,nanos] / epoch s|ms|ns, and llm_calls_from_otel over
  OTLP list-format attributes.
- sessionlog: load_events blank/invalid skipping, copy_events roundtrip and
  missing-source, compaction_start peak tracking without a shutdown.
- render: render_session_analysis overview incl. the multi-model "Per model"
  table and the no-economics path; remaining LiveEventFormatter branches.

Coverage: analysis.py 77%->90%, render.py 87%->93%, sessionlog.py 90%->93%.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dbroeglin dbroeglin merged commit 0273a29 into main Jun 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant