fix(users): address PR review comments for account deletion
Critical fixes:
- Remove duplicate DeleteAccountHandler in tests, use actual production handler
- Add comprehensive integration test for complete deletion flow
- Tests now use middleware.SetTestUserDID() instead of X-User-DID header
Error handling improvements:
- Add InvalidDIDError domain type for DID validation errors
- Handler returns specific errors for timeout (504) and cancellation (400)
- Marshal JSON before writing headers to catch encoding errors early
- Include DID in all repository error messages for debugging
Logging improvements:
- Replace log.Printf with slog.Error/Warn for structured logging
- Consistent slog usage across handler, service, and repository layers
Documentation improvements:
- Update interface comments to list all 8 tables including votes
- Fix CASCADE statement: "FK CASCADE deletes posts" (not votes)
- Add authorization context to DeleteAccount service documentation
Test additions:
- DID with leading/trailing whitespace handling
- Concurrent delete requests (race condition scenario)
- Integration test verifying all 8 tables are cleaned up
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>