Fix duplicate users in GitHub Enterprise with multiple organizations #227
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.
Problem
In GitHub Enterprise environments with multiple organizations, users assigned to GitHub Copilot across different organizations within the same enterprise were appearing as duplicates in the "Seat Analysis" tab. This caused inflated seat counts that didn't match the actual billing.
According to GitHub's documentation:
However, the GitHub API returns separate seat entries for each organization assignment, leading to duplicate entries in the UI while the
total_seats
field correctly reflects the unique user count.Solution
Added deduplication logic to the seats API endpoint (
/server/api/seats.ts
) that:Key Changes
server/api/seats.ts
: AddeddeduplicateSeats()
function that removes duplicates by user IDVisual Result
The "Total Assigned" count now correctly shows 1 unique user instead of showing multiple entries for the same user across different organizations. This aligns with GitHub's billing model and the
total_seats
value from the API.Testing
Fixes #178.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.fontshare.com
node (vitest)
(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev
(dns block)api.fontsource.org
node (vitest)
(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev
(dns block)fonts.bunny.net
node (vitest)
(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev
(dns block)fonts.google.com
node (vitest)
(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev
(dns block)fonts.googleapis.com
node (vitest 2)
(dns block)node (vitest 3)
(dns block)node (vitest 1)
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.