Covers: create, blank content validation, guest restriction, read, owner edit, non-owner edit forbidden, owner delete, non-owner delete forbidden, reply creation, comment_count aggregate, tweet owner deletes comment, third party forbidden, guest comment forbidden. Key learnings: - Tweet :destroy is not primary; use Ash.Changeset.for_destroy(:destroy) - relate_actor fails with Invalid (not Forbidden) when no actor - Ash.get returns NotFound error on miss; pass not_found_error?: false for nil Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.3 KiB
1.3 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
- Tweet creation, update, delete, comment tests (13 tests)
- Missing test coverage: auth flows
- No pagination on user list (
/users)
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)