test: add selfhosted+OAuth integration test suite#400
Merged
tomasz-tomczyk merged 1 commit intomainfrom Apr 30, 2026
Merged
Conversation
New `make test-share-sync-selfhosted` target boots a separate crit-web
instance on :4001 with SELFHOSTED=true and OAuth enforcement, then runs
TestSelfhosted* against it to cover the auth-gated paths that the
default test suite (which targets a public instance on :4000) does not
exercise.
Covers:
- /r/:token redirects unauthenticated visitors to /auth/login
- /api/export/:token/* and /api/reviews/:token/{document,comments}
return 401 without bearer, 200 with bearer
- crit share fails without CRIT_AUTH_TOKEN, succeeds with it
- Full lifecycle: seed user, share with bearer, fetch via API
Also regenerates integration_hashes_gen.go to absorb upstream Docker
integration files added since this branch was cut.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #400 +/- ##
==========================================
+ Coverage 67.05% 67.09% +0.03%
==========================================
Files 19 19
Lines 8221 8221
==========================================
+ Hits 5513 5516 +3
+ Misses 2278 2276 -2
+ Partials 430 429 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
make test-share-sync-selfhostedtarget boots a separate crit-web instance on:4001withSELFHOSTED=trueand OAuth enforcement, then runsTestSelfhosted*against it. Covers auth-gated paths the default test suite (which targets a public instance on:4000) does not exercise.scripts/run-selfhosted-tests.shorchestrates: source.envrc.local, refuse if:4001busy, background the server, poll/health, run tests, trap cleanup.integration_hashes_gen.goto absorb upstream Docker integration files.Coverage
TestSelfhostedReviewPageRedirectsUnauthenticated—/r/:tokenreturns 302/303 →/auth/login?return_to=…for anon visitorsTestSelfhostedExportEndpointRequires401—/api/export/:token/review401 anon, 200 with bearerTestSelfhostedReviewDocumentApiRequires401— same shape for/documentand/commentsTestSelfhostedShareRequiresAuthToken—crit sharefails withoutCRIT_AUTH_TOKENTestSelfhostedShareSucceedsWithAuthToken—crit sharewith bearer succeeds; resulting LiveView still redirects anonTestSelfhostedExportWithAuthToken— full lifecycle: seed user, share with bearer, fetch via APIReview
Test plan
go test -race -count=1 ./...→ pass;golangci-lintclean.🤖 Generated with Claude Code