Unbounded Array in Document (TaskFlow PR #7)
Tier 2 hard typescript · local · real merged PR from mikecann/cya-playground #18
Ground-truth defects
`checklist` is stored as a growing `v.array(...)` on the task document, so its size is bounded by Convex's 1 MB per-document limit rather than by anything in the code: once a task accumulates enough items the patch in `addItem` fails and the task can no longer be written. Every toggle also rewrites the whole array, so write cost grows with the item count, and individual items cannot be indexed or queried. The fix is a separate `checklistItems` table keyed by `taskId`. Stated as the document-size limit rather than as a design preference, because that is the hard ceiling that makes writes fail and is what expectations.md records as the pass condition ("risks hitting the 1MB document size limit").
`toggleItem` declares `index: v.number()`, which accepts any float and NaN, and guards with `if (args.index < 0 || args.index >= checklist.length)`. Both comparisons are false for NaN, and 0.5 sits inside the range, so the guard passes, `checklist[args.index]` is `undefined`, and reading `.completed` off it throws an unhandled TypeError. Reachable from the public mutation API, which is what the validator exists to constrain.
The new checklist mutations write no `activityLog` entry, while every other task-mutating operation does: `create`, `update` and `remove` in convex/tasks.ts each call `ctx.runMutation(internal.activity.log, ...)`. A task's checklist can therefore be changed with no record, leaving the activity history incomplete for that class of edit.
`addItem` takes `text: v.string()` and pushes it unchanged, so a blank or whitespace-only item is stored. The only guard is client-side, `if (!newChecklistItem.trim()) return` in TaskDetail.tsx, and a Convex mutation is a public API reachable without that component.
The change under review
diff
new file mode 100644 @@ -0,0 +1,68 @@ +import { mutation } from "./_generated/server"; +import { v } from "convex/values"; +import { getAuthUserId } from "@convex-dev/auth/server"; + +export const addItem = mutation({ + args: { + taskId: v.id("tasks"), + text: v.string(), + }, + handler: async (ctx, args) => { + const userId = await getAuthUserId(ctx); + if (!userId) throw new Error("Not authenticated"); + + const task = await ctx.db.get("tasks", args.taskId); + if (!task) throw new Error("Task not found"); + + const membership = await ctx.db + .query("projectMembers") + .withIndex("by_projectId_and_userId", (q) => + q.eq("projectId", task.projectId).eq("userId", userId), + ) + .unique(); + if (!membership) throw new Error("Not a member of this project"); + if (membership.role === "viewer") { + throw new Error("Viewers cannot edit tasks"); + } + + const checklist = task.checklist ?? []; + checklist.push({ text: args.text, completed: false }); + await ctx.db.patch("tasks", args.taskId, { checklist }); + }, +}); + +export const toggleItem = mutation({ + args: { + taskId: v.id("tasks"), + index: v.number(), + }, + handler: async (ctx, args) => { + const userId = await getAuthUserId(ctx); + if (!userId) throw new Error("Not authenticated"); + + const task = await ctx.db.get("tasks", args.taskId); + if (!task) throw new Error("Task not found"); + + const membership = await ctx.db + .query("projectMembers") + .withIndex("by_projectId_and_userId", (q) => + q.eq("projectId", task.projectId).eq("userId", userId), + ) + .unique(); + if (!membership) throw new Error("Not a member of this project"); + if (membership.role === "viewer") { + throw new Error("Viewers cannot edit tasks"); + } + + const checklist = task.checklist ?? []; + if (args.index < 0 || args.index >= checklist.length) { + throw new Error("Invalid checklist index"); + } + + checklist[args.index] = { + ...checklist[args.index], + completed: !checklist[args.index].completed, + }; + await ctx.db.patch("tasks", args.taskId, { checklist }); + }, +}); @@ -51,6 +51,9 @@ export default defineSchema({ projectId: v.id("projects"), assigneeId: v.optional(v.id("users")), dueDate: v.optional(v.number()), + checklist: v.optional( + v.array(v.object({ text: v.string(), completed: v.boolean() })), + ), }) .index("by_projectId", ["projectId"]) .index("by_assigneeId", ["assigneeId"]) @@ -33,12 +33,15 @@ export function TaskDetail({ const addComment = useMutation(api.comments.create); const deleteComment = useMutation(api.comments.remove); const deleteTask = useMutation(api.tasks.remove); + const addChecklistItem = useMutation(api.checklist.addItem); + const toggleChecklistItem = useMutation(api.checklist.toggleItem); const { addToast } = useToast(); const [commentText, setCommentText] = useState(""); const [isEditing, setIsEditing] = useState(false); const [editTitle, setEditTitle] = useState(""); const [editDescription, setEditDescription] = useState(""); + const [newChecklistItem, setNewChecklistItem] = useState(""); if (!task) { return null; @@ -204,6 +207,65 @@ export function TaskDetail({ </div> </div> + <div className="border-t border-slate-200 dark:border-slate-700 pt-4 mb-4"> + <h3 className="font-semibold mb-3"> + Checklist + {task.checklist && task.checklist.length > 0 && ( + <span className="text-sm font-normal text-slate-400 ml-2"> + {task.checklist.filter((i) => i.completed).length}/ + {task.checklist.length} + </span> + )} + </h3> + <div className="space-y-1 mb-3"> + {(task.checklist ?? []).map((item, idx) => ( + <label + key={idx} + className="flex items-center gap-2 py-1 px-2 rounded hover:bg-slate-50 dark:hover:bg-slate-700/50 cursor-pointer" + > + <input + type="checkbox" + checked={item.completed} + onChange={() => { + toggleChecklistItem({ taskId, index: idx }).catch( + (err: Error) => addToast(err.message), + ); + }} + className="rounded border-slate-300 dark:border-slate-600" + /> + <span + className={`text-sm ${item.completed ? "line-through text-slate-400" : ""}`} + > + {item.text} + </span> + </label> + ))} + </div> + <form + onSubmit={(e) => { + e.preventDefault(); + if (!newChecklistItem.trim()) return; + addChecklistItem({ taskId, text: newChecklistItem }) + .then(() => setNewChecklistItem("")) + .catch((err: Error) => addToast(err.message)); + }} + className="flex gap-2" + > + <input + value={newChecklistItem} + onChange={(e) => setNewChecklistItem(e.target.value)} + placeholder="Add checklist item..." + className="flex-1 px-3 py-1.5 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 text-slate-900 dark:text-slate-100 placeholder:text-slate-400 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500" + /> + <button + type="submit" + className="px-3 py-1.5 rounded-md bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium transition-colors" + > + Add + </button> + </form> + </div> + <div className="border-t border-slate-200 dark:border-slate-700 pt-4"> <h3 className="font-semibold mb-3"> Comments ({comments?.length ?? 0}
Leaderboard for this case
hard · 1 of 9 bots fully caught it (11% solve rate) · 50% avg coverage.
| # | Bot | Result | Caught | Coverage | Findings | False alarms |
|---|---|---|---|---|---|---|
| 1 | Drape (Deep Review) | solved | 4/4 | 100.0% | 5 | 0 |
| 2 | Claude Code (Opus 5.5) | partial | 3/4 | 83.3% | 3 | 0 |
| 3 | greptile | partial | 3/4 | 83.3% | 4 | 0 |
| 4 | qodo | partial | 2/4 | 66.7% | 3 | 0 |
| 5 | Mjolnir (Sonnet 5.5) | partial | 2/4 | 50.0% | 2 | 0 |
| 6 | Cubic | partial | 1/4 | 33.3% | 2 | 0 |
| 7 | Drape (Review) | partial | 2/4 | 33.3% | 3 | 0 |
| 8 | Mjolnir (Opus 5.5) | partial | 1/4 | 33.3% | 2 | 0 |
| 9 | cursor | miss | 0/4 | 0.0% | 1 | 0 |
Bot results
Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | exact |
| d2 | medium | ✓ | off by one |
| d3 | low | ✗ | — |
| d4 | low | ✓ | exact |
raw comments (3)
addItem places no limit on the number of checklist items or on the length of `text`, and the whole checklist is stored inside the task document. Any editor can keep appending items, or send very long strings, until the task passes Convex's limits (8192 array elements, 1 MiB per document). After that, every patch to the task fails, including normal title and status updates through tasks.update. Each append also rewrites the entire array, and every subscriber to the task query receives the full array again. Cap the item count and text length, or store checklist items in their own table.
The `index` argument is `v.number()` and is never checked to be an integer. A value like 0.5 passes the bounds check, then `checklist[0.5].completed` throws a TypeError, so the caller gets a confusing internal error instead of 'Invalid checklist index'. Add a `Number.isInteger(args.index)` check.
The server never checks for empty or whitespace-only text; only the client form trims the input. Calling the mutation directly can store blank checklist items. Trim the text and reject empty values on the server.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✗ | — |
| d2 | medium | ✓ | exact |
| d3 | low | ✗ | — |
| d4 | low | ✗ | — |
The new checklist input, Add button and checkboxes render for everyone with no role check. Both new mutations throw "Viewers cannot edit tasks", so a viewer who uses them only gets an error toast. The existing Edit/Delete controls already behave the same way, which makes this a small UX issue rather than a correctness bug. [grounded: diff] [consensus 5/5: valid=5]
raw comments (3)
<!-- cubic:v=773b1fad-f421-47cc-b360-26fe525603ce -->
<!-- cubic:review-run=867469f5-fee6-56ab-b940-be92635ae516 -->
<!-- metadata:{"confidence":9} -->
P2: When a viewer opens a task, this checklist editor is still rendered even though both checklist mutations reject viewers. Hide or disable the new checklist editing controls for `viewer` members instead of making every interaction fail with a toast.
<details>
<summary>Prompt for AI agents</summary>
```text
Check if this issue is valid — if so, understand the root cause and fix it. At src/components/TaskDetail.tsx, line 244:
<comment>When a viewer opens a task, this checklist editor is still rendered even though both checklist mutations reject viewers. Hide or disable the new checklist editing controls for `viewer` members instead of making every interaction fail with a toast.</comment>
<file context>
@@ -204,6 +207,65 @@ export function TaskDetail({
+ </label>
+ ))}
+ </div>
+ <form
+ onSubmit={(e) => {
+ e.preventDefault();
</file context>
```
</details>
<!-- cubic:v=5803ebfe-ee7f-4ff6-a5f9-ddeec157e52c -->
<!-- cubic:review-run=867469f5-fee6-56ab-b940-be92635ae516 -->
<!-- metadata:{"confidence":10} -->
P2: When an authenticated caller passes a fractional index, the bounds check passes and `toggleItem` throws while reading `.completed`. Require `Number.isInteger(args.index)` before indexing.
<details>
<summary>Prompt for AI agents</summary>
```text
Check if this issue is valid — if so, understand the root cause and fix it. At convex/checklist.ts, line 58:
<comment>When an authenticated caller passes a fractional index, the bounds check passes and `toggleItem` throws while reading `.completed`. Require `Number.isInteger(args.index)` before indexing.</comment>
<file context>
@@ -0,0 +1,68 @@
+ }
+
+ const checklist = task.checklist ?? [];
+ if (args.index < 0 || args.index >= checklist.length) {
+ throw new Error("Invalid checklist index");
+ }
</file context>
```
</details>
```suggestion
if (
!Number.isInteger(args.index) ||
args.index < 0 ||
args.index >= checklist.length
) {
```
<!-- cubic:review-summary:start -->
**2 issues found** across 3 files
<!-- cubic:review-summary:end -->
<details>
<summary>Prompt for AI agents (unresolved issues)</summary>
```text
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/components/TaskDetail.tsx">
<violation number="1" location="src/components/TaskDetail.tsx:244">
P2: When a viewer opens a task, this checklist editor is still rendered even though both checklist mutations reject viewers. Hide or disable the new checklist editing controls for `viewer` members instead of making every interaction fail with a toast.</violation>
</file>
<file name="convex/checklist.ts">
<violation number="1" location="convex/checklist.ts:58">
P2: When an authenticated caller passes a fractional index, the bounds check passes and `toggleItem` throws while reading `.completed`. Require `Number.isInteger(args.index)` before indexing.</violation>
</file>
```
</details>
<sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/85/ai_pr_review_github_delivery_0138d41ca29ae6675322397ba69159dd7e1c3bfbd8e8702e92261ecf9bde8c2f?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F85)</sub>
<!-- cubic:review-post:ai_pr_review_github_delivery_0138d41ca29ae6675322397ba69159dd7e1c3bfbd8e8702e92261ecf9bde8c2f:e9fb57e79c96873caafb8caa32f4550e334fc5f7:867469f5-fee6-56ab-b940-be92635ae516 -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✗ | — |
| d2 | medium | ✗ | — |
| d3 | low | ✗ | — |
| d4 | low | ✗ | — |
toggleItem flips whatever value is stored instead of setting the value the user meant. The checkbox is controlled and keeps showing the old server value until the mutation lands. So two quick clicks, or two members who both mean to check the item, run two serialized flips, and the item ends up unchecked again. That is real, though low-to-medium in impact. [grounded: diff] [consensus 5/5: valid=5]
raw comments (2)
### Checklist toggle races revert completion
**Medium Severity**
<!-- DESCRIPTION START -->
`toggleItem` writes the opposite of whatever `completed` it just read, so overlapping calls for the same index undo each other after Convex OCC retry. The checkbox is controlled with no pending state, so a second click (or two members checking the same item) commonly leaves it unchecked after the user tried to check it.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: 46e0ea49-b5f1-4d0b-b38a-540923efe7ee -->
<!-- LOCATIONS START
convex/checklist.ts#L61-L65
src/components/TaskDetail.tsx#L228-L233
LOCATIONS END -->
<details>
<summary>Additional Locations (1)</summary>
- [`src/components/TaskDetail.tsx#L228-L233`](https://github.com/drape-io/crbench-cursor-2026-09/blob/e66a8144102506067cffd2cbaefb15a128f04171/src/components/TaskDetail.tsx#L228-L233)
</details>
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjUyNWI3OWVlLWY4ZWYtNDY2Mi04YzU2LWQzMDdhODI0ZWNmYiIsImVuY3J5cHRpb25LZXkiOiJMNENGTl9JckpSZ3BYSmlRQWN1U3BBUy16aXBYUVlkZmt3WVNXWDJWbEMwIiwiYnJhbmNoIjoidDItdGFza2Zsb3ctMDctdW5ib3VuZGVkLWFycmF5IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjUyNWI3OWVlLWY4ZWYtNDY2Mi04YzU2LWQzMDdhODI0ZWNmYiIsImVuY3J5cHRpb25LZXkiOiJMNENGTl9JckpSZ3BYSmlRQWN1U3BBUy16aXBYUVlkZmt3WVNXWDJWbEMwIiwiYnJhbmNoIjoidDItdGFza2Zsb3ctMDctdW5ib3VuZGVkLWFycmF5IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwck51bWJlciI6ODcsImNvbW1pdFNoYSI6ImU2NmE4MTQ0MTAyNTA2MDY3Y2ZmZDJjYmFlZmIxNWExMjhmMDQxNzEiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e66a8144102506067cffd2cbaefb15a128f04171. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_REVIEW -->
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
<!-- BUGBOT_FIX_ALL -->
<a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo0Y2E4MDhjNi02OTMyLTQ3NDctYTI4OC1jMjM5YjdiYWZjZTciLCJlbmNyeXB0aW9uS2V5IjoicXBIZ1hpc0owakxHdHdKRmdLempyMEpUTDV6ZnBsZ1lMMXZOSVNpZ0RCZyIsImJyYW5jaCI6InQyLXRhc2tmbG93LTA3LXVuYm91bmRlZC1hcnJheSIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
<!-- /BUGBOT_FIX_ALL -->
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN -->
<sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END -->
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e66a8144102506067cffd2cbaefb15a128f04171. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
| d2 | medium | ✓ | off by one |
| d3 | low | ✓ | exact |
| d4 | low | ✓ | exact |
The new toggleItem mutation flips the stored value instead of setting a value the client sends. Without optimistic updates, a second click before the query refreshes, or two members ticking the same item at once, flips the item back. That is real but low-impact UX behaviour. [grounded: tree convex/checklist.ts] [consensus 3/3: valid=3]
raw comments (5)
**Concurrent or repeated clicks undo checklist toggles**
`toggleItem` flips whatever is stored, not the state the user saw. A double click, or two members ticking the same item, cancels out and leaves it unchecked. Have the client send the wanted `completed` value (`!item.completed`) and store that, rather than flipping on the server.
```
convex/checklist.ts:35 args: {
convex/checklist.ts:36 taskId: v.id("tasks"),
convex/checklist.ts:37 index: v.number(),
convex/checklist.ts:38 },
convex/checklist.ts:62 checklist[args.index] = {
convex/checklist.ts:63 ...checklist[args.index],
convex/checklist.ts:64 completed: !checklist[args.index].completed,
convex/checklist.ts:65 };
```
**Fractional or NaN index fails with a TypeError**
`index` is `v.number()`, so 0.5 or NaN passes the range check. Reading `.completed` on the missing element then throws a TypeError instead of "Invalid checklist index". Also reject with "Invalid checklist index" when `!Number.isInteger(args.index)`.
```
convex/checklist.ts:38 },
convex/checklist.ts:58 if (args.index < 0 || args.index >= checklist.length) {
convex/checklist.ts:59 throw new Error("Invalid checklist index");
convex/checklist.ts:60 }
convex/checklist.ts:62 checklist[args.index] = {
convex/checklist.ts:63 ...checklist[args.index],
convex/checklist.ts:64 completed: !checklist[args.index].completed,
convex/checklist.ts:65 };
```
**Checklist edits missing from activity log**
Every other task mutation records an entry through `internal.activity.log`, but `addItem` and `toggleItem` do not, so checklist edits never show up in project activity. Log an activity entry (for example `updated_task`) after each patch.
```
convex/checklist.ts:28 const checklist = task.checklist ?? [];
convex/checklist.ts:29 checklist.push({ text: args.text, completed: false });
convex/checklist.ts:30 await ctx.db.patch("tasks", args.taskId, { checklist });
convex/checklist.ts:31 },
convex/tasks.ts:172 await ctx.db.patch("tasks", args.taskId, updates);
convex/tasks.ts:174 await ctx.runMutation(internal.activity.log, {
convex/tasks.ts:175 action: "updated_task",
convex/tasks.ts:176 userId,
convex/tasks.ts:177 projectId: task.projectId,
convex/tasks.ts:178 entityType: "task",
```
**Empty checklist items accepted by server**
Only the form trims and checks for empty input. `addItem` stores `args.text` as-is, so a direct call can add blank or whitespace-only items, and items keep their leading and trailing spaces. Trim `args.text` in `addItem` and throw if the result is empty.
```
convex/checklist.ts:28 const checklist = task.checklist ?? [];
convex/checklist.ts:29 checklist.push({ text: args.text, completed: false });
convex/checklist.ts:30 await ctx.db.patch("tasks", args.taskId, { checklist });
src/components/TaskDetail.tsx:244 <form
src/components/TaskDetail.tsx:246 e.preventDefault();
```
**Checklist can grow without limit on a task**
`addItem` appends any text with no cap on item count or length, inside the task document. Repeated calls can push the task past Convex's size limits, after which checklist writes fail. Cap item count and text length on the server.
```
convex/checklist.ts:28 const checklist = task.checklist ?? [];
convex/checklist.ts:29 checklist.push({ text: args.text, completed: false });
convex/checklist.ts:30 await ctx.db.patch("tasks", args.taskId, { checklist });
convex/checklist.ts:7 taskId: v.id("tasks"),
convex/checklist.ts:8 text: v.string(),
convex/checklist.ts:9 },
convex/tasks.ts:23 const tasks = await ctx.db
convex/tasks.ts:24 .query("tasks")
convex/tasks.ts:25 .withIndex("by_projectId", (q) => q.eq("projectId", args.projectId))
convex/tasks.ts:26 .take(200);
```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✗ | — |
| d2 | medium | ✗ | — |
| d3 | low | ✓ | exact |
| d4 | low | ✓ | exact |
toggleItem gets only the index and flips whatever value is stored on the server. If two members check the same item from the same stale view, the second mutation unchecks it, even though Convex runs mutations in order. The controlled checkbox doesn't update until the server responds, so a quick second click also sends another toggle that undoes the first. Sending the desired value would avoid this. [grounded: tree convex/checklist.ts] [consensus 3/3: valid=3]
raw comments (3)
**Checklist edits skip the activity log**
`addItem` and `toggleItem` change a task but never call `internal.activity.log`. `tasks.update`, which does the same kind of edit, logs `updated_task`. Call `ctx.runMutation(internal.activity.log, ...)` with action `updated_task` after each patch.
```
convex/checklist.ts:26 }
convex/checklist.ts:28 const checklist = task.checklist ?? [];
convex/checklist.ts:62 checklist[args.index] = {
convex/checklist.ts:63 ...checklist[args.index],
```
**Checklist text not validated server-side**
addItem accepts any string, including empty or whitespace-only text, and has no limit on text length or item count. Only the UI trims the input, and it sends the untrimmed value. Trim the text, reject empty values, and cap text length and item count in the mutation.
```
convex/checklist.ts:6 args: {
convex/checklist.ts:7 taskId: v.id("tasks"),
convex/checklist.ts:8 text: v.string(),
convex/checklist.ts:9 },
```
**Concurrent checks undo each other**
toggleItem inverts the stored completed value and the client sends only the index. If two members check the same item from the same stale view, or one user clicks twice quickly, the second call unchecks it. Pass the desired completed value from the checkbox and set it instead of inverting.
```
convex/checklist.ts:36 taskId: v.id("tasks"),
convex/checklist.ts:37 index: v.number(),
convex/checklist.ts:38 },
convex/checklist.ts:39 handler: async (ctx, args) => {
```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
| d2 | medium | ✓ | exact |
| d3 | low | ✗ | — |
| d4 | low | ✓ | off by one |
The new checklist checkbox and add form have no role gating, while both new mutations throw "Viewers cannot edit tasks". A viewer can click them and only gets an error toast. This is a real but low-impact UX problem. The existing Edit, Delete and priority controls in the same component are also ungated, so the new code follows the existing pattern. [grounded: diff] [consensus 3/3: valid=3]
raw comments (5)
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Checklist grows without bound**
Each addition appends to an array embedded in the task and rewrites the full array. There is no item limit, removal, or pagination, and project queries return the embedded checklists for up to 200 tasks. If the deployed Convex document-size limit is reached, checklist additions, toggles, and other task updates will fail. Store these entries in a bounded or separately queryable collection.
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> **Invalid numeric indexes pass**
The range check does not reject fractional or non-finite numbers. A direct API call with an index such as `0.5` passes this check, then accesses a missing array property and raises an internal exception instead of the intended validation error. Require a finite integer before indexing the checklist.
```suggestion
if (
!Number.isInteger(args.index) ||
args.index < 0 ||
args.index >= checklist.length
) {
throw new Error("Invalid checklist index");
}
```
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> **Viewers see editing controls**
The checklist checkboxes and add form are enabled for viewers even though both server mutations reject that role. A viewer can therefore try to edit the checklist only to receive an error toast. Pass the current permission into this component and render the checklist as read-only for viewers. The same issue also affects the add controls at lines 244–266.
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> **Untrimmed text is stored**
The form checks the trimmed draft for emptiness but sends the original value, which the server stores unchanged. Normal input such as `" Review copy "` therefore keeps unintended surrounding whitespace. Send the trimmed value used by the guard.
```suggestion
const text = newChecklistItem.trim();
if (!text) return;
addChecklistItem({ taskId, text })
```
<h3>Greptile Summary</h3>
This PR adds task checklists as an optional embedded task field, introduces authenticated add and toggle mutations, and renders checklist progress and controls in the task-detail modal.
- Enforces project membership and rejects viewer mutations on the server.
- Adds checklist creation, completion toggling, and progress display.
- The embedded checklist currently has no growth bound and is returned with normal task queries.
<h3>Confidence Score: 4/5</h3>
The PR should not merge until checklist storage is bounded or moved out of the task document, because normal repeated additions eventually prevent task writes.
The inline checklist grows monotonically and is rewritten and returned with each task, creating a deterministic document-limit failure; the remaining findings concern index validation, viewer-facing controls, and input normalization.
**Files Needing Attention:** convex/checklist.ts, convex/schema.ts, src/components/TaskDetail.tsx
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| convex/checklist.ts | Adds authorized checklist mutations, but permits unbounded document growth and does not validate that toggle indexes are integers. |
| convex/schema.ts | Adds checklist entries as an optional array embedded directly in task documents. |
| src/components/TaskDetail.tsx | Adds checklist progress and editing UI, with viewer affordance and input-normalization concerns. |
</details>
<details open><summary><h3>Flowchart</h3></summary>
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart LR
UI[TaskDetail checklist UI] --> Add[checklist.addItem]
UI --> Toggle[checklist.toggleItem]
Add --> Auth[Authenticate and verify project role]
Toggle --> Auth
Auth -->|Editor or admin| Task[(Task document)]
Auth -->|Viewer| Reject[Reject mutation]
Add -->|Append and rewrite array| Task
Toggle -->|Rewrite array item| Task
Task --> List[listByProject returns embedded checklist]
Task --> Detail[tasks.get returns embedded checklist]
```
</details>
<!-- greptile_other_comments_section -->
<sub>Reviews (1): Last reviewed commit: ["Update convex/checklist.ts and 2 more fi..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/085e261ebf4f7334cebba45d9f8a48212fc0c095) | [Re-trigger Greptile](https://app.greptile.com/api/retrigger?id=64284925)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | exact |
| d2 | medium | ✗ | — |
| d3 | low | ✗ | — |
| d4 | low | ✗ | — |
The new public addItem mutation adds to task.checklist with no limit on item count or text length. Convex caps arrays at 8192 values and documents at 1MB, so a non-viewer member can keep adding items until patches to the task fail. Nothing in the diff guards against this. [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
[P2] Checklist is stored as an unbounded array inside the task document
`addItem` appends to `task.checklist` with no limit on item count or `text` length, and the schema keeps the whole list inline on the `tasks` document (convex/schema.ts:54-56). Any project editor can keep adding items, or add a few very long strings, until the array passes Convex's 8192-element limit ([.cursor/rules/convex_rules.mdc:83](.cursor/rules/convex_rules.mdc)) or the document passes 1MB. Once that happens, every later `ctx.db.patch` on the task fails, including the existing task edit and status mutations, not just checklist writes. Before that point, `tasks.listByProject` already spreads `...task` for up to 200 tasks, so each project-list subscription downloads every checklist, and each toggle re-runs that list query for everyone viewing the project. Moving items into their own `checklistItems` table indexed by `taskId` would remove the size risk. The smaller fix is to cap the item count and text length in `addItem`.
[P2] Checklist kept as an unbounded array on the task document, with no item cap or text length limit.
(schema at convex/schema.ts:54-56) `addItem` adds to `task.checklist` every time it runs, with no limit on how many items there are and no limit on `args.text` length. Any project member who isn't a viewer can call this public mutation directly and keep growing one task document. Convex arrays can hold at most 8192 values and documents are capped at 1MB ([convex_rules.mdc:81-83](.cursor/rules/convex_rules.mdc)). Once a task hits either limit, every write that patches the task fails, including ordinary task edits, so the task can no longer be edited. Before that point, the growing array also makes every reactive query that returns the task document larger, such as `tasks.listByProject`. The comments feature in this codebase already avoids this by using its own table with an index, and checklist items should do the same (a `checklistItems` table indexed by `taskId`). At minimum, enforce a maximum item count and a maximum text length on the server.
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | exact |
| d2 | medium | ✗ | — |
| d3 | low | ✗ | — |
| d4 | low | ✓ | off by one |
raw comments (2)
[P2] Unbounded checklist array embedded in task document
`addItem` pushes onto `task.checklist` with no cap on item count or `text` length, and the checklist is stored as an inline array on the `tasks` document (convex/schema.ts:54-56). Convex arrays are limited to 8192 values and documents to 1MB, which the project's Convex rules note at `.cursor/rules/convex_rules.mdc:83`. Any project member who is not a viewer can keep adding items. Once the limit is hit, the patch fails with an opaque Convex limit error. Before then, every add or toggle rewrites the whole array and every task read, including task lists, carries the entire checklist. Fix by capping the item count and text length in `addItem`, or by storing checklist items in a separate table indexed by `taskId`. Separately, `text` is never trimmed server-side. The UI checks `trim()` but then sends the untrimmed string, and a direct API call can add empty items.
[P2] Checklist array grows without a limit
`addItem` reads the whole `checklist` array, pushes one item, and writes it back. It has no cap on item count and no cap on `text` length. The checklist is stored inline on the `tasks` document, so the document grows with every add. Convex arrays are limited to 8192 values and documents to 1MB ([convex_rules.mdc:83](.cursor/rules/convex_rules.mdc)). A member with edit access, or a script calling the public mutation, can add items until `ctx.db.patch` throws. Past that point the checklist can't be extended. Every query that reads the task also reads, and re-sends to subscribed clients, the full oversized document, and each add rewrites the entire array. The fix is to enforce a maximum item count and text length in `addItem`, or to move checklist items into their own table indexed by `taskId`, as `comments` is.
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
| d2 | medium | ✓ | exact |
| d3 | low | ✗ | — |
| d4 | low | ✗ | — |
The checked-in convex/_generated/api.d.ts is not gitignored. It imports and maps only activity, auth, comments, http, labels, members, projects, tasks and users, with no checklist module. Because the build script runs `tsc -b` before `vite build`, `api.checklist` is a type error until codegen is rerun and the result committed. [grounded: diff] [consensus 3/3: valid=3]
raw comments (5)
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
1\. Clean builds fail on checklist calls <code>🐞 Bug</code> <code>≡ Correctness</code>
<pre>
<b><i>TaskDetail</i></b> references <b><i>api.checklist</i></b>, but the checked-in generated API declaration does not
include the new checklist module. A clean checkout runs TypeScript directly without regenerating
those declarations, so both production builds and linting fail on the new mutation references.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
The frontend references the new checklist module, but the checked-in generated API declarations do not expose it, causing clean TypeScript builds to fail.
## Fix Focus Areas
- convex/_generated/api.d.ts[11-37]
- src/components/TaskDetail.tsx[36-37]
## Recommended Fix
Run the repository's Convex code-generation command and commit the resulting generated declarations so `api.checklist.addItem` and `api.checklist.toggleItem` are present before `tsc` runs.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
2\. Large checklists break task updates <code>🐞 Bug</code> <code>☼ Reliability</code>
<pre>
<b><i>addItem</i></b> accepts unrestricted text and appends indefinitely to an array embedded directly in each
task document. As item count or text size grows, every project listing transfers the entire
checklist and additions eventually exceed the database array or document limit, preventing further
task patches.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
Checklist items are stored in an embedded array with no item-count or text-length limits, allowing task documents and project-list payloads to grow until database writes fail.
## Fix Focus Areas
- convex/checklist.ts[6-9]
- convex/checklist.ts[28-30]
- src/components/TaskDetail.tsx[247-258]
## Recommended Fix
Define application-level maximums for checklist item count and normalized text length, enforce both inside `addItem` before patching, and mirror the text limit with the input's `maxLength` attribute. Return a controlled validation error when either limit is exceeded.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended">
3\. Fractional indexes silently do nothing <code>🐞 Bug</code> <code>≡ Correctness</code>
<pre>
<b><i>toggleItem</i></b> checks only whether <b><i>index</i></b> is within the array bounds and never requires an integer. A
direct call with a value such as <b><i>0.5</i></b> passes for a nonempty checklist, writes a non-element array
property that is not persisted, and resolves successfully without toggling an item.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
The public toggle mutation accepts fractional numeric indexes that pass the bounds check but do not identify an actual array element.
## Fix Focus Areas
- convex/checklist.ts[34-37]
- convex/checklist.ts[57-65]
## Recommended Fix
Require `Number.isInteger(args.index)` before performing the existing bounds check, and throw the same invalid-index error when that condition fails.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<h3>PR Summary by Qodo</h3>
Add role-protected task checklists
<code>✨ Enhancement</code> <code>🕐 20-40 Minutes</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<details>
<summary>AI Description</summary>
<dl>
<dd>
<br/>
><pre>
>• Add task checklists with completion tracking in the task detail view.
>• Persist entries through authenticated, role-protected Convex mutations.
>• Preserve compatibility with existing tasks through an optional checklist field.
></pre>
</dd>
</dl>
</details>
<details>
<summary>Diagram</summary>
<dl>
<dd>
<br/>
```mermaid
sequenceDiagram
actor User
participant Detail as Task Detail
participant Checklist as Checklist API
participant Auth as Auth Service
participant DB as Convex DB
User->>Detail: Add or toggle
Detail->>Checklist: Submit mutation
Checklist->>Auth: Resolve user
Auth-->>Checklist: User identity
Checklist->>DB: Load task and membership
DB-->>Checklist: Task and role
Checklist->>DB: Patch checklist
Checklist-->>Detail: Mutation result
Detail-->>User: Render progress
```
</dd>
</dl>
</details>
<details>
<summary>High-Level Assessment</summary>
<dl>
<dd>
<br/>
>The following are alternative approaches to this PR:
<details>
<summary><b>1. Store checklist items in a separate table</b></summary>
<dl>
<dd>
- ➕ Avoids unbounded growth of task documents
- ➕ Provides stable item IDs instead of mutable array indexes
- ➕ Supports atomic per-item updates and future deletion or reordering
- ➖ Requires an additional query to render each checklist
- ➖ Adds indexes and task-deletion cleanup logic
- ➖ Introduces more schema and API surface
</dd>
</dl>
</details>
<details>
<summary><b>2. Enforce a bounded embedded checklist</b></summary>
<dl>
<dd>
- ➕ Retains the current simple read and rendering model
- ➕ Limits task document size and mutation cost
- ➕ Requires only validation and a documented item cap
- ➖ Imposes a product-visible checklist limit
- ➖ Still uses unstable array indexes for item identity
- ➖ Rewrites the complete checklist for every toggle
</dd>
</dl>
</details>
>**Recommendation:** Use a separate checklist-items table if checklists are intentionally unbounded or expected to grow substantially. It avoids document-size and concurrent index-update risks; otherwise, the embedded-array approach is reasonable only with an explicit size limit and preferably stable item IDs.
</dd>
</dl>
</details>
<details>
<summary> Files changed (3) <code> +133 / -0 </code> </summary>
<dl>
<dd>
<br/>
<details>
<summary>Enhancement (3) <code> +133 / -0 </code></summary>
<dl>
<dd>
<details>
<summary>checklist.ts<code>Add authorized checklist mutations</code> <code>+68/-0</code></summary>
<br/>
>Add authorized checklist mutations
>
><pre>
>• Introduces mutations for appending checklist entries and toggling completion by array index. Both operations require authentication, project membership, and a non-viewer role before patching the task.
></pre>
>
><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/85/files#diff-6aa27fe271a8aa97bcb865e376133d7ebf4d25e2809e93d3d4bbffec205d8f9c'>convex/checklist.ts</a>
</details>
<details>
<summary>schema.ts<code>Add embedded checklist data to tasks</code> <code>+3/-0</code></summary>
<br/>
>Add embedded checklist data to tasks
>
><pre>
>• Extends task documents with an optional array of checklist objects containing text and completion state. Making the field optional keeps existing task records valid.
></pre>
>
><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/85/files#diff-00e6e27e65e72a0fd4a73f6942f41e1cf3f476a59f263513f3f47fdf801a0eb1'>convex/schema.ts</a>
</details>
<details>
<summary>TaskDetail.tsx<code>Render and manage task checklists</code> <code>+62/-0</code></summary>
<br/>
>Render and manage task checklists
>
><pre>
>• Adds checklist progress, completion controls, and an item-entry form to the task detail panel. Mutation failures are surfaced through the existing toast mechanism.
></pre>
>
><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/85/files#diff-9b4a327bcb56296c61e2f7e83c0738a17c2ccee0f24d4a3d03d45b4f7d0d899c'>src/components/TaskDetail.tsx</a>
</details>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<h3>Code Review by Qodo</h3>
<code>🐞 Bugs (3)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. Clean builds fail on checklist calls <code>🐞 Bug</code> <code>≡ Correctness</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>TaskDetail</i></b> references <b><i>api.checklist</i></b>, but the checked-in generated API declaration does not
>include the new checklist module. A clean checkout runs TypeScript directly without regenerating
>those declarations, so both production builds and linting fail on the new mutation references.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[src/components/TaskDetail.tsx[R36-37]](https://github.com/drape-io/crbench-qodo-2026-09/pull/85/files#diff-9b4a327bcb56296c61e2f7e83c0738a17c2ccee0f24d4a3d03d45b4f7d0d899cR36-R37)</code>
>
>```diff
>+ const addChecklistItem = useMutation(api.checklist.addItem);
>+ const toggleChecklistItem = useMutation(api.checklist.toggleItem);
>```
></details>
> <details>
><summary>Evidence</summary>
><br/>
>
><pre>
>The added component lines access the checklist namespace, while the generated declaration's module
>imports and <b><i>fullApi</i></b> map omit that namespace. The repository's build and lint scripts invoke
>TypeScript without first invoking Convex code generation.
></pre>
>
> <code>[src/components/TaskDetail.tsx[30-37]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/src/components/TaskDetail.tsx/#L30-L37)</code>
> <code>[convex/_generated/api.d.ts[11-37]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/_generated/api.d.ts/#L11-L37)</code>
> <code>[package.json[6-13]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/package.json/#L6-L13)</code>
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>The frontend references the new checklist module, but the checked-in generated API declarations do not expose it, causing clean TypeScript builds to fail.
>
>## Fix Focus Areas
>- convex/_generated/api.d.ts[11-37]
>- src/components/TaskDetail.tsx[36-37]
>
>## Recommended Fix
>Run the repository's Convex code-generation command and commit the resulting generated declarations so `api.checklist.addItem` and `api.checklist.toggleItem` are present before `tsc` runs.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<details>
<summary> 2. Large checklists break task updates <code>🐞 Bug</code> <code>☼ Reliability</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>addItem</i></b> accepts unrestricted text and appends indefinitely to an array embedded directly in each
>task document. As item count or text size grows, every project listing transfers the entire
>checklist and additions eventually exceed the database array or document limit, preventing further
>task patches.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[convex/checklist.ts[R28-30]](https://github.com/drape-io/crbench-qodo-2026-09/pull/85/files#diff-6aa27fe271a8aa97bcb865e376133d7ebf4d25e2809e93d3d4bbffec205d8f9cR28-R30)</code>
>
>```diff
>+ const checklist = task.checklist ?? [];
>+ checklist.push({ text: args.text, completed: false });
>+ await ctx.db.patch("tasks", args.taskId, { checklist });
>```
></details>
> <details>
><summary>Evidence</summary>
><br/>
>
><pre>
>The mutation validates only the string type before unconditionally appending, and the schema places
>the unrestricted array inside the task document. Both individual task retrieval and the project
>query spread complete task documents into their responses, with the latter returning up to 200
>tasks.
></pre>
>
> <code>[convex/checklist.ts[6-9]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/checklist.ts/#L6-L9)</code>
> <code>[convex/checklist.ts[28-30]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/checklist.ts/#L28-L30)</code>
> <code>[convex/schema.ts[54-56]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/schema.ts/#L54-L56)</code>
> <code>[convex/tasks.ts[23-48]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/tasks.ts/#L23-L48)</code>
> <code>[convex/tasks.ts[80-85]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/tasks.ts/#L80-L85)</code>
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>Checklist items are stored in an embedded array with no item-count or text-length limits, allowing task documents and project-list payloads to grow until database writes fail.
>
>## Fix Focus Areas
>- convex/checklist.ts[6-9]
>- convex/checklist.ts[28-30]
>- src/components/TaskDetail.tsx[247-258]
>
>## Recommended Fix
>Define application-level maximums for checklist item count and normalized text length, enforce both inside `addItem` before patching, and mirror the text limit with the input's `maxLength` attribute. Return a controlled validation error when either limit is exceeded.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<br/>
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended">
<details>
<summary> 3. Fractional indexes silently do nothing <code>🐞 Bug</code> <code>≡ Correctness</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>toggleItem</i></b> checks only whether <b><i>index</i></b> is within the array bounds and never requires an integer. A
>direct call with a value such as <b><i>0.5</i></b> passes for a nonempty checklist, writes a non-element array
>property that is not persisted, and resolves successfully without toggling an item.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[convex/checklist.ts[R57-60]](https://github.com/drape-io/crbench-qodo-2026-09/pull/85/files#diff-6aa27fe271a8aa97bcb865e376133d7ebf4d25e2809e93d3d4bbffec205d8f9cR57-R60)</code>
>
>```diff
>+ const checklist = task.checklist ?? [];
>+ if (args.index < 0 || args.index >= checklist.length) {
>+ throw new Error("Invalid checklist index");
>+ }
>```
></details>
> <details>
><summary>Evidence</summary>
><br/>
>
><pre>
>The public argument validator accepts any number, while the only runtime validation compares it with
>zero and array length. The unchecked value is then used directly as the array property key, even
>though the UI happens to send integer map indexes.
></pre>
>
> <code>[convex/checklist.ts[34-37]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/checklist.ts/#L34-L37)</code>
> <code>[convex/checklist.ts[57-66]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/convex/checklist.ts/#L57-L66)</code>
> <code>[src/components/TaskDetail.tsx[221-230]](https://github.com/drape-io/crbench-qodo-2026-09/blob/b68f1f63e8fc14891fe6814ef007b0555a93e878/src/components/TaskDetail.tsx/#L221-L230)</code>
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>The public toggle mutation accepts fractional numeric indexes that pass the bounds check but do not identify an actual array element.
>
>## Fix Focus Areas
>- convex/checklist.ts[34-37]
>- convex/checklist.ts[57-65]
>
>## Recommended Fix
>Require `Number.isInteger(args.index)` before performing the existing bounds check, and throw the same invalid-index error when that condition fails.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-context:start -->
<details><summary><strong>Context sources</strong></summary>
<div>Review mode: <code>⚖️ Balanced</code>: This adds new authenticated mutations, schema data, and UI behavior across multiple files, including authorization and unbounded array updates, so it carries meaningful correctness and security risk.</div>
<!-- qodo-context:end -->
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:start -->
<details>
<summary><strong>Tip of the day</strong></summary>
<br/>
<pre>💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper</pre>
<a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:end -->
<!-- https://github.com/drape-io/crbench-qodo-2026-09/commit/b68f1f63e8fc14891fe6814ef007b0555a93e878 -->
<a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>