-
-
Notifications
You must be signed in to change notification settings - Fork 40
Checklist attribution params are INERT: create_checklist_item(created_by) never persisted, archive_checklist_item(reported_by) never read #2679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ### Fixed | ||
| - Fixed checklist item attribution: added `created_by` column to `task_checklist_items` table and persisted it when creating checklist items | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,7 @@ | |
| verified INTEGER NOT NULL DEFAULT 0, | ||
| reported INTEGER NOT NULL DEFAULT 0, | ||
| archived INTEGER NOT NULL DEFAULT 0, | ||
| created_by TEXT NOT NULL, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Schema drift between fresh installs and migrated databases. The SCHEMA declares
Consider either (a) adding Reply with |
||
| created_at REAL NOT NULL, | ||
| updated_at REAL NOT NULL | ||
| ); | ||
|
|
@@ -198,6 +199,15 @@ async def _post_init(self) -> None: | |
| "ON project_tasks(project_id, element_id)" | ||
| ) | ||
| await self._db.commit() | ||
| # Add created_by column for checklist items (defect tsk-6xymzj) | ||
| try: | ||
| await self._db.execute( | ||
| "ALTER TABLE task_checklist_items ADD COLUMN created_by TEXT" | ||
| ) | ||
| await self._db.commit() | ||
| except Exception: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: At minimum, catch the specific SQLite duplicate-column error ( Reply with |
||
| # Column already exists on fresh installs (created by SCHEMA). | ||
| pass | ||
|
Comment on lines
+208
to
+210
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Do not hide checklist migration failures.
Proposed fix- try:
- await self._db.execute(
- "ALTER TABLE task_checklist_items ADD COLUMN created_by TEXT"
- )
- await self._db.commit()
- except Exception:
- pass
+ async with self._db.execute(
+ "PRAGMA table_info(task_checklist_items)"
+ ) as cur:
+ columns = {row[1] for row in await cur.fetchall()}
+ if "created_by" not in columns:
+ await self._db.execute(
+ "ALTER TABLE task_checklist_items ADD COLUMN created_by TEXT"
+ )
+ await self._db.commit()🧰 Tools🪛 Ruff (0.16.2)[error] 208-210: (S110) [warning] 208-208: Do not catch blind exception: (BLE001) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| async def create_task( | ||
| self, | ||
|
|
@@ -746,9 +756,9 @@ async def create_checklist_item( | |
| now = time.time() | ||
| await self._db.execute( | ||
| """INSERT INTO task_checklist_items | ||
| (id, task_id, text, done, verified, reported, archived, created_at, updated_at) | ||
| VALUES (?, ?, ?, 0, 0, 0, 0, ?, ?)""", | ||
| (cid, task_id, text, now, now), | ||
| (id, task_id, text, done, verified, reported, archived, created_by, created_at, updated_at) | ||
| VALUES (?, ?, ?, 0, 0, 0, 0, ?, ?, ?)""", | ||
| (cid, task_id, text, created_by, now, now), | ||
| ) | ||
| await self._db.commit() | ||
| cur = await self._db.execute( | ||
|
|
@@ -810,7 +820,7 @@ async def update_checklist_item( | |
| await self._db.commit() | ||
| return await self.get_checklist_item(item_id) | ||
|
|
||
| async def archive_checklist_item(self, item_id: str, reported_by: str) -> dict: | ||
| async def archive_checklist_item(self, item_id: str) -> dict: | ||
| """Archive a checklist item. Only valid if verified=1 and reported=1. | ||
|
|
||
| Raises ValueError if the item cannot be archived because it lacks | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUGGESTION: The changelog describes the
created_byaddition but omits the breaking API change toarchive_checklist_item, whosereported_byparameter was removed. Downstream consumers of the public store API (or any external integrations callingProjectTaskStore.archive_checklist_item) will get aTypeErrorafter upgrade. Either:### Changed/### Removed, orreported_byas an optional, ignored parameter with a deprecation comment so callers don't break on upgrade.Also, the fragment is missing a trailing newline (
\ No newline at end of file), which trips POSIX text-file tooling.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.