Add first_review_to_last_approval_mean_time metric#1
Open
TheOrangePuff wants to merge 15 commits intomasterfrom
Open
Add first_review_to_last_approval_mean_time metric#1TheOrangePuff wants to merge 15 commits intomasterfrom
TheOrangePuff wants to merge 15 commits intomasterfrom
Conversation
- Average duration between the first non-author substantive review (APPROVED or CHANGES_REQUESTED) and the last non-author APPROVED review on a change. - Self-reviews and changes never approved are excluded. - New JSON decoder, helper, and metric in Backend/Queries.hs. - Backend test in Backend/Test.hs covering the happy path and the no-approval exclusion.
Adds a step to tag and push the locally-built monocle image to ghcr.io/aligent/monocle:dev (and a SHA tag) so the image can be pulled and run on developer machines without rebuilding from source.
Relude hides Foldable.minimum/maximum as partial; the project's Prelude follows that. Switch to Data.List.minimum/maximum guarded by explicit non-empty pattern match.
Server.hs:923 has a hand-coded case mapping metric names to implementations for the metric/get endpoint. allMetrics in Queries.hs only feeds metric/list and metric/info, so adding a metric there isn't enough to make it executable.
The previous trend bucketed by change-creation date, which causes right-censoring at the trailing edge: recent buckets only contain changes that completed review fast enough to be done already. As late-approving changes land they push the bucket up retroactively, so 'recent months are improving' is a measurement artifact, not a real trend. Bucket by the change's last-approval timestamp instead. Once a month closes on the calendar, no future approvals can land in it, so the value is final. Also add first_review_to_last_approval_median_time. Median is more robust to slow-tail outliers than mean, which is appropriate for right-skewed review-duration data.
Removes workflows that aren't load-bearing for the build-and-pull flow we use locally: - docker-ubi.yaml — UBI variant of the container; not used. - k8s.yaml — k8s deployment validation; we run compose, not k8s. - nix.yaml — api-tests via nix; was failing on cosmetic formatter. - web.yaml — frontend tests; we don't touch the frontend. - nix-build.yaml, publish-master.yaml, publish-tag.yaml — guarded to change-metrics org or tag-triggered; never fire on this fork. Adds a concurrency block to docker.yaml so a newer push cancels older in-progress runs on the same ref.
Same as the regular mean but drops events whose reviewer or change author looks like a bot. Heuristic: muid ends in [bot] (catches GitHub's official bot suffix) or matches a small allowlist for service accounts that don't carry the suffix (dependabot, vercel, github-actions, aikido-*, copilot-pull-request-reviewer, github-advanced-security, renovate-bot, aligent-ai-code-reviewer). The data and trend helpers gain an includeMuid predicate so future 'exclude X' variants are cheap to add.
A 'single-approve' PR is one that received at least one APPROVED review and zero CHANGES_REQUESTED reviews — the team approved on first read without iteration. Two metrics: - single_approve_percentage: 0..100, all reviewers/authors counted. - single_approve_percentage_excluding_bots: same but bot accounts are dropped from numerator and denominator (using the existing isBotMuid heuristic). Self-reviews are dropped. PRs that never received an approving review are excluded from the denominator. The trend buckets by the change's last-approval date, matching the duration metrics.
- Single-page dashboard at :3001 calling the existing /api/2/metric/get, showing summary + line chart + bucket-mean table for the two excluding-bots variants of first-review-to-last-approval mean time and single-approve PR percentage. - Configurable from-date (date picker + 7d/30d/3mo/6mo/1y presets) and trend interval. API URL and workspace persist to localStorage. - nginx:alpine service with no-store cache, bind-mounted from alt-frontend/ for live edits.
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.
Description of the proposed changes
Screenshots (if applicable)
Other solutions considered (if any)
Notes to PR author
Notes to reviewers
ℹ️ When you've finished leaving feedback, please add a final comment to the PR tagging the author, letting them know that you have finished leaving feedback