Read the published research corpus and avoid expensive paging plans [skip ci]

This commit is contained in:
2026-11-07 15:51:17 +08:00
parent 913bf4292b
commit 1363792bb0
10 changed files with 355 additions and 37 deletions
+7
View File
@@ -100,6 +100,11 @@ func TestQueryDefaultsAndUnicode(t *testing.T) {
}
}
type databaseFailure string
func (failure databaseFailure) Error() string { return "private database error" }
func (failure databaseFailure) SQLState() string { return string(failure) }
func TestStorageErrorsAreRedacted(t *testing.T) {
for _, test := range []struct {
err error
@@ -108,6 +113,8 @@ func TestStorageErrorsAreRedacted(t *testing.T) {
}{
{sql.ErrNoRows, 404, "not_found"},
{context.DeadlineExceeded, 504, "research_timeout"},
{errors.Join(databaseFailure("57014"), errors.New("private statement")), 504, "research_timeout"},
{databaseFailure("42501"), 503, "research_unavailable"},
{errors.New("postgres://private-user:private-password@db/corpus"), 503, "research_unavailable"},
} {
mux := http.NewServeMux()