fix: honest API-key gating in the Add-column dialog#103
Merged
Conversation
…picker Both columns hard-require a token (the stargazers list is auth-gated; the Discussions GraphQL API gives unauthenticated requests ~0 quota), but they only advertised it via free-text rateLimitHint. The Add-column dialog dims a source from capabilities.requiresEnv, so these two showed as ready and only failed on refresh. Declare requiresEnv: ["GITHUB_TOKEN"] on both.
.env.example ships XAI_API_KEY=xai-... (a non-empty placeholder). Boolean( process.env.X) counted it as configured, so the 6 xAI columns showed as ready in the Add-column dialog but failed on refresh with an opaque xAI "Incorrect API key", and Settings reported the key as set. ./minitor doctor already rejects the same placeholder. Add a pure isPlaceholderValue() helper (blank or contains an ellipsis) and use it in getKeyAvailability + getEnvKeysStatus (Settings) and callGrok (fetch). Now the columns dim honestly and a leftover placeholder fails with a clear "XAI_API_KEY is not set" instead of a bounced upstream call.
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.
Problem
The Add-column picker under-reported which columns need a key. It dimmed a source only from
capabilities.requiresEnv, and two things were off:github-starsandgithub-discussionshard-require aGITHUB_TOKEN(stargazers list is auth-gated; Discussions GraphQL gives unauthenticated requests ~0 quota) but declared it only in free-textrateLimitHint— so they showed as ready and only failed on refresh.requiresEnv, but.env.exampleshipsXAI_API_KEY=xai-...— a non-empty placeholder.Boolean(process.env.XAI_API_KEY)counted it as configured, so those columns looked ready but failed on refresh with an opaque xAI"Incorrect API key", and Settings reported the key as set../minitor doctoralready rejects the same placeholder.Net: the UI showed 6 key-gated columns when 8 actually can't fetch without a credential — and even those 6 weren't dimmed when a placeholder was present.
Fix
requiresEnv: ["GITHUB_TOKEN"]ongithub-stars+github-discussions.isPlaceholderValue()tolib/env-keys.ts(blank or contains an ellipsis.../…) and route all three key-presence reads through it:getKeyAvailability(dialog dimming),getEnvKeysStatus(Settings), andcallGrok(fetch-time).Now the dialog dims all 8 key-gated columns honestly in every env state, and a leftover placeholder fails with a clear
"XAI_API_KEY is not set"instead of a bounced upstream call.Verification
x-trendingwith the placeholder key →"XAI_API_KEY is not set in .env.local (still the .env.example placeholder?)"(was"Incorrect API key").npm test→ 275 pass (addedtest/env-keys.test.ts);eslintclean.