Self-follow check used get_attribute(:follower_id) which is nil at validation time because relate_actor runs after validations in Ash. Fixed to use context.actor.id directly. Added 9 tests covering: follow, follow idempotency, self-follow prevention, guest restriction, unfollow, unfollow noop, guest unfollow, follower/following counts, and am_i_following. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.2 KiB
1.2 KiB
Fix Plan
Completed
tweet_liketests:user_fixturemissingauthorize?: false,Ash.Query.filterneededrequire Ash.Query,Ash.ForbiddenField.forbidden?/1doesn't exist (usematch?),likenoop returned stale tweet struct → fixed all
In Progress / Next
unlikenoop returns stale tweet struct — same issue aslikenoop; reload from DBdecrement_likescan go below 0 — useGREATEST(likes - 1, 0)via SQL fragment
Backlog
- Self-follow validation used
get_attribute(:follower_id)which is nil at validation time (relate_actor runs after) — fixed to usecontext.actor.id - Follow/unfollow test coverage (9 tests)
- No pagination on user list (
/users) - No CHECK constraint on
likes >= 0at DB level (low priority, app logic prevents it) read :following_feed— nil actor returns empty list (not a bug)- No search for users or tweets
- Missing test coverage: comments, tweet creation, auth flows
Notes
- Stack: Elixir/Phoenix + Ash Framework + React/TypeScript
- Tests:
mix test— 10 tests, all should pass - Build:
mix precommitalias runs compile + test + format checks - No ClickHouse in test env (expected, non-fatal errors in test output)