ci: add metrics DB review label gate#1425
Merged
Merged
Conversation
Gate PRs touching app/api/metrics, lib/metrics, and lib/db/index.ts (the metricsDb pool concurrency cap) behind a metrics-db-reviewed label applied by a non-author. Guardrail for the 2026-05-29 DB CPU incident class, which only manifests at prod data volume.
92faf19 to
cc3a136
Compare
🧹 PR Environment Cleaned UpThe PR environment has been successfully deleted. Deleted Resources:
All resources have been cleaned up and will no longer incur costs. |
ℹ️ No PR Environment to Clean UpNo PR environment was found for this PR. This is expected if:
|
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.
Follow-up from the 2026-05-29 DB CPU spike (P1). The incident-class change - a heavy aggregate query added without index analysis, or the metrics DB pool concurrency raised without measurement - only manifests at prod data volume and cannot be caught by tests, so the guardrail lives in CI.
What this adds
A required-status-check-shaped workflow (
metrics-db-review-gate.yml) that forces a human sign-off when a PR changes metrics code:pr-title-check.yml.stagingandprod, withlabeled/unlabeledtypes so the check re-evaluates the instant the label is flipped (not just on the next push).git diffoverapp/api/metrics,lib/metrics, andlib/db/index.ts. The metrics trees are gated wholesale;lib/db/index.tsis gated as a single file because it holds themetricsDbpool and its concurrency cap (the incident lever) while the rest oflib/db(schema, query helpers) churns too often to gate without turning the label into a rubber stamp.metrics-db-reviewedlabel is present AND was applied by someone other than the PR author. The non-author check resolves the labeler from the issue timeline (the webhook only names the actor on thelabeledevent, and a later push would erase that signal).The label asserts a reviewer confirmed any new/changed aggregate queries are optimised, the scanned tables are appropriately indexed, and any metricsDb pool concurrency change was measured against the scrape timeout. It is a pure attestation (no EXPLAIN artifact required).
Activation (post-merge, manual)
This workflow is inert until it is marked a required check in branch protection for
stagingandprod. The check name ismetrics-db-review-gate. It only appears in the required-checks list after it has run on at least one PR, so the order is: merge -> let it run once -> add as required.The
metrics-db-reviewedlabel has been created in the repo.