Files
Warp/Makefile
T
tajniak81andClaude Opus 5.5 487e0f410b
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Test (windows-latest) (push) Canceled after 0s
CI / Storage tests on PostgreSQL (push) Canceled after 0s
CI / Complement (federation off) (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
CI / Smoke test the binary (push) Canceled after 0s
Phase 10: hardening and ops
Implements PLAN.md Phase 10.

Simplified Sliding Sync (MSC4186) is served at the unstable
org.matrix.simplified_msc3575 endpoint and advertised in /versions. Lists
are sorted by activity and filtered by DM, invite, encryption, room type,
space and tag; room subscriptions, required_state with wildcards, $ME and
$LAZY, and the to_device, e2ee, account_data, receipts and typing
extensions are supported. Per-connection state is kept in memory and an
unknown pos answers M_UNKNOWN_POS.

Threads and relations: m.relates_to is indexed on roomserver_events
(migration 0012), /relations (with recursion) and /threads are served, and
every event a timeline read returns carries its m.thread, m.replace and
m.reference summaries in unsigned.m.relations. Notifications carry a
thread ID (migration 0013): threaded receipts clear only their thread, and
sync reports unread_thread_notifications when the filter asks.

Spaces: /hierarchy walks a space breadth first, asking other servers about
rooms this one is not in through the new federation hierarchy endpoint;
room_summary describes one room. /search runs on FTS5 (sqlite, pocketbase)
or tsvector (postgres), bounded to what each user may see, with context,
profiles, state, grouping and paging.

The PocketBase driver is real: the sqlite schema and store on an embedded
PocketBase app's database, with media in its filesystem, local or S3
(database.pocketbase.s3). It runs the full storage test suite.

Ops: OpenTelemetry tracing over OTLP/HTTP (tracing.*), with server spans
per route, component spans, and trace propagation on federation, push and
application service calls. New metrics for persisted events, waiting
syncs, sliding sync connections and the database pool, with a Grafana
dashboard. deploy/ adds a Compose setup (PostgreSQL, Prometheus, Grafana,
Jaeger) and a Helm chart; cmd/warp-loadtest loads a server and reports
request and delivery latencies.

The load tester found a long-standing bug, fixed here: on a server where
no account data had been written, every incremental /sync re-sent the push
rules and returned at once, and an all-zero token was taken for an initial
sync, so long polls became busy loops.

The PostgreSQL migrations and search dialect compile but were not run
against a live PostgreSQL in this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 20:21:31 +02:00

126 lines
4.0 KiB
Makefile

# Warp — build, test and lint.
#
# Everything Go lives in ./server; the frontend packages (apps/*) get their
# own targets as they are created.
SHELL := /bin/sh
GO ?= go
BIN_DIR := bin
BINARY := warp
SERVER_DIR := server
COMPLEMENT_IMAGE ?= complement-warp
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo 0.0.0-dev)
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
PKG := github.com/dariuszjaniak/warp/server/internal/buildinfo
LDFLAGS := -X $(PKG).Version=$(VERSION) -X $(PKG).Commit=$(COMMIT) -X $(PKG).BuildDate=$(DATE)
# Windows builds need the .exe suffix for `make run` to work from MSYS.
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.DEFAULT_GOAL := build
.PHONY: help
help: ## List the targets
@grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Build the warp binary into bin/
cd $(SERVER_DIR) && $(GO) build -ldflags "$(LDFLAGS)" -o ../$(BIN_DIR)/$(BINARY)$(EXE) ./cmd/warp
.PHONY: run
run: build ## Build and run the server
./$(BIN_DIR)/$(BINARY)$(EXE) serve
.PHONY: test
test: ## Run the unit tests (sqlite only)
cd $(SERVER_DIR) && $(GO) test ./...
.PHONY: test-race
test-race: ## Run the tests with the race detector (needs cgo)
cd $(SERVER_DIR) && CGO_ENABLED=1 $(GO) test -race ./...
.PHONY: test-postgres
test-postgres: ## Run the storage tests against PostgreSQL too
@test -n "$(WARP_TEST_POSTGRES_DSN)" || \
{ echo "set WARP_TEST_POSTGRES_DSN, e.g. postgres://warp:warp@localhost/warp_test?sslmode=disable"; exit 1; }
cd $(SERVER_DIR) && WARP_TEST_POSTGRES_DSN="$(WARP_TEST_POSTGRES_DSN)" $(GO) test ./internal/storage/...
.PHONY: cover
cover: ## Run the tests and write coverage.out / coverage.html
cd $(SERVER_DIR) && $(GO) test -coverprofile=../coverage.out -covermode=count ./...
$(GO) tool cover -html=coverage.out -o coverage.html
@echo "wrote coverage.html"
.PHONY: fmt
fmt: ## Format the Go code
cd $(SERVER_DIR) && $(GO) fmt ./...
.PHONY: vet
vet: ## Run go vet
cd $(SERVER_DIR) && $(GO) vet ./...
.PHONY: lint
lint: ## Run golangci-lint
cd $(SERVER_DIR) && golangci-lint run
.PHONY: tidy
tidy: ## Tidy the Go module files
cd $(SERVER_DIR) && $(GO) mod tidy
.PHONY: check
check: vet test ## What CI runs on every push (minus the linter)
.PHONY: generate-keys
generate-keys: build ## Create the ed25519 signing key
./$(BIN_DIR)/$(BINARY)$(EXE) generate-keys
.PHONY: migrate
migrate: build ## Apply pending database migrations
./$(BIN_DIR)/$(BINARY)$(EXE) migrate
.PHONY: create-account
create-account: build ## Create an account: make create-account ACCOUNT=alice ARGS=--admin
@test -n "$(ACCOUNT)" || { echo "set ACCOUNT, e.g. make create-account ACCOUNT=alice ARGS=--admin"; exit 1; }
./$(BIN_DIR)/$(BINARY)$(EXE) create-account --username "$(ACCOUNT)" $(ARGS)
.PHONY: complement-image
complement-image: ## Build the Complement homeserver image
docker build -t $(COMPLEMENT_IMAGE) -f $(SERVER_DIR)/test/complement/Dockerfile .
.PHONY: complement
complement: ## Run the Complement C-S subset (federation off)
bash $(SERVER_DIR)/test/complement/run.sh
.PHONY: complement-federation
complement-federation: ## Run the Complement federation subset
COMPLEMENT_PROFILE=federation bash $(SERVER_DIR)/test/complement/run.sh
.PHONY: docker
docker: ## Build the container image
docker build -t warp:$(VERSION) .
.PHONY: loadtest
loadtest: ## Load a test server: make loadtest ARGS="-url http://localhost:8008 -users 50"
cd $(SERVER_DIR) && $(GO) run ./cmd/warp-loadtest $(ARGS)
.PHONY: compose-up
compose-up: ## Run Warp, PostgreSQL and the observability stack with Docker Compose
cd deploy/compose && docker compose --profile observability up -d --build
.PHONY: helm-lint
helm-lint: ## Lint and render the Helm chart (needs helm)
helm lint deploy/helm/warp
helm template warp deploy/helm/warp > /dev/null
.PHONY: clean
clean: ## Remove build output
rm -rf $(BIN_DIR) coverage.out coverage.html