Skip to content

[TASK-992a051e] fix: allow nullable assigned/reviewer agents in tasks table - #12

Closed
jsyqrt wants to merge 2 commits into
feat/i18n-full-versionfrom
task/tsk_992a051eafd0c9851d4bd7c6
Closed

[TASK-992a051e] fix: allow nullable assigned/reviewer agents in tasks table#12
jsyqrt wants to merge 2 commits into
feat/i18n-full-versionfrom
task/tsk_992a051eafd0c9851d4bd7c6

Conversation

@jsyqrt

@jsyqrt jsyqrt commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Fix SQLite test data isolation

Problem

SQLite tests failed with FOREIGN KEY constraint failed. Root cause: tasks.assigned_agent_id column has NOT NULL + FK constraint, but tasks were created without providing this field.

Changes

1. Schema (sqlite-storage.ts)

  • Remove NOT NULL from assigned_agent_id and reviewer_agent_id columns
  • Reason: pending tasks may not have an assignee yet

2. Repo (sqlite-storage.ts)

  • Use data.assignedAgentId ?? null instead of bare data.assignedAgentId
  • Use data.reviewerAgentId ?? null instead of bare data.reviewerAgentId

3. Tests (sqlite-storage.test.ts)

  • TaskRepo test: add agent setup (agent-1, agent-2)
  • TaskLogRepo test: add agent setup (a1)

Test results

Test Files  1 passed (1)
     Tests  12 passed (12)

Related

  • Replacement for tsk_59a5de812fe24145f67ece97 (system error rejected, no actual rejection)

jsyqrt added 2 commits April 13, 2026 06:07
… table

Two changes to fix SQLite test data isolation:

1. Schema: Remove NOT NULL from assigned_agent_id and reviewer_agent_id
   columns. This reflects the reality that tasks can exist without being
   assigned yet (e.g., pending tasks awaiting approval).

2. Repo: Apply ?? null fallback for assignedAgentId/reviewerAgentId in
   SqliteTaskRepo.create(). This prevents undefined being passed to the
   INSERT statement when those fields are omitted.

3. Tests: Add missing agent setup in TaskRepo and TaskLogRepo tests.
   The assigned_agent_id FK requires the agent to exist first.
…in TaskRepo/TaskLogRepo tests

TaskRepo: remote HEAD already had agent-1+agent-2; fixed reviewer to use agent-1
TaskLogRepo: ensure agent creation includes roleId/roleName fields; remove invalid status field
All 12 SQLite storage tests pass (12/12)
@jsyqrt jsyqrt closed this Apr 14, 2026
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.

1 participant