Skip to content

fix(insight): count git_commit events in commit metrics#785

Open
daniel-enqz wants to merge 2 commits into
mksglu:nextfrom
daniel-enqz:fix/insight-commit-count
Open

fix(insight): count git_commit events in commit metrics#785
daniel-enqz wants to merge 2 commits into
mksglu:nextfrom
daniel-enqz:fix/insight-commit-count

Conversation

@daniel-enqz

Copy link
Copy Markdown

What

Fixes the Insight dashboard's commit metrics, which were undercounting commits — see #784.

Why

In v1.0.161 the extractor (src/session/extract.ts) started emitting commits made with -m/--message as type='git_commit' (commit subject in data), reserving type='git', data='commit' only for commits without a message. session-db's has_commit was updated to match (type='git_commit').

insight/server.mjs was never updated and still filtered on the legacy type='git' AND data='commit', so it counted only no-message commits. In real usage almost all commits use -m, so the dashboard showed near-zero commits (e.g. 2 reported vs 38 actually recorded).

Change

Count both shapes in all four commit tallies:

  • timeToFirstCommit
  • commitRate (both project_dir and fallback branches)
  • commitSessions (productivity score input)
-- before
se.type = 'git' AND se.data = 'commit'
-- after
se.type = 'git_commit' OR (se.type = 'git' AND se.data = 'commit')

Testing

  • node --check insight/server.mjs passes.
  • Verified against local session DBs: previously 2, now reflects the full git_commit + legacy count (38).

Closes #784

The extractor emits commits made with -m/--message as type='git_commit'
(since v1.0.161), reserving type='git' data='commit' only for commits
without a message. The Insight dashboard queries were never updated and
still filtered on the legacy shape, so the Commit Rate widget,
time-to-first-commit, sessions-with-commit, and the productivity score
only counted no-message commits — undercounting real commit activity.

Count both shapes everywhere commits are tallied.

Fixes mksglu#784
@mksglu mksglu changed the base branch from main to next June 13, 2026 17:00
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.

Insight dashboard undercounts commits: counts only 'git commit' without -m (git_commit type ignored)

2 participants