Skip to content

Jira discovery merge: show jira stats for non finished report rows#19

Open
PavelLoparev wants to merge 10 commits intomainfrom
jira-discovery-merge
Open

Jira discovery merge: show jira stats for non finished report rows#19
PavelLoparev wants to merge 10 commits intomainfrom
jira-discovery-merge

Conversation

@PavelLoparev
Copy link
Copy Markdown
Contributor

@PavelLoparev PavelLoparev commented Mar 25, 2026

Summary

  • Concurrent Jira discovery: Merged the sequential post-LLM Jira discovery loop into the main per-member GitHub fetch loop. Jira fetches now run in parallel with LLM analysis instead of waiting for all LLM work to complete first. This required changing resolveJiraUser to accept emails: string[] directly (extracted from in-memory commits) instead of querying the commit_analyses DB table — removing the LLM dependency entirely.
  • Progressive Jira counts: Fixed Jira issue counts showing as empty during in-progress reports. checkMemberComplete now reads from jiraIssueCountByLogin if Jira finished first; if LLM finished first, the Jira IIFE patches the developer_stats row with a targeted UPDATE once it completes.
  • Jira column visibility: Both page.tsx and report/[id]/org/page.tsx now show the Jira column whenever JIRA_ENABLED=true, not only after at least one developer has a non-zero total_jira_issues count.
  • Jira concurrency backpressure: Jira fetches are now throttled via pLimit (default 3, configurable via JIRA_CONCURRENCY env var) to avoid flooding the Jira API on large orgs.
  • Story points fix: storyPointsFields from app config was not being forwarded to searchDoneIssues — storyPoints was always null. Fixed.
  • SQLite compatibility: LEFT(str, n) in the project-insights query replaced with SUBSTR(str, 1, n) which works in both SQLite and MySQL.
  • Route rename: /api/llm-config/api/app-config to match the service rename.

Test plan

  • Run a report with JIRA_ENABLED=true and verify Jira issue counts appear progressively during the run, not only at completion
  • Verify the Jira column is visible in both the main report table and org report table as soon as the report starts showing developers
  • Verify storyPoints are populated for issues where JIRA_STORY_POINTS_FIELDS is configured
  • Run with SQLite and confirm no no such function: LEFT errors on the /api/project-insights endpoint
  • Confirm /api/app-config responds correctly (settings page load, Jira column visibility on page mount)

// 1. All Jira issues (compact)
const [jiraRows] = await db.execute(
`SELECT issue_key, project_key, issue_type, github_login, LEFT(summary, 80) as summary
`SELECT issue_key, project_key, issue_type, github_login, SUBSTR(summary, 1, 80) as summary
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqlite vs mysql compatibility


useEffect(() => {
fetch('/api/llm-config').then(r => r.json()).then(setConfig).catch(() => {}).finally(() => setLoading(false));
fetch('/api/app-config').then(r => r.json()).then(setConfig).catch(() => {}).finally(() => setLoading(false));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to rename this route last time when I refactored llm config -> app config

Comment on lines +300 to +306
// If LLM finished first and already wrote stats with 0, patch the count now
if (completedMembers.has(login)) {
db.execute(
`UPDATE developer_stats SET total_jira_issues = ? WHERE report_id = ? AND github_login = ?`,
[issues.length, reportId, login],
).catch((err) => log(`DB WARN updating jira count for @${login}: ${err}`));
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid race condition

@PavelLoparev PavelLoparev requested a review from msogin March 25, 2026 19:45
@PavelLoparev PavelLoparev changed the title Jira discovery merge Jira discovery merge: show jira stats for non finished report rows Mar 25, 2026
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