Fix Copilot seat organization attribution causing wrong DORA adoption denominator - #9049
Open
bramhanandlingala wants to merge 1 commit into
Open
Fix Copilot seat organization attribution causing wrong DORA adoption denominator#9049bramhanandlingala wants to merge 1 commit into
bramhanandlingala wants to merge 1 commit into
Conversation
|
Thank you for creating a PR so quickly and for helping me investigate this issue. Does this fix seats assigned through a central licensing organization? The change stores Would Product Org A and Product Org B still have zero denominators? Should licensed users be joined with organization membership, and could this scenario be added as a test? |
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
Fixes #9041. Copilot seats from GitHub's enterprise API were being
tagged with the connection's "shell" org instead of the org that
actually granted the seat, which made the DORA dashboard's adoption
percentage wrong (often zero) for any org besides the shell org. Two
dashboard queries also mislabeled NULL adoption as the highest tier
instead of excluding it.
Root cause
seat_extractor.gohardcoded every seat's organization toconnection.Organization, ignoring the per-seatorganizationfield the enterprise seats endpoint actually returns.
CASEstatements usedELSEasa catch-all, so NULL adoption silently got labeled
>75%/highinstead of being excluded.
Fix
organizationfield(
metrics_extractor.go) and prefer it over the connection'sconfigured org, falling back only when the API doesn't supply one
(
seat_extractor.go).ELSEwith explicitWHEN+WHERE ... IS NOT NULLinboth dashboards' tier queries (MySQL and PostgreSQL).
tests covering org-scoped, enterprise-with-org, and
enterprise-with-empty-org cases.
Closes #9041