Repository navigation
Fix duplicate GitHub signup, improve S3 error msgs - #176
Merged
Merged
Conversation
Sync dev to main: v0.6.1 fixes and docs update
- Add GitHub username duplicate check to signup endpoint - Add UNIQUE constraint on github_username (migration 0012) - Improve S3 credential decryption error messages with actionable guidance for environment mismatch issues - Handle DB UNIQUE constraint errors as safety net in signup catch block (returns 409 instead of 500) - Update check-github endpoint to report if username is already registered in NEMAR - Add test for duplicate github_username signup Fixes #175
- Use COLLATE NOCASE for github_username UNIQUE index and queries (GitHub usernames are case-insensitive) - Store canonical GitHub login from API, not user input - Separate GitHub API and DB error handling in check-github - Skip DB query in check-github when GitHub user not found - Log unhandled column in UNIQUE constraint fallback - Standardize S3 error message text across both endpoints - Add tests for check-github endpoint (registered field, unregistered user, missing param)
Contributor
Author
Review Findings and FixesRan comprehensive PR review (code-reviewer, silent-failure-hunter, pr-test-analyzer, code-simplifier). All actionable issues addressed in commit 7833aa9.
All 57 tests pass. Both prod and dev deployed. Migration updated on remote D1. |
This was referenced Feb 24, 2026
neuromechanist
added a commit
that referenced
this pull request
May 11, 2026
#430 CI api-test failure root cause: validateGitHubUsername() ran before the dup check, so a signup attempt with an already-registered github_username that happens not to resolve on GitHub (renamed/deleted account, or test seed with a fake username) returned 400 instead of 409. Now we direct-check the raw input first (case-insensitive). The GitHub API call is retained for canonical-login dedup but only re-checks when GitHub normalized the case (the original motivation in #176 for doing validation first). Saves one REST call on the common already-registered case and unblocks api-test. Test "signup with existing github_username returns 409" in test/api.test.ts:124 is the assertion.
3 of 5 tasks
neuromechanist
added a commit
that referenced
this pull request
May 11, 2026
* fix: three publication regressions (#429) 1. backend/src/services/github.ts: pin archiver to ^7.0.1 in the Generate Archive workflow template. archiver 8.x is ESM-only and require("archiver") no longer returns the factory function, causing "archiver is not a function" on every newly published dataset. 2. backend/src/routes/admin.ts: skip the createOrUpdateFile call in update_readme when the DOI badge is already present and the README does not need renaming. Previously the orchestrator shipped an empty "Add DOI badge: ..." commit on every --resume, which retriggered BIDS Validation each time. 3. src/lib/import-openneuro.ts: restore skipCiCheck=true (4th arg of approvePublication) in the import retry loop. PR #271 had flipped it to false on the assumption that the BIDS check could complete in time, but in practice the push + approve race always loses and imports wind up in 'bids_validation_pending'. OpenNeuro datasets are validated upstream and the CI runs separately after push regardless. * fix: address PR review findings on #430 - backend/src/services/doi.ts: extract planReadmeBadgeCommit() pure helper. Tightens the skip path to require that the existing badge encode the *current* concept DOI; without that check a stale badge (from re-registered or provider-migrated DOIs) would be silently kept. Detects mismatch and emits a "Replace stale DOI badge" commit. URL-encoded DOI form is recognized as a match (matches the actual badge URL encoding). - backend/src/routes/admin.ts: use planReadmeBadgeCommit() in update_readme. - test/readme-badge-plan.test.ts: unit tests covering skip, stale-badge rewrite, no-README, rename-needed, and encoded-DOI cases (6 cases). - test/workflow-yaml.test.ts: assert generate-archive.yml pins archiver@^7 to catch a future unpinned regression. - Trim verbose comments in github.ts and import-openneuro.ts per review. Follow-up #431 tracks the design improvement of replacing skipCiCheck=true with a bounded poll on workflow_runs. * fix(auth): direct github_username dup check before GitHub validation #430 CI api-test failure root cause: validateGitHubUsername() ran before the dup check, so a signup attempt with an already-registered github_username that happens not to resolve on GitHub (renamed/deleted account, or test seed with a fake username) returned 400 instead of 409. Now we direct-check the raw input first (case-insensitive). The GitHub API call is retained for canonical-login dedup but only re-checks when GitHub normalized the case (the original motivation in #176 for doing validation first). Saves one REST call on the common already-registered case and unblocks api-test. Test "signup with existing github_username returns 409" in test/api.test.ts:124 is the assertion.
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
github_usernamevia migration 0012check-githubendpoint to also report if a GitHub username is already registeredRoot Cause (S3 Issue)
Arno's account was approved via the dev worker, which encrypted his S3 credentials with the dev
ENCRYPTION_KEY. When he hit the production API for upload, decryption failed due to key mismatch. Fix: regenerated credentials on production + improved error messaging for future diagnosis.Test plan
github_usernamereturns 409Fixes #175