fix(perf): correct metrics_recorded count and close SQLite handle on error in _store_metric - #1360
Merged
groupthinking merged 3 commits intoAug 29, 2026
Conversation
…rror metrics_recorded in the performance-report ingest now returns len(samples) (rows actually written) instead of len(metrics) (keys submitted), so reports mixing numeric and non-numeric values no longer overcount. The legacy _store_metric now delegates to the batched _store_metrics with a one-element list, gaining its try/finally so an exception between connect and close no longer leaks the SQLite handle. Generated with [Linear](https://linear.app/myxstack/issue/GRV-308/perf-metrics-recorded-overcounts-non-numeric-samples-legacy-store#agent-session-6d3cc388) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
Contributor
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Agent Completion Truth Gate: BLOCKEDReasons: Machine-readable verdict{
"details": {
"collection_errors": [
"linked_issue_not_agent_task",
"missing_intent_snapshot",
"missing_agent_run_id",
"missing_agent_login"
],
"invalid_fields": [
"policy.agent_login",
"policy.run_id"
]
},
"reasons": [
"invalid_payload"
],
"verdict": "blocked"
} |
This was referenced Aug 5, 2026
groupthinking
marked this pull request as ready for review
August 29, 2026 07:09
…-samples-grv-308-efbc
…-samples-grv-308-efbc
groupthinking
deleted the
perf-metrics_recorded-overcounts-non-numeric-samples-grv-308-efbc
branch
August 29, 2026 07:53
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.
Canonical issue
Closes #1352
Outcome
POST /api/v1/performance/reportnow returns the number of samples actually persisted (len(samples)) instead of the number of metric keys submitted, so reports mixing numeric and non-numeric values no longer overcount. The legacy_store_metricnow delegates to the batched_store_metricswith a one-element list, inheriting itstry/finallyso an exception mid-write no longer leaks the SQLite connection.Scope
Risk
metrics_recordedvalue for mixed reports.Verification
At head
cbb020f1ef3555a8e842d572651b4c00e347ee68:pytest tests/unit/test_v1_router_extended.py -k performance: 7 passed, including the newtest_performance_report_counts_only_persisted_samples._store_metricexercised against a temp SQLite DB; the row is written through the batched path.Production evidence
Not applicable — backend-only bug fix, covered by unit tests.
Agent handoff
Agent provenance