You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2026/10/21 08:34:18 UTC
(answer) branch dev updated (bd7614b8 -> 7af928cb)
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a change to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
from bd7614b8 fix: allow POST for connector redirect route
new 2cb835ae test: expose swallowed similar question lookup error
new a12395ce return error on Info() fail
new 16249581 test: expose swallowed revision lookup error
new 2f271700 return error on ExistUnereviewedByObjectID() fail
new 7b5740c1 return error on json.Marshal() fail (never happens)
new 04b602a7 Revert "test: expose swallowed revision lookup error"
new 7af928cb Revert "test: expose swallowed similar question lookup error"
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
internal/repo/captcha/captcha.go | 2 +-
internal/service/content/question_service.go | 2 +-
internal/service/content/revision_service.go | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
(answer) 04/07: return error on ExistUnereviewedByObjectID() fail
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 2f271700a7809c2a847265578ca10696826f2a1e
Author: seiya <20...@users.noreply.github.com>
AuthorDate: Thu Oct 15 13:12:13 2026 +0000
return error on ExistUnereviewedByObjectID() fail
---
internal/service/content/revision_service.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/internal/service/content/revision_service.go b/internal/service/content/revision_service.go
index b932ba8b..64e5fe9d 100644
--- a/internal/service/content/revision_service.go
+++ b/internal/service/content/revision_service.go
@@ -508,7 +508,7 @@ func (rs *RevisionService) CheckCanUpdateRevision(ctx context.Context, req *sche
resp *schema.ErrTypeData, err error) {
_, exist, err := rs.revisionRepo.ExistUnreviewedByObjectID(ctx, req.ID)
if err != nil {
- return nil, nil
+ return nil, err
}
if exist {
return &schema.ErrTypeToast, errors.BadRequest(reason.RevisionReviewUnderway)
(answer) 01/07: test: expose swallowed similar question lookup error
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 2cb835ae226cc9562b39907f6ae41704222ffae2
Author: seiya <20...@users.noreply.github.com>
AuthorDate: Thu Oct 15 13:08:59 2026 +0000
test: expose swallowed similar question lookup error
Co-Authored-By: codex <co...@openai.com>
---
internal/service/content/question_service_test.go | 53 +++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/internal/service/content/question_service_test.go b/internal/service/content/question_service_test.go
new file mode 100644
index 00000000..d688c48f
--- /dev/null
+++ b/internal/service/content/question_service_test.go
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package content
+
+import (
+ "context"
+ "errors"
+ "testing"
+
+ "github.com/apache/answer/internal/entity"
+ questioncommon "github.com/apache/answer/internal/service/question_common"
+)
+
+type similarQuestionErrorRepo struct {
+ questioncommon.QuestionRepo
+ err error
+}
+
+func (r *similarQuestionErrorRepo) GetQuestion(context.Context, string) (*entity.Question, bool, error) {
+ return nil, false, r.err
+}
+
+func TestSimilarQuestionPropagatesInfoError(t *testing.T) {
+ wantErr := errors.New("question lookup failed")
+ repo := &similarQuestionErrorRepo{err: wantErr}
+ service := &QuestionService{
+ questioncommon: questioncommon.NewQuestionCommon(
+ repo, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
+ ),
+ }
+
+ _, _, err := service.SimilarQuestion(context.Background(), "1", "viewer")
+ if !errors.Is(err, wantErr) {
+ t.Fatalf("SimilarQuestion() error = %v, want %v", err, wantErr)
+ }
+}
(answer) 03/07: test: expose swallowed revision lookup error
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 16249581a209124777befe652280873c52807626
Author: seiya <20...@users.noreply.github.com>
AuthorDate: Thu Oct 15 13:11:49 2026 +0000
test: expose swallowed revision lookup error
Co-Authored-By: codex <co...@openai.com>
---
internal/service/content/revision_service_test.go | 51 +++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/internal/service/content/revision_service_test.go b/internal/service/content/revision_service_test.go
new file mode 100644
index 00000000..9545b583
--- /dev/null
+++ b/internal/service/content/revision_service_test.go
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package content
+
+import (
+ "context"
+ "errors"
+ "testing"
+
+ "github.com/apache/answer/internal/entity"
+ "github.com/apache/answer/internal/schema"
+ "github.com/apache/answer/internal/service/revision"
+)
+
+type checkCanUpdateRevisionErrorRepo struct {
+ revision.RevisionRepo
+ err error
+}
+
+func (r *checkCanUpdateRevisionErrorRepo) ExistUnreviewedByObjectID(context.Context, string) (*entity.Revision, bool, error) {
+ return nil, false, r.err
+}
+
+func TestCheckCanUpdateRevisionPropagatesLookupError(t *testing.T) {
+ wantErr := errors.New("revision lookup failed")
+ service := &RevisionService{
+ revisionRepo: &checkCanUpdateRevisionErrorRepo{err: wantErr},
+ }
+
+ _, err := service.CheckCanUpdateRevision(context.Background(), &schema.CheckCanQuestionUpdate{ID: "1"})
+ if !errors.Is(err, wantErr) {
+ t.Fatalf("CheckCanUpdateRevision() error = %v, want %v", err, wantErr)
+ }
+}
(answer) 06/07: Revert "test: expose swallowed revision lookup error"
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 04b602a7e50f632aeedd3b69e4f961d4c18f8ac1
Author: seiya <20...@users.noreply.github.com>
AuthorDate: Thu Oct 15 13:15:54 2026 +0000
Revert "test: expose swallowed revision lookup error"
This reverts commit 304ff973bb91c1db3622817fe2ac88eed5c5c927.
---
internal/service/content/revision_service_test.go | 51 -----------------------
1 file changed, 51 deletions(-)
diff --git a/internal/service/content/revision_service_test.go b/internal/service/content/revision_service_test.go
deleted file mode 100644
index 9545b583..00000000
--- a/internal/service/content/revision_service_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package content
-
-import (
- "context"
- "errors"
- "testing"
-
- "github.com/apache/answer/internal/entity"
- "github.com/apache/answer/internal/schema"
- "github.com/apache/answer/internal/service/revision"
-)
-
-type checkCanUpdateRevisionErrorRepo struct {
- revision.RevisionRepo
- err error
-}
-
-func (r *checkCanUpdateRevisionErrorRepo) ExistUnreviewedByObjectID(context.Context, string) (*entity.Revision, bool, error) {
- return nil, false, r.err
-}
-
-func TestCheckCanUpdateRevisionPropagatesLookupError(t *testing.T) {
- wantErr := errors.New("revision lookup failed")
- service := &RevisionService{
- revisionRepo: &checkCanUpdateRevisionErrorRepo{err: wantErr},
- }
-
- _, err := service.CheckCanUpdateRevision(context.Background(), &schema.CheckCanQuestionUpdate{ID: "1"})
- if !errors.Is(err, wantErr) {
- t.Fatalf("CheckCanUpdateRevision() error = %v, want %v", err, wantErr)
- }
-}
(answer) 02/07: return error on Info() fail
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit a12395cece020df13defcb5ba6e44d27f1514bb3
Author: seiya <20...@users.noreply.github.com>
AuthorDate: Thu Oct 15 13:09:51 2026 +0000
return error on Info() fail
---
internal/service/content/question_service.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/internal/service/content/question_service.go b/internal/service/content/question_service.go
index ced0e010..c04baa28 100644
--- a/internal/service/content/question_service.go
+++ b/internal/service/content/question_service.go
@@ -1466,7 +1466,7 @@ func canViewSimilarQuestion(question *entity.Question, userID string, per schema
func (qs *QuestionService) SimilarQuestion(ctx context.Context, questionID string, loginUserID string) ([]*schema.QuestionPageResp, int64, error) {
question, err := qs.questioncommon.Info(ctx, questionID, loginUserID)
if err != nil {
- return nil, 0, nil
+ return nil, 0, err
}
tagNames := make([]string, 0, len(question.Tags))
for _, tag := range question.Tags {
(answer) 07/07: Revert "test: expose swallowed similar question lookup error"
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 7af928cb99526505d88e3353c995f13fa12c2267
Author: seiya <20...@users.noreply.github.com>
AuthorDate: Thu Oct 15 13:15:56 2026 +0000
Revert "test: expose swallowed similar question lookup error"
This reverts commit c4dd09b56a88292d2fae75ed1aa6736ecedfff0a.
---
internal/service/content/question_service_test.go | 53 -----------------------
1 file changed, 53 deletions(-)
diff --git a/internal/service/content/question_service_test.go b/internal/service/content/question_service_test.go
deleted file mode 100644
index d688c48f..00000000
--- a/internal/service/content/question_service_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package content
-
-import (
- "context"
- "errors"
- "testing"
-
- "github.com/apache/answer/internal/entity"
- questioncommon "github.com/apache/answer/internal/service/question_common"
-)
-
-type similarQuestionErrorRepo struct {
- questioncommon.QuestionRepo
- err error
-}
-
-func (r *similarQuestionErrorRepo) GetQuestion(context.Context, string) (*entity.Question, bool, error) {
- return nil, false, r.err
-}
-
-func TestSimilarQuestionPropagatesInfoError(t *testing.T) {
- wantErr := errors.New("question lookup failed")
- repo := &similarQuestionErrorRepo{err: wantErr}
- service := &QuestionService{
- questioncommon: questioncommon.NewQuestionCommon(
- repo, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
- ),
- }
-
- _, _, err := service.SimilarQuestion(context.Background(), "1", "viewer")
- if !errors.Is(err, wantErr) {
- t.Fatalf("SimilarQuestion() error = %v, want %v", err, wantErr)
- }
-}
(answer) 05/07: return error on json.Marshal() fail (never happens)
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 7b5740c1b46c2c99906c83f7948b32dae12bd09e
Author: seiya <20...@users.noreply.github.com>
AuthorDate: Thu Oct 15 13:14:56 2026 +0000
return error on json.Marshal() fail (never happens)
---
internal/repo/captcha/captcha.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/internal/repo/captcha/captcha.go b/internal/repo/captcha/captcha.go
index f8195c1a..800a0fd1 100644
--- a/internal/repo/captcha/captcha.go
+++ b/internal/repo/captcha/captcha.go
@@ -53,7 +53,7 @@ func (cr *captchaRepo) SetActionType(ctx context.Context, unit, actionType, conf
value.Num = amount
valueStr, err := json.Marshal(value)
if err != nil {
- return nil
+ return err
}
err = cr.data.Cache.SetString(ctx, cacheKey, string(valueStr), 6*time.Minute)
if err != nil {