Skip to content

fix: for GET /questionnaires, exclude non-draft questionnaires when not explicitly fetching drafts and onlyAdministratedByMe is false#1551

Open
Eraxyso wants to merge 3 commits intomainfrom
fix/fix-permission-of-get-questionnaires
Open

fix: for GET /questionnaires, exclude non-draft questionnaires when not explicitly fetching drafts and onlyAdministratedByMe is false#1551
Eraxyso wants to merge 3 commits intomainfrom
fix/fix-permission-of-get-questionnaires

Conversation

@Eraxyso
Copy link
Copy Markdown
Contributor

@Eraxyso Eraxyso commented May 5, 2026

Summary by CodeRabbit

  • バグ修正
    • 条件によりドラフト(未発行)のアンケートがデフォルトで検索結果から除外されるようになりました。
  • テスト
    • 検索結果の除外挙動を検証するテストを追加・更新しました(特定のアンケートIDの除外確認を含む)。

@Eraxyso Eraxyso requested a review from kaitoyama May 5, 2026 04:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3ea76f3-779f-464c-bd2a-4092fc2c9291

📥 Commits

Reviewing files that changed from the base of the PR and between 751bf5c and 53def8d.

📒 Files selected for processing (2)
  • controller/questionnaire.go
  • controller/questionnaire_test.go

📝 Walkthrough

Walkthrough

GetQuestionnairesコントローラメソッドが、OnlyAdministratedByMeが偽で呼び出し側が明示的にisDraftを渡さなかった場合に、isDraftを非nilのfalseポインタに設定して草案(draft)を除外するように変更されました。対応する単体テストが更新され、デフォルトで草案が除外されることと特定IDの除外を検証します。

Changes

アンケート照会フィルタリング(本体 + テスト)

Layer / File(s) Summary
コントローラ振る舞い
controller/questionnaire.go
OnlyAdministratedByMe == falseかつ呼び出し側がisDraftを未指定の場合、isDraftを非nilのfalseポインタにセットしてダウンストリームクエリでdraftを除外するロジックを追加。
テスト期待値拡張
controller/questionnaire_test.go
TestGetQuestionnairesの期待構造体にquestionnaireIDExcludes *[]intを追加し、結果リストに含まれないIDを検証するロジックを追加。
テストケース更新
controller/questionnaire_test.go
デフォルト一覧のテストケースを「ドラフトを含む」から「ドラフトを除外する」へ変更し、該当IDのNotContainsアサーションを追加。
テストアサーション差替え
controller/questionnaire_test.go
以前の包含チェック(Contains)を削除し、除外チェック(Excludes / NotContains)で検証するように差し替え。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、GetQuestionnairesエンドポイントのドラフト質問票除外ロジックに関する主な変更を正確に説明しており、チェンジセットの主要な目的と一致しています。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fix-permission-of-get-questionnaires

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.09%. Comparing base (e629811) to head (53def8d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1551      +/-   ##
==========================================
+ Coverage   64.00%   64.09%   +0.09%     
==========================================
  Files          27       27              
  Lines        4125     4128       +3     
==========================================
+ Hits         2640     2646       +6     
+ Misses       1088     1086       -2     
+ Partials      397      396       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kaitoyama
Copy link
Copy Markdown
Contributor

CI通してほしいです

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants