feat(review): instrument impact-map + add a public AI-reuse-rate trend (#4448) - #4671
Merged
Merged
Conversation
#4448) Completes #4448's cache-hit/miss instrumentation coverage and adds the aggregate public "how often we avoid redoing AI work" trend, both part of epic #4445. Instrumentation: adds cache hit/miss telemetry to impact-map's query cache (impact_map_query_cache, #4500) -- the last of the genuinely cache-backed AI-touching capabilities that had zero reuse-rate signal, mirroring the established incr()+recordAuditEvent pattern exactly (repo_culture_profile #4509, grounding/review-memory this same epic). computeImpactMap now takes `env` as an explicit first argument (the existing RagInfra/StorageAdapter seam intentionally stays storage-only for portability, so telemetry is threaded separately). Two of the six capabilities the parent issue named -- enrichment and reputation -- are deliberately NOT instrumented: neither has a cache or any other "reuse a prior result" mechanism to measure. Enrichment always POSTs fresh to the external REES on every invocation (no local cache); reputation is a pure D1 aggregate with no caching layer (its own redundant-re-derivation issue was fixed differently, by threading a pre-computed value caller-to-callee in #4507). Forcing a fabricated hit/miss signal onto either would misrepresent their real architecture and just show 100%-miss forever, adding noise instead of signal. Aggregate: new src/services/public-reuse-rate-trend.ts, extending GET /v1/public/stats with reuseRateTrend -- 8 trailing weeks of hits/(hits+misses) across every github_app.*_cache_hit / *_cache_miss event (a naming convention, not a hardcoded capability list, so it automatically covers today's eight capabilities and any future one that follows the same convention) plus ai_review's three non-suffix-conforming reuse variants (frozen/paused/one-shot), which are the same "avoided a redundant AI call" signal under a different name. Deliberately not a cron/rollup table, mirroring #4447's own design: audit_events is already durable, so a live day-bucketed re-query recomputes any historical week correctly on every request. Deliberately NOT scoped to the public-stats repo allowlist either (unlike accuracy) -- a cache-hit/miss event carries no PR content or repo-specific outcome, so the aggregate number doesn't reveal per-repo activity, and target_key isn't uniformly shaped across all eight capabilities. Only the homepage/`/stats` trend chart is deferred to a follow-up PR, matching the capture-then-extend split already used for #4446 and #4447.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | f580243 | Commit Preview URL Branch Preview URL |
Jul 10 2026, 11:17 AM |
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4671 +/- ##
=======================================
Coverage 94.13% 94.14%
=======================================
Files 434 435 +1
Lines 38542 38576 +34
Branches 14056 14060 +4
=======================================
+ Hits 36282 36316 +34
Misses 1601 1601
Partials 659 659
🚀 New features to boost your workflow:
|
This was referenced Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
impact_map_query_cache, fix(review): impact-map re-embeds + re-queries the vector index up to 20x per pass with no result cache #4500) — the last of the genuinely cache-backed AI-touching capabilities that had zero reuse-rate signal, mirroring the establishedincr()+recordAuditEventpattern exactly (repo_culture_profilefix(review): repo-culture-profile cache works correctly but has zero hit/miss telemetry #4509, grounding/review-memory shipped earlier this same epic in PR #4658).computeImpactMapnow takesenvas an explicit first argument (the existingRagInfra/StorageAdapterseam intentionally stays storage-only for portability, so telemetry is threaded separately).src/services/public-reuse-rate-trend.ts, extendingGET /v1/public/statswithreuseRateTrend— 8 trailing weeks ofhits/(hits+misses)across everygithub_app.*_cache_hit/*_cache_missevent (a naming convention, not a hardcoded capability list, so it automatically covers today's eight capabilities and any future one that follows the same convention) plus ai_review's three non-suffix-conforming reuse variants (frozen/paused/one-shot), which are the same "avoided a redundant AI call" signal under a different name.audit_eventsis already durable, so a live day-bucketed re-query recomputes any historical week correctly on every request. Deliberately not scoped to the public-stats repo allowlist either (unlike accuracy) — a cache-hit/miss event carries no PR content or repo-specific outcome, so the aggregate number doesn't reveal per-repo activity, andtarget_keyisn't uniformly shaped across all eight capabilities./statstrend chart is deferred to a follow-up PR, matching the capture-then-extend split already used for feat(stats): review turnaround-time tracking (webhook received → comment posted), public + historical #4446 and feat(stats): review-accuracy as a historical trend, not just a live snapshot #4447.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally — 100% line/branch coverage on both new/changedsrc/**files (impact-map.ts,public-reuse-rate-trend.ts), confirmed via scoped coverage runsnpm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderate— 0 vulnerabilitiesSafety
PublicStatsSchemaextended withreuseRateTrend, regenerated vianpm run ui:openapi, settings-parity checked.UI Evidencesection. — N/A, backend-only change, no visible UI.