Skip to content

chore(todo): fix owner lookup ref + completed-task seed validation#2008

Merged
os-zhuang merged 1 commit into
mainfrom
fix/todo-seed-and-owner-ref
Jun 17, 2026
Merged

chore(todo): fix owner lookup ref + completed-task seed validation#2008
os-zhuang merged 1 commit into
mainfrom
fix/todo-seed-and-owner-ref

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Two app-todo defects found driving it end-to-end (boot + seed + CRUD over HTTP).

1. owner lookup pointed at a non-existent object

todo_task.owner was Field.lookup('user', …). user is not a registered object — the platform user object is sys_user (better-auth managed). So at seed/owner-resolution time the driver queried a user table that doesn't exist, flooding the boot log with:

select `id` from `user` where `name` = 'admin' — no such table: user

Fix: repoint to Field.lookup('sys_user'), and drop the seed owner: 'admin' (there's no stable seed key for the auth-created bootstrap admin; leaving it unset is correct).

2. Completed seed tasks failed their own validation

Two seed tasks are status: 'completed' but had no completed_date — which the object's own completed_date_required validation rejects. They silently failed to insert, so only 6 of 8 rows seeded:

Insert failed: todo_task — Validation failed for 1 field(s): _record (rule_violation)

Fix: gave the completed seeds a completed_date.

Verification (live boot)

  • 0 no such table: user errors, 0 rule_violations.
  • todo_task now seeds all 8 rows (both completed tasks load).
  • Validation still enforced: POST a completed task with no completed_date400.
  • Aggregation/reports group-by-status returns correct counts (200).

Example-app only; no package impact.

🤖 Generated with Claude Code

Two app-todo defects found driving it end-to-end:

1. todo_task.owner was Field.lookup('user') — `user` is not a registered
   object/table (the platform user object is `sys_user`), so seed-time owner
   resolution flooded "no such table: user". Repointed to `sys_user` and
   dropped the unresolvable `owner: 'admin'` seed value (no stable seed key for
   the auth-created bootstrap admin).

2. The two `completed` seed tasks omitted `completed_date`, violating the
   object's own `completed_date_required` validation → they silently failed to
   seed (only 6 of 8 rows loaded). Gave them a completed_date.

Verified: 0 "no such table: user" errors, 0 rule_violations, all 8 rows seed;
validation still rejects a completed task with no completed_date (400);
aggregation/reports unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jun 17, 2026 5:47am

Request Review

@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling labels Jun 17, 2026
@os-zhuang
os-zhuang merged commit dcbca6c into main Jun 17, 2026
12 of 13 checks passed
@os-zhuang
os-zhuang deleted the fix/todo-seed-and-owner-ref branch June 17, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant