[claude] Add unit tests for scorecard_service.py (#1139) #1320

Merged
Timmy merged 1 commits from claude/issue-1139 into main 2026-03-24 02:12:47 +00:00
Collaborator

Fixes #1139

Adds tests/dashboard/test_scorecard_service.py with 31 unit tests covering edge cases and boundary conditions in scorecard_service.py not addressed by the existing test_scorecards.py:

  • _aggregate_metrics: test.execution event type, PR-closed-without-merge, push with missing num_commits key, issue/PR events with number=0, untracked agent with agent_id field passthrough, multi-agent independence
  • _detect_patterns: boundary conditions — fewer than 3 PRs skips merge rate check, exactly 80% triggers high-merge-rate pattern, commit threshold at 10 vs 11, token net boundaries at 100 and -50
  • _generate_narrative_bullets: singular/plural forms for all activity types (commit, PR, issue, comment, test file) and weekly period label
  • generate_scorecard: max() token augmentation logic (event tokens vs ledger tokens)
  • ScorecardSummary.to_dict(): ISO timestamp format, tests_affected count serialization
Fixes #1139 Adds `tests/dashboard/test_scorecard_service.py` with 31 unit tests covering edge cases and boundary conditions in `scorecard_service.py` not addressed by the existing `test_scorecards.py`: - `_aggregate_metrics`: `test.execution` event type, PR-closed-without-merge, push with missing `num_commits` key, issue/PR events with `number=0`, untracked agent with `agent_id` field passthrough, multi-agent independence - `_detect_patterns`: boundary conditions — fewer than 3 PRs skips merge rate check, exactly 80% triggers high-merge-rate pattern, commit threshold at 10 vs 11, token net boundaries at 100 and -50 - `_generate_narrative_bullets`: singular/plural forms for all activity types (commit, PR, issue, comment, test file) and weekly period label - `generate_scorecard`: `max()` token augmentation logic (event tokens vs ledger tokens) - `ScorecardSummary.to_dict()`: ISO timestamp format, `tests_affected` count serialization
claude added 1 commit 2026-03-24 02:08:42 +00:00
test: add unit tests for scorecard_service.py edge cases
Some checks failed
Tests / lint (pull_request) Failing after 35s
Tests / test (pull_request) Has been skipped
48cf182c6e
Adds tests/dashboard/test_scorecard_service.py with 31 unit tests
covering gaps not addressed in test_scorecards.py:
- _aggregate_metrics: test.execution events, PR-closed-without-merge,
  push with no num_commits key, issue/PR events with number=0,
  untracked agent with agent_id field passthrough
- _detect_patterns: boundary conditions (< 3 PRs threshold, exactly 80%
  merge rate, commit count boundary at 10 vs 11, token net boundaries)
- _generate_narrative_bullets: singular/plural forms for all activity types
- generate_scorecard: token augmentation max() logic (event vs ledger)
- ScorecardSummary.to_dict: ISO timestamp format, tests_affected count

Fixes #1139

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Timmy merged commit af162f1a80 into main 2026-03-24 02:12:47 +00:00
Timmy deleted branch claude/issue-1139 2026-03-24 02:12:48 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1320