mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
Protocol codegen (decision D4, audit A-2026-07-08): - Add docs/protocol-schema.json as the real single source of truth for WS message-type constants, making the long-standing 'generated from' comment in both constant files true. - Add Server/scripts/genprotocol, a generator emitting both Server/ws/message_types.go and Client .../lib/protocolTypes.ts (constants byte-for-byte value-identical to before; only headers, ordering alignment, and provenance comments changed). - Add make protocol-generate / protocol-verify and wire protocol-verify into CI next to sqlc-verify. Quick wins (decision D8): - admin: log LogAudit write failures in the backup handlers instead of discarding them (prior audit #10). - api: fix self-contradictory upload Cache-Control to 'private, no-cache' per remediation plan W3-4; drop the now-unused fileCacheMaxAgeSeconds constant; update test. - ws: route the hub settings cache through db.GetSetting instead of inline SQL. - ws: fix a latent data race — main.go wires SetEventPersister and SetEventStore after NewRouter has already started the hub Run loop, which reads those fields on the broadcast/replay paths. They (and pluginSink, which one test sets post-Run) are now atomic pointers; the remaining pre-Run-only setters reject late calls with an error log instead of racing silently. Update the audit closure table and decisions doc statuses accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UA17KPvqGBX3XbXYnMf1rA
48 lines
1.7 KiB
Makefile
48 lines
1.7 KiB
Makefile
# OwnCord Server — developer convenience targets
|
|
#
|
|
# sqlc-generate Regenerate type-safe Go from sqlc.yaml (db/dbgen).
|
|
# sqlc-verify Fail if the committed dbgen output is stale (used by CI).
|
|
# sqlc-install Install the pinned sqlc version into $GOBIN.
|
|
# protocol-generate Regenerate WS message-type constants (Go + TS) from docs/protocol-schema.json.
|
|
# protocol-verify Fail if the committed protocol constants are stale (used by CI).
|
|
# otel-up Start Jaeger + Prometheus for local tracing development.
|
|
# otel-down Stop and remove the OTel dev containers.
|
|
|
|
SQLC_VERSION := $(shell cat sqlc.version)
|
|
|
|
.PHONY: sqlc-install sqlc-generate sqlc-verify protocol-generate protocol-verify otel-up otel-down
|
|
|
|
sqlc-install:
|
|
go install github.com/sqlc-dev/sqlc/cmd/sqlc@$(SQLC_VERSION)
|
|
|
|
sqlc-generate:
|
|
sqlc generate
|
|
|
|
sqlc-verify:
|
|
sqlc generate
|
|
@git diff --exit-code db/dbgen || ( \
|
|
echo "ERROR: generated sqlc output is stale. Run 'make sqlc-generate' and commit the result." ; \
|
|
exit 1 ; \
|
|
)
|
|
|
|
protocol-generate:
|
|
go run ./scripts/genprotocol
|
|
|
|
protocol-verify:
|
|
go run ./scripts/genprotocol
|
|
@git diff --exit-code ws/message_types.go ../Client/tauri-client/src/lib/protocolTypes.ts || ( \
|
|
echo "ERROR: generated protocol constants are stale. Run 'make protocol-generate' and commit the result." ; \
|
|
exit 1 ; \
|
|
)
|
|
|
|
# Phase B Step 8 — local OTel development stack.
|
|
# Starts Jaeger (traces) and Prometheus (metrics) in Docker.
|
|
# Jaeger UI: http://localhost:16686
|
|
# Prometheus UI: http://localhost:9090
|
|
# Run the server with: go build -tags otel . && ./owncord-server
|
|
otel-up:
|
|
docker compose -f docker-compose.otel.yml up -d
|
|
|
|
otel-down:
|
|
docker compose -f docker-compose.otel.yml down
|