A community based topic aggregation platform built on atproto

fix: resolve all golangci-lint issues across codebase

- Apply gofumpt formatting with extra-rules across all packages
- Fix mock interface signatures to match updated Service/Repository interfaces
- Fix ineffassign bugs in community_repo.go (sortColumn/sortOrder)
- Fix unchecked error returns in production code (register.go)
- Fix unchecked error returns in test files (defer closures)
- Optimize struct field alignment per govet fieldalignment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+291 -388
cmd
server
internal
tests
+11 -12
cmd/server/main.go
···
package main
import (
-
"bytes"
-
"context"
-
"database/sql"
-
"encoding/json"
-
"fmt"
-
"io"
-
"log"
-
"net/http"
-
"os"
-
"strings"
-
"time"
-
"Coves/internal/api/middleware"
"Coves/internal/api/routes"
"Coves/internal/atproto/auth"
···
"Coves/internal/core/timeline"
"Coves/internal/core/unfurl"
"Coves/internal/core/users"
+
"bytes"
+
"context"
+
"database/sql"
+
"encoding/json"
+
"fmt"
+
"io"
+
"log"
+
"net/http"
+
"os"
+
"strings"
+
"time"
"github.com/go-chi/chi/v5"
chiMiddleware "github.com/go-chi/chi/v5/middleware"
+1 -2
internal/api/handlers/aggregator/errors.go
···
package aggregator
import (
+
"Coves/internal/core/aggregators"
"encoding/json"
"log"
"net/http"
-
-
"Coves/internal/core/aggregators"
)
// ErrorResponse represents an XRPC error response
+1 -2
internal/api/handlers/aggregator/get_authorizations.go
···
package aggregator
import (
+
"Coves/internal/core/aggregators"
"encoding/json"
"log"
"net/http"
"strconv"
-
-
"Coves/internal/core/aggregators"
)
// GetAuthorizationsHandler handles listing authorizations for an aggregator
+1 -2
internal/api/handlers/aggregator/get_services.go
···
package aggregator
import (
+
"Coves/internal/core/aggregators"
"encoding/json"
"log"
"net/http"
"strings"
-
-
"Coves/internal/core/aggregators"
)
// GetServicesHandler handles aggregator service details retrieval
+1 -2
internal/api/handlers/aggregator/list_for_community.go
···
package aggregator
import (
+
"Coves/internal/core/aggregators"
"encoding/json"
"log"
"net/http"
"strconv"
-
-
"Coves/internal/core/aggregators"
)
// ListForCommunityHandler handles listing aggregators for a community
+1 -1
internal/api/handlers/aggregator/register.go
···
if err != nil {
return fmt.Errorf("failed to fetch .well-known/atproto-did from %s: %w", domain, err)
}
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
// Check status code
if resp.StatusCode != http.StatusOK {
+1 -2
internal/api/handlers/comments/errors.go
···
package comments
import (
+
"Coves/internal/core/comments"
"encoding/json"
"log"
"net/http"
-
-
"Coves/internal/core/comments"
)
// errorResponse represents a standardized JSON error response
+2 -3
internal/api/handlers/comments/get_comments.go
···
package comments
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/comments"
"encoding/json"
"log"
"net/http"
"strconv"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/comments"
)
// GetCommentsHandler handles comment retrieval for posts
+1 -2
internal/api/handlers/comments/middleware.go
···
package comments
import (
+
"Coves/internal/api/middleware"
"net/http"
-
-
"Coves/internal/api/middleware"
)
// OptionalAuthMiddleware wraps the existing OptionalAuth middleware from the middleware package.
+1 -2
internal/api/handlers/comments/service_adapter.go
···
package comments
import (
+
"Coves/internal/core/comments"
"net/http"
-
-
"Coves/internal/core/comments"
)
// ServiceAdapter adapts the core comments.Service to the handler's Service interface
+2 -3
internal/api/handlers/community/block.go
···
package community
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
"encoding/json"
"log"
"net/http"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
)
// BlockHandler handles community blocking operations
+2 -3
internal/api/handlers/community/create.go
···
package community
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
"encoding/json"
"net/http"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
)
// CreateHandler handles community creation
+6 -7
internal/api/handlers/community/create_test.go
···
package community
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
"bytes"
"context"
"encoding/json"
···
"net/http/httptest"
"testing"
"time"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
)
// mockCommunityService implements communities.Service for testing
···
return nil, nil
}
-
func (m *mockCommunityService) ListCommunities(ctx context.Context, req communities.ListCommunitiesRequest) ([]*communities.Community, int, error) {
-
return nil, 0, nil
+
func (m *mockCommunityService) ListCommunities(ctx context.Context, req communities.ListCommunitiesRequest) ([]*communities.Community, error) {
+
return nil, nil
}
func (m *mockCommunityService) SearchCommunities(ctx context.Context, req communities.SearchCommunitiesRequest) ([]*communities.Community, int, error) {
···
tests := []struct {
name string
-
allowedDIDs []string
requestDID string
-
expectedStatus int
expectedError string
+
allowedDIDs []string
+
expectedStatus int
}{
{
name: "allowed DID can create community",
+1 -2
internal/api/handlers/community/errors.go
···
package community
import (
+
"Coves/internal/core/communities"
"encoding/json"
"log"
"net/http"
-
-
"Coves/internal/core/communities"
)
// XRPCError represents an XRPC error response
+1 -2
internal/api/handlers/community/get.go
···
package community
import (
+
"Coves/internal/core/communities"
"encoding/json"
"net/http"
-
-
"Coves/internal/core/communities"
)
// GetHandler handles community retrieval
+1 -2
internal/api/handlers/community/list.go
···
package community
import (
+
"Coves/internal/core/communities"
"encoding/json"
"net/http"
"strconv"
-
-
"Coves/internal/core/communities"
)
// ListHandler handles listing communities
+1 -2
internal/api/handlers/community/search.go
···
package community
import (
+
"Coves/internal/core/communities"
"encoding/json"
"net/http"
"strconv"
-
-
"Coves/internal/core/communities"
)
// SearchHandler handles community search
+2 -3
internal/api/handlers/community/subscribe.go
···
package community
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
"encoding/json"
"log"
"net/http"
"strings"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
)
// SubscribeHandler handles community subscriptions
+2 -3
internal/api/handlers/community/update.go
···
package community
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
"encoding/json"
"net/http"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
)
// UpdateHandler handles community updates
+1 -2
internal/api/handlers/communityFeed/errors.go
···
package communityFeed
import (
+
"Coves/internal/core/communityFeeds"
"encoding/json"
"errors"
"log"
"net/http"
-
-
"Coves/internal/core/communityFeeds"
)
// ErrorResponse represents an XRPC error response
+2 -3
internal/api/handlers/communityFeed/get_community.go
···
package communityFeed
import (
+
"Coves/internal/core/communityFeeds"
+
"Coves/internal/core/posts"
"encoding/json"
"log"
"net/http"
"strconv"
-
-
"Coves/internal/core/communityFeeds"
-
"Coves/internal/core/posts"
)
// GetCommunityHandler handles community feed retrieval
+1 -2
internal/api/handlers/discover/errors.go
···
package discover
import (
+
"Coves/internal/core/discover"
"encoding/json"
"errors"
"log"
"net/http"
-
-
"Coves/internal/core/discover"
)
// XRPCError represents an XRPC error response
+2 -3
internal/api/handlers/discover/get_discover.go
···
package discover
import (
+
"Coves/internal/core/discover"
+
"Coves/internal/core/posts"
"encoding/json"
"log"
"net/http"
"strconv"
-
-
"Coves/internal/core/discover"
-
"Coves/internal/core/posts"
)
// GetDiscoverHandler handles discover feed retrieval
+2 -3
internal/api/handlers/post/create.go
···
package post
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/posts"
"encoding/json"
"log"
"net/http"
"strings"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/posts"
)
// CreateHandler handles post creation requests
+2 -3
internal/api/handlers/post/errors.go
···
package post
import (
+
"Coves/internal/core/aggregators"
+
"Coves/internal/core/posts"
"encoding/json"
"log"
"net/http"
-
-
"Coves/internal/core/aggregators"
-
"Coves/internal/core/posts"
)
type errorResponse struct {
+1 -2
internal/api/handlers/timeline/errors.go
···
package timeline
import (
+
"Coves/internal/core/timeline"
"encoding/json"
"errors"
"log"
"net/http"
-
-
"Coves/internal/core/timeline"
)
// XRPCError represents an XRPC error response
+3 -4
internal/api/handlers/timeline/get_timeline.go
···
package timeline
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/timeline"
"encoding/json"
"log"
"net/http"
"strconv"
"strings"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/posts"
-
"Coves/internal/core/timeline"
)
// GetTimelineHandler handles timeline feed retrieval
+1 -2
internal/api/middleware/auth.go
···
package middleware
import (
+
"Coves/internal/atproto/auth"
"context"
"log"
"net/http"
"strings"
-
-
"Coves/internal/atproto/auth"
)
// Context keys for storing user information
+1 -2
internal/api/routes/user.go
···
package routes
import (
+
"Coves/internal/core/users"
"encoding/json"
"errors"
"log"
"net/http"
"time"
-
-
"Coves/internal/core/users"
"github.com/go-chi/chi/v5"
)
+1 -2
internal/atproto/jetstream/aggregator_consumer.go
···
package jetstream
import (
+
"Coves/internal/core/aggregators"
"context"
"encoding/json"
"fmt"
"log"
"time"
-
-
"Coves/internal/core/aggregators"
)
// AggregatorEventConsumer consumes aggregator-related events from Jetstream
+2 -3
internal/atproto/jetstream/comment_consumer.go
···
package jetstream
import (
+
"Coves/internal/atproto/utils"
+
"Coves/internal/core/comments"
"context"
"database/sql"
"encoding/json"
···
"log"
"strings"
"time"
-
-
"Coves/internal/atproto/utils"
-
"Coves/internal/core/comments"
"github.com/lib/pq"
)
+3 -4
internal/atproto/jetstream/community_consumer.go
···
package jetstream
import (
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/utils"
+
"Coves/internal/core/communities"
"context"
"encoding/json"
"fmt"
···
"net/http"
"strings"
"time"
-
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/utils"
-
"Coves/internal/core/communities"
lru "github.com/hashicorp/golang-lru/v2"
"golang.org/x/net/publicsuffix"
+3 -4
internal/atproto/jetstream/post_consumer.go
···
package jetstream
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/users"
"context"
"database/sql"
"encoding/json"
···
"log"
"strings"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/core/users"
)
// PostEventConsumer consumes post-related events from Jetstream
+2 -3
internal/atproto/jetstream/user_consumer.go
···
package jetstream
import (
+
"Coves/internal/atproto/identity"
+
"Coves/internal/core/users"
"context"
"encoding/json"
"fmt"
"log"
"sync"
"time"
-
-
"Coves/internal/atproto/identity"
-
"Coves/internal/core/users"
"github.com/gorilla/websocket"
)
+3 -4
internal/atproto/jetstream/vote_consumer.go
···
package jetstream
import (
+
"Coves/internal/atproto/utils"
+
"Coves/internal/core/users"
+
"Coves/internal/core/votes"
"context"
"database/sql"
"fmt"
"log"
"strings"
"time"
-
-
"Coves/internal/atproto/utils"
-
"Coves/internal/core/users"
-
"Coves/internal/core/votes"
)
// VoteEventConsumer consumes vote-related events from Jetstream
+1 -2
internal/core/aggregators/service.go
···
package aggregators
import (
+
"Coves/internal/core/communities"
"context"
"encoding/json"
"fmt"
"time"
-
-
"Coves/internal/core/communities"
"github.com/xeipuuv/gojsonschema"
)
+1 -2
internal/core/blobs/service.go
···
package blobs
import (
+
"Coves/internal/core/communities"
"bytes"
"context"
"encoding/json"
···
"log"
"net/http"
"time"
-
-
"Coves/internal/core/communities"
)
// Service defines the interface for blob operations
+3 -4
internal/core/comments/comment_service.go
···
package comments
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/users"
"context"
"encoding/json"
"errors"
···
"net/url"
"strings"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/core/users"
)
const (
+5 -6
internal/core/comments/comment_service_test.go
···
package comments
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/users"
"context"
"errors"
"testing"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/core/users"
"github.com/stretchr/testify/assert"
)
···
return nil
}
-
func (m *mockCommunityRepo) List(ctx context.Context, req communities.ListCommunitiesRequest) ([]*communities.Community, int, error) {
-
return nil, 0, nil
+
func (m *mockCommunityRepo) List(ctx context.Context, req communities.ListCommunitiesRequest) ([]*communities.Community, error) {
+
return nil, nil
}
func (m *mockCommunityRepo) Search(ctx context.Context, req communities.SearchCommunitiesRequest) ([]*communities.Community, int, error) {
+1 -2
internal/core/communities/service.go
···
package communities
import (
+
"Coves/internal/atproto/utils"
"bytes"
"context"
"encoding/json"
···
"strings"
"sync"
"time"
-
-
"Coves/internal/atproto/utils"
)
// Community handle validation regex (DNS-valid handle: name.community.instance.com)
+1 -2
internal/core/communityFeeds/service.go
···
package communityFeeds
import (
+
"Coves/internal/core/communities"
"context"
"fmt"
-
-
"Coves/internal/core/communities"
)
type feedService struct {
+1 -2
internal/core/communityFeeds/types.go
···
package communityFeeds
import (
+
"Coves/internal/core/posts"
"time"
-
-
"Coves/internal/core/posts"
)
// GetCommunityFeedRequest represents input for fetching a community feed
+1 -2
internal/core/discover/types.go
···
package discover
import (
+
"Coves/internal/core/posts"
"context"
"errors"
-
-
"Coves/internal/core/posts"
)
// Repository defines discover data access interface
+5 -6
internal/core/posts/service.go
···
package posts
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/aggregators"
+
"Coves/internal/core/blobs"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/unfurl"
"bytes"
"context"
"encoding/json"
···
"net/http"
"os"
"time"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/aggregators"
-
"Coves/internal/core/blobs"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/unfurl"
)
type postService struct {
+1 -2
internal/core/timeline/types.go
···
package timeline
import (
+
"Coves/internal/core/posts"
"context"
"errors"
"time"
-
-
"Coves/internal/core/posts"
)
// Repository defines timeline data access interface
+1 -2
internal/core/users/service.go
···
package users
import (
+
"Coves/internal/atproto/identity"
"bytes"
"context"
"encoding/json"
···
"regexp"
"strings"
"time"
-
-
"Coves/internal/atproto/identity"
)
// atProto handle validation regex (per official atProto spec: https://atproto.com/specs/handle)
+1 -2
internal/db/postgres/aggregator_repo.go
···
package postgres
import (
+
"Coves/internal/core/aggregators"
"context"
"database/sql"
"fmt"
"strings"
"time"
-
-
"Coves/internal/core/aggregators"
)
type postgresAggregatorRepo struct {
+1 -2
internal/db/postgres/comment_repo.go
···
package postgres
import (
+
"Coves/internal/core/comments"
"context"
"database/sql"
"encoding/base64"
"fmt"
"log"
"strings"
-
-
"Coves/internal/core/comments"
"github.com/lib/pq"
)
+2 -4
internal/db/postgres/community_repo.go
···
package postgres
import (
+
"Coves/internal/core/communities"
"context"
"database/sql"
"fmt"
"log"
"strings"
-
-
"Coves/internal/core/communities"
"github.com/lib/pq"
)
···
}
// Build sort clause - map sort enum to DB columns
-
sortColumn := "subscriber_count" // default: popular
-
sortOrder := "DESC"
+
var sortColumn, sortOrder string
switch req.Sort {
case "popular":
+1 -2
internal/db/postgres/community_repo_blocks.go
···
package postgres
import (
+
"Coves/internal/core/communities"
"context"
"database/sql"
"fmt"
"log"
-
-
"Coves/internal/core/communities"
)
// BlockCommunity creates a new block record (idempotent)
+1 -2
internal/db/postgres/community_repo_memberships.go
···
package postgres
import (
+
"Coves/internal/core/communities"
"context"
"database/sql"
"fmt"
"log"
"strings"
-
-
"Coves/internal/core/communities"
)
// CreateMembership creates a new membership record
+1 -2
internal/db/postgres/community_repo_subscriptions.go
···
package postgres
import (
+
"Coves/internal/core/communities"
"context"
"database/sql"
"fmt"
"log"
"strings"
-
-
"Coves/internal/core/communities"
)
// Subscribe creates a new subscription record
+1 -2
internal/db/postgres/discover_repo.go
···
package postgres
import (
+
"Coves/internal/core/discover"
"context"
"database/sql"
"fmt"
-
-
"Coves/internal/core/discover"
)
type postgresDiscoverRepo struct {
+1 -2
internal/db/postgres/feed_repo.go
···
package postgres
import (
+
"Coves/internal/core/communityFeeds"
"context"
"database/sql"
"fmt"
-
-
"Coves/internal/core/communityFeeds"
)
type postgresFeedRepo struct {
+1 -2
internal/db/postgres/feed_repo_base.go
···
package postgres
import (
+
"Coves/internal/core/posts"
"crypto/hmac"
"crypto/sha256"
"database/sql"
···
"strconv"
"strings"
"time"
-
-
"Coves/internal/core/posts"
)
// feedRepoBase contains shared logic for timeline and discover feed repositories
+1 -2
internal/db/postgres/post_repo.go
···
package postgres
import (
+
"Coves/internal/core/posts"
"context"
"database/sql"
"fmt"
"strings"
-
-
"Coves/internal/core/posts"
)
type postgresPostRepo struct {
+1 -2
internal/db/postgres/timeline_repo.go
···
package postgres
import (
+
"Coves/internal/core/timeline"
"context"
"database/sql"
"fmt"
-
-
"Coves/internal/core/timeline"
)
type postgresTimelineRepo struct {
+1 -2
internal/db/postgres/user_repo.go
···
package postgres
import (
+
"Coves/internal/core/users"
"context"
"database/sql"
"fmt"
"log"
"strings"
-
-
"Coves/internal/core/users"
"github.com/lib/pq"
)
+1 -2
internal/db/postgres/vote_repo.go
···
package postgres
import (
+
"Coves/internal/core/votes"
"context"
"database/sql"
"fmt"
"strings"
-
-
"Coves/internal/core/votes"
)
type postgresVoteRepo struct {
+1 -2
internal/db/postgres/vote_repo_test.go
···
package postgres
import (
+
"Coves/internal/core/votes"
"context"
"database/sql"
"os"
"testing"
"time"
-
-
"Coves/internal/core/votes"
_ "github.com/lib/pq"
"github.com/pressly/goose/v3"
+7 -8
tests/e2e/error_recovery_test.go
···
package e2e
import (
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"context"
"database/sql"
"fmt"
···
"sync/atomic"
"testing"
"time"
-
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
_ "github.com/lib/pq"
"github.com/pressly/goose/v3"
···
testCases := []struct {
name string
-
event jetstream.JetstreamEvent
shouldLog string
+
event jetstream.JetstreamEvent
}{
{
name: "Nil identity data",
···
if shouldFail.Load() {
t.Logf("Mock PDS: Simulating unavailability (request #%d)", requestCount.Load())
w.WriteHeader(http.StatusServiceUnavailable)
-
w.Write([]byte(`{"error":"ServiceUnavailable","message":"PDS temporarily unavailable"}`))
+
_, _ = w.Write([]byte(`{"error":"ServiceUnavailable","message":"PDS temporarily unavailable"}`))
return
}
t.Logf("Mock PDS: Serving request successfully (request #%d)", requestCount.Load())
// Simulate successful PDS response
w.WriteHeader(http.StatusOK)
-
w.Write([]byte(`{"did":"did:plc:pdstest123","handle":"pds.test"}`))
+
_, _ = w.Write([]byte(`{"did":"did:plc:pdstest123","handle":"pds.test"}`))
}))
defer mockPDS.Close()
+1 -2
tests/e2e/ratelimit_e2e_test.go
···
package e2e
import (
+
"Coves/internal/api/middleware"
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"time"
-
-
"Coves/internal/api/middleware"
"github.com/stretchr/testify/assert"
)
+4 -5
tests/e2e/user_signup_test.go
···
package e2e
import (
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"database/sql"
···
"os"
"testing"
"time"
-
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
_ "github.com/lib/pq"
"github.com/pressly/goose/v3"
+10 -11
tests/integration/aggregator_e2e_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/aggregator"
+
"Coves/internal/api/handlers/post"
+
"Coves/internal/api/middleware"
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/aggregators"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"database/sql"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/api/handlers/aggregator"
-
"Coves/internal/api/handlers/post"
-
"Coves/internal/api/middleware"
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/aggregators"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
_ "github.com/lib/pq"
"github.com/pressly/goose/v3"
+14 -14
tests/integration/aggregator_registration_test.go
···
// Setup test database
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
testDID := "did:plc:test123"
testHandle := "aggregator.bsky.social"
···
wellKnownServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/.well-known/atproto-did" {
w.Header().Set("Content-Type", "text/plain")
-
w.Write([]byte(testDID))
+
_, _ = w.Write([]byte(testDID))
} else {
w.WriteHeader(http.StatusNotFound)
}
···
// Setup test database
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
// Setup test server that returns wrong DID
wellKnownServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/.well-known/atproto-did" {
w.Header().Set("Content-Type", "text/plain")
-
w.Write([]byte("did:plc:wrongdid"))
+
_, _ = w.Write([]byte("did:plc:wrongdid"))
} else {
w.WriteHeader(http.StatusNotFound)
}
···
}
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
tests := []struct {
name string
···
}
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
// Pre-create user with same DID
existingDID := "did:plc:existing123"
···
wellKnownServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/.well-known/atproto-did" {
w.Header().Set("Content-Type", "text/plain")
-
w.Write([]byte(existingDID))
+
_, _ = w.Write([]byte(existingDID))
} else {
w.WriteHeader(http.StatusNotFound)
}
···
}
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
// Setup test server that returns 404 for .well-known
wellKnownServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
···
}
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
testDID := "did:plc:toolarge"
···
}
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
testDID := "did:plc:nonexistent"
···
wellKnownServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/.well-known/atproto-did" {
w.Header().Set("Content-Type", "text/plain")
-
w.Write([]byte(testDID))
+
_, _ = w.Write([]byte(testDID))
} else {
w.WriteHeader(http.StatusNotFound)
}
···
}
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
testDID := "did:plc:largedos123"
···
// with real .well-known server and real identity resolution
db := setupTestDB(t)
-
defer db.Close()
+
defer func() { _ = db.Close() }()
testDID := "did:plc:e2etest123"
testHandle := "e2ebot.bsky.social"
···
wellKnownServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/.well-known/atproto-did" {
w.Header().Set("Content-Type", "text/plain")
-
w.Write([]byte(testDID))
+
_, _ = w.Write([]byte(testDID))
} else {
w.WriteHeader(http.StatusNotFound)
}
+3 -4
tests/integration/aggregator_test.go
···
package integration
import (
+
"Coves/internal/core/aggregators"
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"encoding/json"
"fmt"
"testing"
"time"
-
-
"Coves/internal/core/aggregators"
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
// TestAggregatorRepository_Create tests basic aggregator creation
+13 -14
tests/integration/blob_upload_e2e_test.go
···
package integration
import (
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/blobs"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"encoding/json"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/blobs"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
···
if err != nil {
t.Skipf("PDS not running at %s: %v. Run 'make dev-up' to start PDS.", pdsURL, err)
}
-
defer healthResp.Body.Close()
+
defer func() { _ = healthResp.Body.Close() }()
if healthResp.StatusCode != http.StatusOK {
t.Skipf("PDS health check failed at %s: status %d", pdsURL, healthResp.StatusCode)
}
···
if err != nil {
t.Skipf("PDS not running at %s: %v. Run 'make dev-up' to start PDS.", pdsURL, err)
}
-
defer healthResp.Body.Close()
+
defer func() { _ = healthResp.Body.Close() }()
if healthResp.StatusCode != http.StatusOK {
t.Skipf("PDS health check failed at %s: status %d", pdsURL, healthResp.StatusCode)
}
···
t.Run("Accept matching image formats with correct MIME types", func(t *testing.T) {
testCases := []struct {
+
createFunc func(*testing.T, int, int, color.Color) []byte
format string
mimeType string
-
createFunc func(*testing.T, int, int, color.Color) []byte
}{
-
{"PNG", "image/png", createTestPNG},
-
{"JPEG", "image/jpeg", createTestJPEG},
+
{createTestPNG, "PNG", "image/png"},
+
{createTestJPEG, "JPEG", "image/jpeg"},
// Note: WebP requires external library (golang.org/x/image/webp)
// For now, we test that the MIME type is accepted even with PNG data
// In production, actual WebP validation would happen at PDS
-
{"WebP (MIME only)", "image/webp", createTestPNG},
+
{createTestPNG, "WebP (MIME only)", "image/webp"},
}
for _, tc := range testCases {
+14 -14
tests/integration/block_handle_resolution_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/community"
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
"bytes"
"context"
"encoding/json"
···
"net/http/httptest"
"testing"
-
"Coves/internal/api/handlers/community"
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
postgresRepo "Coves/internal/db/postgres"
)
···
// We expect 401 (no auth) but verify the error is NOT "Community not found"
// If handle resolution worked, we'd get past that validation
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode == http.StatusNotFound {
t.Errorf("Handle resolution failed - got 404 CommunityNotFound")
···
// Expected: 401 Unauthorized (because we didn't add auth context)
if resp.StatusCode != http.StatusUnauthorized {
var errorResp map[string]interface{}
-
json.NewDecoder(resp.Body).Decode(&errorResp)
+
_ = json.NewDecoder(resp.Body).Decode(&errorResp)
t.Logf("Response status: %d, body: %+v", resp.StatusCode, errorResp)
}
})
···
blockHandler.HandleBlock(w, req)
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode == http.StatusNotFound {
t.Errorf("@-prefixed handle resolution failed - got 404 CommunityNotFound")
···
blockHandler.HandleBlock(w, req)
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode == http.StatusNotFound {
t.Errorf("Scoped format resolution failed - got 404 CommunityNotFound")
···
blockHandler.HandleBlock(w, req)
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode == http.StatusNotFound {
t.Errorf("DID resolution failed - got 404 CommunityNotFound")
···
blockHandler.HandleBlock(w, req)
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
// Should return 400 Bad Request for validation errors
if resp.StatusCode != http.StatusBadRequest {
···
}
var errorResp map[string]interface{}
-
json.NewDecoder(resp.Body).Decode(&errorResp)
+
_ = json.NewDecoder(resp.Body).Decode(&errorResp)
if errorCode, ok := errorResp["error"].(string); !ok || errorCode != "InvalidRequest" {
t.Errorf("Expected error code 'InvalidRequest', got %v", errorResp["error"])
···
blockHandler.HandleBlock(w, req)
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
// Expected: 401 (auth check happens before resolution)
// In a real scenario with auth, invalid handle would return 404
···
blockHandler.HandleUnblock(w, req)
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
// Should NOT be 404 (handle resolution should work)
if resp.StatusCode == http.StatusNotFound {
···
// Expected: 401 (no auth context)
if resp.StatusCode != http.StatusUnauthorized {
var errorResp map[string]interface{}
-
json.NewDecoder(resp.Body).Decode(&errorResp)
+
_ = json.NewDecoder(resp.Body).Decode(&errorResp)
t.Logf("Response: status=%d, body=%+v", resp.StatusCode, errorResp)
}
})
···
blockHandler.HandleUnblock(w, req)
resp := w.Result()
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
// Expected: 401 (auth check happens before resolution)
if resp.StatusCode != http.StatusUnauthorized && resp.StatusCode != http.StatusNotFound {
+3 -4
tests/integration/comment_consumer_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/comments"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/comments"
-
"Coves/internal/db/postgres"
)
func TestCommentConsumer_CreateComment(t *testing.T) {
+3 -4
tests/integration/comment_query_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/comments"
+
"Coves/internal/db/postgres"
"context"
"database/sql"
"encoding/json"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/comments"
-
"Coves/internal/db/postgres"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+4 -5
tests/integration/comment_vote_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/comments"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/comments"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
)
// TestCommentVote_CreateAndUpdate tests voting on comments and vote count updates
+2 -3
tests/integration/community_blocking_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/communities"
"context"
"database/sql"
"fmt"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/communities"
postgresRepo "Coves/internal/db/postgres"
)
+4 -5
tests/integration/community_consumer_test.go
···
package integration
import (
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"errors"
"fmt"
"testing"
"time"
-
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
func TestCommunityConsumer_HandleCommunityProfile(t *testing.T) {
+2 -3
tests/integration/community_credentials_test.go
···
package integration
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"testing"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
// TestCommunityRepository_CredentialPersistence tests that PDS credentials are properly persisted
+13 -14
tests/integration/community_e2e_test.go
···
package integration
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/api/routes"
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/atproto/utils"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"database/sql"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/api/routes"
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/atproto/utils"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
"github.com/go-chi/chi/v5"
"github.com/gorilla/websocket"
···
}
var listResp struct {
-
Communities []communities.Community `json:"communities"`
Cursor string `json:"cursor"`
+
Communities []communities.Community `json:"communities"`
}
if err := json.NewDecoder(resp.Body).Decode(&listResp); err != nil {
···
}
var listResp struct {
-
Communities []communities.Community `json:"communities"`
Cursor string `json:"cursor"`
+
Communities []communities.Community `json:"communities"`
}
if err := json.NewDecoder(resp.Body).Decode(&listResp); err != nil {
t.Fatalf("Failed to decode response: %v", err)
···
}
var listResp struct {
-
Communities []communities.Community `json:"communities"`
Cursor string `json:"cursor"`
+
Communities []communities.Community `json:"communities"`
}
if err := json.NewDecoder(resp.Body).Decode(&listResp); err != nil {
t.Fatalf("Failed to decode response: %v", err)
···
}
var listResp struct {
-
Communities []communities.Community `json:"communities"`
Cursor string `json:"cursor"`
+
Communities []communities.Community `json:"communities"`
}
if err := json.NewDecoder(resp.Body).Decode(&listResp); err != nil {
t.Fatalf("Failed to decode response: %v", err)
···
}
var listResp struct {
-
Communities []communities.Community `json:"communities"`
Cursor string `json:"cursor"`
+
Communities []communities.Community `json:"communities"`
}
if err := json.NewDecoder(resp.Body).Decode(&listResp); err != nil {
t.Fatalf("Failed to decode response: %v", err)
+4 -5
tests/integration/community_hostedby_security_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"net/http"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/db/postgres"
)
// TestHostedByVerification_DomainMatching tests that hostedBy domain must match handle domain
···
// Return a DID document with matching alsoKnownAs
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
-
fmt.Fprintf(w, `{
+
_, _ = fmt.Fprintf(w, `{
"id": "did:web:example.com",
"alsoKnownAs": ["at://example.com"],
"verificationMethod": [],
···
// Return a DID document WITHOUT alsoKnownAs field
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
-
fmt.Fprintf(w, `{
+
_, _ = fmt.Fprintf(w, `{
"id": "did:web:example.com",
"verificationMethod": [],
"service": []
+2 -3
tests/integration/community_identifier_resolution_test.go
···
package integration
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"os"
"strings"
"testing"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+2 -3
tests/integration/community_provisioning_test.go
···
package integration
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"strings"
"testing"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
// TestCommunityRepository_PasswordEncryption verifies P0 fix:
+2 -3
tests/integration/community_repo_test.go
···
package integration
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"testing"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
func TestCommunityRepository_Create(t *testing.T) {
+2 -3
tests/integration/community_service_integration_test.go
···
package integration
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"encoding/json"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
// TestCommunityService_CreateWithRealPDS tests the complete service layer flow
+3 -4
tests/integration/community_v2_validation_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
// TestCommunityConsumer_V2RKeyValidation tests that only V2 communities (rkey="self") are accepted
+6 -7
tests/integration/concurrent_scenarios_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/comments"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"sync"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/comments"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
)
// TestConcurrentVoting_MultipleUsersOnSamePost tests race conditions when multiple users
···
wg.Add(numAttempts)
type result struct {
-
success bool
err error
+
success bool
}
results := make(chan result, numAttempts)
+2 -3
tests/integration/discover_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/discover"
+
"Coves/internal/db/postgres"
"context"
"encoding/json"
"fmt"
···
"net/http/httptest"
"testing"
"time"
-
-
"Coves/internal/api/handlers/discover"
-
"Coves/internal/db/postgres"
discoverCore "Coves/internal/core/discover"
+4 -5
tests/integration/feed_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/communityFeed"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/communityFeeds"
+
"Coves/internal/db/postgres"
"context"
"encoding/json"
"fmt"
···
"net/http/httptest"
"testing"
"time"
-
-
"Coves/internal/api/handlers/communityFeed"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/communityFeeds"
-
"Coves/internal/db/postgres"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+2 -3
tests/integration/helpers.go
···
package integration
import (
+
"Coves/internal/atproto/auth"
+
"Coves/internal/core/users"
"bytes"
"context"
"database/sql"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/atproto/auth"
-
"Coves/internal/core/users"
"github.com/golang-jwt/jwt/v5"
)
+1 -2
tests/integration/identity_resolution_test.go
···
package integration
import (
+
"Coves/internal/atproto/identity"
"context"
"fmt"
"os"
"testing"
"time"
-
-
"Coves/internal/atproto/identity"
)
// uniqueID generates a unique identifier for test isolation
+3 -4
tests/integration/jetstream_consumer_test.go
···
package integration
import (
-
"context"
-
"testing"
-
"time"
-
"Coves/internal/atproto/identity"
"Coves/internal/atproto/jetstream"
"Coves/internal/core/users"
"Coves/internal/db/postgres"
+
"context"
+
"testing"
+
"time"
)
func TestUserIndexingFromJetstream(t *testing.T) {
+3 -4
tests/integration/jwt_verification_test.go
···
package integration
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/atproto/auth"
"fmt"
"net/http"
"net/http/httptest"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/api/middleware"
-
"Coves/internal/atproto/auth"
)
// TestJWTSignatureVerification tests end-to-end JWT signature verification
···
// Check if JWKS is available (production PDS) or symmetric secret (dev PDS)
jwksResp, _ := http.Get(pdsURL + "/oauth/jwks")
if jwksResp != nil {
-
defer jwksResp.Body.Close()
+
defer func() { _ = jwksResp.Body.Close() }()
}
t.Run("JWT parsing and middleware integration", func(t *testing.T) {
+3 -4
tests/integration/post_consumer_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"context"
"fmt"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
)
// TestPostConsumer_CommentCountReconciliation tests that post comment_count
+4 -5
tests/integration/post_creation_test.go
···
package integration
import (
-
"context"
-
"fmt"
-
"strings"
-
"testing"
-
"Coves/internal/api/middleware"
"Coves/internal/atproto/identity"
"Coves/internal/core/communities"
"Coves/internal/core/posts"
"Coves/internal/core/users"
"Coves/internal/db/postgres"
+
"context"
+
"fmt"
+
"strings"
+
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+8 -9
tests/integration/post_e2e_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/post"
+
"Coves/internal/api/middleware"
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"database/sql"
···
"strings"
"testing"
"time"
-
-
"Coves/internal/api/handlers/post"
-
"Coves/internal/api/middleware"
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
"github.com/gorilla/websocket"
_ "github.com/lib/pq"
+5 -6
tests/integration/post_handler_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/post"
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/db/postgres"
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"strings"
"testing"
-
-
"Coves/internal/api/handlers/post"
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/db/postgres"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+5 -6
tests/integration/post_thumb_validation_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/post"
+
"Coves/internal/api/middleware"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
-
-
"Coves/internal/api/handlers/post"
-
"Coves/internal/api/middleware"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
-
"Coves/internal/db/postgres"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+5 -6
tests/integration/post_unfurl_test.go
···
package integration
import (
-
"context"
-
"encoding/json"
-
"fmt"
-
"testing"
-
"time"
-
"Coves/internal/api/middleware"
"Coves/internal/atproto/identity"
"Coves/internal/atproto/jetstream"
···
"Coves/internal/core/unfurl"
"Coves/internal/core/users"
"Coves/internal/db/postgres"
+
"context"
+
"encoding/json"
+
"fmt"
+
"testing"
+
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+2 -3
tests/integration/subscription_indexing_test.go
···
package integration
import (
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/communities"
"context"
"database/sql"
"fmt"
"testing"
"time"
-
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/communities"
postgresRepo "Coves/internal/db/postgres"
)
+3 -4
tests/integration/timeline_test.go
···
package integration
import (
+
"Coves/internal/api/handlers/timeline"
+
"Coves/internal/api/middleware"
+
"Coves/internal/db/postgres"
"context"
"encoding/json"
"fmt"
···
"net/http/httptest"
"testing"
"time"
-
-
"Coves/internal/api/handlers/timeline"
-
"Coves/internal/api/middleware"
-
"Coves/internal/db/postgres"
timelineCore "Coves/internal/core/timeline"
+2 -3
tests/integration/token_refresh_test.go
···
package integration
import (
+
"Coves/internal/core/communities"
+
"Coves/internal/db/postgres"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"testing"
"time"
-
-
"Coves/internal/core/communities"
-
"Coves/internal/db/postgres"
)
// TestTokenRefresh_ExpirationDetection tests the NeedsRefresh function with various token states
+11 -11
tests/integration/user_journey_e2e_test.go
···
package integration
import (
+
"Coves/internal/api/middleware"
+
"Coves/internal/api/routes"
+
"Coves/internal/atproto/identity"
+
"Coves/internal/atproto/jetstream"
+
"Coves/internal/core/communities"
+
"Coves/internal/core/posts"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"bytes"
"context"
"database/sql"
···
"testing"
"time"
-
"Coves/internal/api/middleware"
-
"Coves/internal/api/routes"
-
"Coves/internal/atproto/identity"
-
"Coves/internal/atproto/jetstream"
-
"Coves/internal/core/communities"
-
"Coves/internal/core/posts"
timelineCore "Coves/internal/core/timeline"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
"github.com/go-chi/chi/v5"
"github.com/gorilla/websocket"
···
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
require.Equal(t, http.StatusOK, resp.StatusCode, "Community creation should succeed")
···
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
require.Equal(t, http.StatusOK, resp.StatusCode, "Post creation should succeed")
···
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
-
defer resp.Body.Close()
+
defer func() { _ = resp.Body.Close() }()
require.Equal(t, http.StatusOK, resp.StatusCode, "Subscription should succeed")
+4 -5
tests/integration/user_test.go
···
package integration
import (
+
"Coves/internal/api/routes"
+
"Coves/internal/atproto/identity"
+
"Coves/internal/core/users"
+
"Coves/internal/db/postgres"
"context"
"database/sql"
"encoding/json"
···
"os"
"strings"
"testing"
-
-
"Coves/internal/api/routes"
-
"Coves/internal/atproto/identity"
-
"Coves/internal/core/users"
-
"Coves/internal/db/postgres"
"github.com/go-chi/chi/v5"
_ "github.com/lib/pq"
+1 -2
tests/unit/community_service_test.go
···
package unit
import (
+
"Coves/internal/core/communities"
"context"
"fmt"
"net/http"
···
"sync/atomic"
"testing"
"time"
-
-
"Coves/internal/core/communities"
)
// mockCommunityRepo is a minimal mock for testing service layer