You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #4496. P12 — low severity, observability-only (no functional defect).
Context
Unlike enrichment/grounding/impact-map, repo-culture-profile is NOT exposed to per-invocation recomputation — it has a genuine, correctly-functioning cache (signal_snapshots table, 6-hour TTL, plus a merged-PR-count drift invalidation, src/review/repo-culture-profile.ts:229-243) — but that cache's hit/miss branch is completely unlabeled: it emits no incr() counter and no audit event distinguishing a cache hit from a fresh D1 derive.
Compare to ai_review's cache sitting right beside it in the same prompt-assembly pipeline, which has full instrumentation: incr("gittensory_ai_review_cache_hit_total") (processors.ts:9840) plus a paired recordAuditEvent (github_app.ai_review_cache_hit), and the mirror incr("gittensory_ai_review_cache_miss_total") (processors.ts:9874) plus github_app.ai_review_cache_miss. readCachedCultureProfile (repo-culture-profile.ts:229-243) and extractRepoCultureProfile's hit/miss branches (lines 278-294) have neither.
This is the exact gap #4448 (part of tonight's earlier efficiency-tracking epic, #4445) already identified for 6 currently-uninstrumented AI capabilities — repo-culture-profile is one of them. Confirmed the underlying cache reads (listSignalSnapshots, src/db/repositories.ts:4742-4751) DO have a correct ORDER BY/LIMIT, so this is NOT the same "non-deterministic ordering defeats the cache" bug as the fixed linked_issue_satisfaction issue (#4481) — the cache itself works correctly; only the metrics/audit-event layer is absent.
Requirements
Add incr()/recordAuditEvent calls on both the readCachedCultureProfile hit path and the extractRepoCultureProfile miss/re-derive path, mirroring the ai_review cache's instrumentation exactly (event names, metadata shape).
Invariant + regression tests (non-negotiable): a test asserting a cache hit fires exactly the hit counter/audit-event pair and NOT the miss pair; a test asserting a cache miss (TTL expired, or drift-invalidated) fires exactly the miss counter/audit-event pair and NOT the hit pair; a regression test for the drift-invalidation path specifically (a merged-PR-count change since the last snapshot), confirming it's correctly counted as a miss, not silently uninstrumented.
Deliverables
Hit/miss incr() counters added, matching the ai_review cache's naming convention
Hit/miss recordAuditEvent calls added, matching the ai_review cache's event shape
Invariant tests: hit fires only hit telemetry, miss fires only miss telemetry
Regression test: drift-invalidation path is correctly counted as a miss
Expected outcome
An operator dashboard can see repo-culture-profile's actual cache reuse rate, closing one of the six capability gaps #4448 already identified — no functional change, purely restoring parity with the sibling ai_review cache's observability.
References
src/review/repo-culture-profile.ts:229-243, 278-294 (the uninstrumented hit/miss branches)
src/queue/processors.ts:9825-9884 (the ai_review cache's full instrumentation, the pattern to mirror)
Part of #4496. P12 — low severity, observability-only (no functional defect).
Context
Unlike enrichment/grounding/impact-map, repo-culture-profile is NOT exposed to per-invocation recomputation — it has a genuine, correctly-functioning cache (
signal_snapshotstable, 6-hour TTL, plus a merged-PR-count drift invalidation,src/review/repo-culture-profile.ts:229-243) — but that cache's hit/miss branch is completely unlabeled: it emits noincr()counter and no audit event distinguishing a cache hit from a fresh D1 derive.Compare to
ai_review's cache sitting right beside it in the same prompt-assembly pipeline, which has full instrumentation:incr("gittensory_ai_review_cache_hit_total")(processors.ts:9840) plus a pairedrecordAuditEvent(github_app.ai_review_cache_hit), and the mirrorincr("gittensory_ai_review_cache_miss_total")(processors.ts:9874) plusgithub_app.ai_review_cache_miss.readCachedCultureProfile(repo-culture-profile.ts:229-243) andextractRepoCultureProfile's hit/miss branches (lines 278-294) have neither.This is the exact gap #4448 (part of tonight's earlier efficiency-tracking epic, #4445) already identified for 6 currently-uninstrumented AI capabilities — repo-culture-profile is one of them. Confirmed the underlying cache reads (
listSignalSnapshots,src/db/repositories.ts:4742-4751) DO have a correctORDER BY/LIMIT, so this is NOT the same "non-deterministic ordering defeats the cache" bug as the fixedlinked_issue_satisfactionissue (#4481) — the cache itself works correctly; only the metrics/audit-event layer is absent.Requirements
incr()/recordAuditEventcalls on both thereadCachedCultureProfilehit path and theextractRepoCultureProfilemiss/re-derive path, mirroring theai_reviewcache's instrumentation exactly (event names, metadata shape).Deliverables
incr()counters added, matching theai_reviewcache's naming conventionrecordAuditEventcalls added, matching theai_reviewcache's event shapeExpected outcome
An operator dashboard can see repo-culture-profile's actual cache reuse rate, closing one of the six capability gaps #4448 already identified — no functional change, purely restoring parity with the sibling
ai_reviewcache's observability.References
src/review/repo-culture-profile.ts:229-243, 278-294(the uninstrumented hit/miss branches)src/queue/processors.ts:9825-9884(theai_reviewcache's full instrumentation, the pattern to mirror)src/db/repositories.ts:4742-4751(listSignalSnapshots, confirmed correctly ordered — not the fix(review): make listPullRequestFiles order deterministic to stabilize content fingerprints #4481 bug class)Effort
XS