Add include_bots_in_aggregates checkbox to question creation#4211
Add include_bots_in_aggregates checkbox to question creation#4211
Conversation
… options - Added checkbox to Advanced Options section in question form - Field is properly integrated with React Hook Form - Uses existing backend field (questions/models.py) - Default value is false for new questions - Checkbox is shown after project picker in Advanced Options Co-authored-by: Luke Sabor <lsabor@users.noreply.github.com>
📝 WalkthroughWalkthroughAdded a new boolean field Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@front_end/src/app/`(main)/questions/components/question_form.tsx:
- Line 225: The schema field include_bots_in_aggregates currently uses
.default(true) but the PR requires the checkbox default to be false; change the
schema to .default(false) and propagate that change to the places that set
initial state: update the defaultValues object that seeds the form and adjust
the draft conversion logic (the function that converts a draft to a question /
draft conversion path) to ensure include_bots_in_aggregates is set to false for
new questions rather than true.
- Around line 471-472: The fallback for include_bots_in_aggregates is incorrect:
change the default used when post?.question?.include_bots_in_aggregates is
null/undefined from true to false so new questions default to false; update the
expression around include_bots_in_aggregates in QuestionForm (the
post?.question?.include_bots_in_aggregates ?? true usage) to use false as the
nullish fallback.
- Line 529: ExtendedQuestionDraft is missing the include_bots_in_aggregates
property so draft.include_bots_in_aggregates is untyped and the mapping uses the
wrong fallback; add a boolean include_bots_in_aggregates?: boolean to the
ExtendedQuestionDraft interface and change the mapping that sets
include_bots_in_aggregates from draft.include_bots_in_aggregates ?? true to
draft.include_bots_in_aggregates ?? false so the default aligns with PR
requirements.
🧹 Nitpick comments (2)
front_end/src/app/(main)/questions/components/question_form.tsx (2)
475-477: Unnecessary field registration.This
useEffectis redundant. The field is already initialized indefaultValuesand defined in the schema, so react-hook-form automatically tracks it. Manual registration is only needed for uncontrolled inputs without default values.♻️ Proposed fix: Remove unnecessary useEffect
- useEffect(() => { - form.register("include_bots_in_aggregates"); - }, [form]);
957-975: Duplicate label and incorrect fallback value.
- The
InputContaineralready renders "Include Bots in Aggregates" as a label. TheCheckboxcomponent'slabelprop creates a second label, causing visual redundancy.- The
?? truefallback should be?? falseper PR requirements.♻️ Proposed fix
<InputContainer labelText="Include Bots in Aggregates" explanation="When enabled, bot forecasts will be included in aggregate calculations for this question." isNativeFormControl={false} className="mb-6" > <Checkbox - label="Include Bots in Aggregates" - checked={form.watch("include_bots_in_aggregates") ?? true} + checked={form.watch("include_bots_in_aggregates") ?? false} onChange={(checked) => { form.setValue("include_bots_in_aggregates", checked, { shouldDirty: true, shouldTouch: true, shouldValidate: true, }); }} /> </InputContainer>
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
front_end/src/app/(main)/questions/components/question_form.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
front_end/src/app/(main)/questions/components/question_form.tsx (1)
front_end/src/components/ui/input_container.tsx (1)
InputContainer(13-67)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Docker Image / Build Docker Image
- GitHub Check: integration-tests
🔇 Additional comments (1)
front_end/src/app/(main)/questions/components/question_form.tsx (1)
22-22: LGTM!Import is correctly added for the new Checkbox component.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
front_end/src/app/(main)/questions/components/question_form.tsx
Outdated
Show resolved
Hide resolved
front_end/src/app/(main)/questions/components/question_form.tsx
Outdated
Show resolved
Hide resolved
front_end/src/app/(main)/questions/components/question_form.tsx
Outdated
Show resolved
Hide resolved
🧹 Preview Environment Cleaned UpThe preview environment for this PR has been destroyed.
Cleanup triggered by PR close at 2026-02-05T16:52:09Z |
ncarazon
left a comment
There was a problem hiding this comment.
fix interface typing suggested by coderabbit, otherwise lgtm
CodexVeritas
left a comment
There was a problem hiding this comment.
This looks good to me. Just handle the coderabbit comment. The "include_bots_in_aggregates" should still default to false, at least until this PR resolves.
…ue-4210-20260201-0420
…efault value to false
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@front_end/src/app/`(main)/questions/components/question_form.tsx:
- Around line 958-975: The InputContainer and Checkbox currently both render the
same label causing duplicate text; remove the label from one side—prefer keeping
the label on Checkbox and use InputContainer only for layout/explanation.
Concretely, in the JSX around InputContainer and Checkbox (components
InputContainer and Checkbox) remove or clear the InputContainer prop labelText
and retain Checkbox's label prop (keep explanation, isNativeFormControl,
className on InputContainer), ensuring the form.watch/setValue logic and
Checkbox checked/onChange remain unchanged.
Adds a checkbox for
include_bots_in_aggregatesto the Advanced Options section in question creation.Closes #4210
Changes
Generated with Claude Code
Summary by CodeRabbit
New Features
Localization