fix: align ticket provider credentials and fix settings status check#523
fix: align ticket provider credentials and fix settings status check#523nethi wants to merge 1 commit intojonwiggins:mainfrom
Conversation
Ensures GitHub ticket providers created via Settings or the new repository flow automatically resolve and store a dedicated credential secret. Also fixes the false-negative 'No token configured' on the Settings page by making the status check workspace-aware, and adds validation tests for the provider creation safety check.
jonwiggins
left a comment
There was a problem hiding this comment.
Three coordination asks here:
-
This is the read side of the same bug as #522. Both PRs touch
apps/api/src/routes/github-token.ts(different lines, no merge conflict — but same AAD/decryption issue). If #523 lands without #522 first, the status endpoint will read a workspace-scoped row using the wrong AAD and fail decryption silently. Suggest either combining them or landing #522 first and rebasing this on top. -
Title under-describes the change. The diff includes a brand-new "Enable GitHub Issues integration" checkbox in
apps/web/src/app/repos/new/page.tsx(~36 lines of UI). That's a feature, not a fix. Could the title be reframed asfeat(repos): GitHub Issues toggle in new repo wizard + fix: ...? Not blocking, just makes future archaeology easier. -
(Small) The auto-resolve success path isn't covered by a test. The 400-error path is — could you mirror it for the success branch? Mocking
getGitHubTokenshould be straightforward.
Once #522's full audit lands, this one is otherwise ready.
Problem
GitHub ticket providers created outside the setup wizard (via Settings page or new repository flow) were missing dedicated credential secrets, causing "Secret not found" and "No GitHub token available" errors during background ticket sync.
Additionally, the Settings page showed a false-negative "No token configured" message even when a workspace-scoped GitHub token was available.
Solution
Workspace-aware status check (github-token.ts)
GET /api/github-token/statusto passreq.user.workspaceIdtoretrieveSecret()Auto-resolve credentials on provider creation (tickets.ts)
getGitHubToken({ server: true, workspaceId })400 Bad Requestif no token is available (prevents creating "broken" providers)Enable ticket integration during repo creation (repos/new/page.tsx)
optiolabel filterTest coverage (request-input-validation.test.ts)
Testing
Files Changed
apps/api/src/routes/github-token.ts- Workspace-aware token statusapps/api/src/routes/tickets.ts- Auto-resolve credentials on provider creationapps/api/src/routes/request-input-validation.test.ts- Test coverage for error handlingapps/web/src/app/repos/new/page.tsx- Ticket integration toggle in new repo flow