Skip to content

Shift UI and MCP to insights-first operational review - #42

Open
yyeret wants to merge 1 commit into
mainfrom
feat/insights-first-ui-mcp
Open

yyeret wants to merge 1 commit into
mainfrom
feat/insights-first-ui-mcp

Conversation

@yyeret

@yyeret yyeret commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add deterministic operational review engine and optional Gemini synthesis (operational_review.py) producing ranked key insights, discussion questions, and 6 scored slices (wip_aging, flow_predictability, contributor_mode, batch_size, backlog_health, value_framing) with top 3–4 highlighted.
  • Wire cached operational review synthesis into analyze.py, cloudflare_app.py, app.py, and Cloudflare worker packaging (scripts/prepare-cloudflare-build.py).
  • Shift MCP server (mcp_server.py) so show_github_dashboard defaults to view="insights" (redacting private titles from structuredContent) and add inspect_flow_slice for targeted slice drill-downs; update MCP inline app (mcp/dashboard.html, mcp/dashboard.js) to open on Insights & Slices tabs.
  • Redesign index.html (synced to public/index.html) to place Operational Review Insights & Most Interesting Slices above the fold, collapse Backing Data & Charts by default behind a toggle (auto-expanding on drill-down), and add interactive slice filters (Contributor, PR Size, Framing, Time Window).

Validation

  • python -m ruff check .: 0 errors
  • python -m pytest --cov --cov-report=term-missing: 456 passed, 90.83% branch coverage (operational_review.py 92%)
  • node --test tests/frontend/*.test.cjs: 10 passed
  • scripts/build-mcp-dashboard.py: builds cleanly
  • Live browser QA verified insights above the fold, collapsed backing data expanding on drill-down, interactive slice filtering, and 0 JS console errors

@tessl-reviewer tessl-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tessl Reviewer

Advisory findings (7 should fix, 2 advisory)

This repository runs Tessl Reviewer in advisory mode, so the review doesn't block merging.

The insights-first flow is wired across analysis, the web UI, and MCP, but several backing-data views can show populations inconsistent with the selected insight or filters. Optional synthesis also has gaps in malformed-response fallback and hosted timeout enforcement. The coverage verification instructions do not enforce their stated branch-coverage target.

Severity Should fix Advisory
Major 7 0
Minor 0 2

Should fix (7)

  • Major · Should fix · Empty filter results leave the previous chart population visible
    index.html:1478
  • Major · Should fix · Malformed synthesis fields escape the deterministic fallback
    operational_review.py:1003
  • Major · Should fix · Contributor drilldowns target throughput without filtering it
    operational_review.py:433
  • Major · Should fix · Successive slice drilldowns inherit unrelated filters
    index.html:1420
  • Major · Should fix · Contributor concentration names the first mode instead of the largest
    operational_review.py:407
  • Major · Should fix · MCP slice inspection opens charts without the requested slice filter
    mcp_server.py:216
  • Major · Should fix · Optional synthesis has no enforced deadline on Workers
    operational_review.py:986

Advisory (2)

  • Minor · Advisory in Standard mode · Resetting the shared framing filter leaves the item table narrowed
    index.html:1495
  • Minor · Advisory in Standard mode · The documented coverage check does not enforce the branch-coverage target
    docs/plans/2026-11-23-insights-first-ui-and-mcp.md:67

Reviews are incremental. The first review shows every valid finding. A later round checks the latest changes and earlier findings, and adds a fresh finding when it still applies. It never repeats one you refuted or declined. Ask for a full review to inspect the whole change and show earlier findings again.

Mention @tessl-reviewer to run another review.

Comment thread index.html
);
const filteredComet = (d.comet_points || []).filter(p =>
matchesMerged(p.key, p.classification, p.size, p.end)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Should fix · Empty filter results leave the previous chart population visible

The new filter handler passes empty arrays to renderControlChart, renderCorrelation, renderComet, and renderWIP, but each renderer returns before replacing its existing chart. After a nonempty rendering, selecting a valid filter combination with no matches therefore reports zero matching PRs while retaining the previous PRs in the charts. Empty selections must clear or replace the displayed population, including in the synced public UI.

Correctness And Data Integrity

Comment thread operational_review.py
review["executive_summary"] = exec_summary.strip()[:500]

by_id = {item["id"]: item for item in review["insights"]}
for update in parsed.get("insights") or []:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Should fix · Malformed synthesis fields escape the deterministic fallback

In synthesize_operational_review, the exception boundary ends before the response-update loops. Successfully decoded JSON such as {"insights": 1} raises during iteration, while an update with a list-valued id raises at the dictionary lookup; slice_insights has the same exposure. The requested response schema is not locally validated before these operations. Because analysis awaits this optional synthesis before returning and caching metrics, malformed upstream content can fail an otherwise usable analysis. Invalid collection and identifier shapes must preserve the deterministic result rather than propagate an exception.

Correctness And Data Integrity · Maintainability And Code Quality · Scale And Resilience

Comment thread operational_review.py
"evidence_items": evidence_items,
"drilldown": drilldown,
}
insight_obj = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Should fix · Contributor drilldowns target throughput without filtering it

The contributor-mode slice targets chart-throughput with a classification filter, but onSliceFilterChange redraws only control, correlation, comet, and WIP charts. Throughput remains the original all-contributor series even as the shared filter and count report the selected cohort. Inspecting the contributor insight therefore lands on backing data with a different population. The advertised destination must honor the cohort or identify backing data that does.

Correctness And Data Integrity · Maintainability And Code Quality

Comment thread index.html
function applySliceFilter(filter) {
if (!renderedMetrics || !filter) return;
if (filter.classification !== undefined) {
const el = document.getElementById('filter-classification');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Should fix · Successive slice drilldowns inherit unrelated filters

applySliceFilter changes only keys explicitly supplied by the drilldown. Navigating from a contributor slice to a large-PR slice retains the contributor selection, and a slice with an empty filter retains all previous selections. The resulting backing charts can omit PRs included in the newly selected insight's evidence. Slice navigation must establish the population described by its drilldown rather than silently intersect it with unrelated prior selections.

Correctness And Data Integrity

Comment thread operational_review.py
rows.append({"label": m["mode"], "value": f"{m['count']} PRs ({m['share_pct']}%)", "detail": detail})

focus_items = sorted(groups.get(target_mode, points), key=lambda i: i.get("y") or 0, reverse=True)[:6]
evidence_items = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Should fix · Contributor concentration names the first mode instead of the largest

Contributor statistics are assembled in fixed Human, AI-Assisted, AI-Agentic order. When fewer than two groups qualify for cycle-time comparison, the concentration branch selects stats_by_mode[0], and the evidence focus uses the same first mode. With one Human PR and twenty AI-Agentic PRs, the review consequently describes the mix as concentrated in Human and focuses its evidence on that minority. The concentration narrative and evidence target must reflect the actual largest group independently of comparison eligibility.

Correctness And Data Integrity · Maintainability And Code Quality

Comment thread mcp_server.py
text = (f'{sl["title"]} ({detail["repo"]}): {sl["headline_metric"]}. '
f'{sl["insight"]} Question: {sl["review_question"]}')
return tool_result(text, detail, metrics=metrics, sliceFocus=inputs.slice,
privateEnabled=bool(grant['private_consent']))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Should fix · MCP slice inspection opens charts without the requested slice filter

inspect_flow_slice returns sliceFocus metadata and a slice drilldown containing its filter. However, showResult only renders the supplied metrics and switches to data.view; it consumes neither the focus metadata nor the drilldown filter. renderDashboard initializes the filters to All, so inspecting a large-PR or contributor slice opens generic charts rather than the requested population. The tool-result display must preserve the requested slice constraints when presenting its backing view.

Correctness And Data Integrity

Comment thread operational_review.py
method="POST",
headers={"x-goog-api-key": gemini_key},
body=body,
timeout=GEMINI_TIMEOUT,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Should fix · Optional synthesis has no enforced deadline on Workers

The new synthesis call passes GEMINI_TIMEOUT to request_json, but its Workers transport does not schedule a timeout for either fetch or response.text(). synthesize_operational_review adds no enclosing deadline. Hosted analysis awaits this call before returning metrics and publishing its cache, so a slow or stalled Gemini response can keep completed deterministic analytics unavailable beyond the intended ten seconds. The optional operation must return the deterministic review on deadline expiry, including when response-body reading stalls.

Scale And Resilience

Comment thread index.html
if (hasPRs || d.active_wip_points?.length) {
renderWIP(filteredWip, d.stage_percentiles);
}
if (framing) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor · Advisory in Standard mode · Resetting the shared framing filter leaves the item table narrowed

onSliceFilterChange synchronizes value-level only when framing is nonempty. Selecting a framing level and then choosing All or pressing Reset restores the chart population but leaves value-level and the framing item table at the previous level. This makes Reset incomplete and leaves two related projections out of sync. Clearing the shared framing selection must also clear its synchronized table selection.

Maintainability And Code Quality

```text
Drive the insights-first UI and MCP implementation in /Users/yuvalyeret/Github/github-analytics-insights-first to completion.
Re-measure each cycle against the 4 leading indicators in docs/plans/2026-11-23-insights-first-ui-and-mcp.md:
1. Run `.venv/bin/python -m ruff check .` and `.venv/bin/python -m pytest --cov --cov-report=term-missing` (coverage >= 90%).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor · Advisory in Standard mode · The documented coverage check does not enforce the branch-coverage target

Leading indicator 4 requires at least 90% branch coverage, including operational_review.py, but the closing loop only runs pytest with coverage and stops when that check passes. In pyproject.toml, branch=true enables measurement while fail_under=90 gates combined statement-and-branch coverage, not branch coverage independently or the module's branch percentage. A passing command therefore does not establish the documented acceptance target. The stated target and closing verification criteria must refer to the same coverage measure.

Markdown

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://feat-insights-first-ui-mcp-github-flow-analytics.yuval-yeret.workers.dev (commit 837f2b8)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://b7ea1779-github-flow-analytics.yuval-yeret.workers.dev 837f2b8 2026-11-23T22:21:44.156Z Visit the dashboard ↗

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