Adds the SciMesh coordinator: a durable task-queue server on PostgreSQL that owns all database access, with workers reaching it over HTTP only. Structured as a modular monolith following Clean Architecture: domain entities and their invariants, no I/O usecase business operations + repository/clock ports transport HTTP handlers, DTOs, auth, error mapping storage PostgreSQL repositories, transactions carried in context infra config, pool, clock, server, lease reaper Dependencies point strictly inward; domain imports nothing from the module. Working: layer wiring, routing, shared-token auth, access logging, request IDs, domain-error to status-code mapping, transactional boundaries, graceful shutdown (HTTP drain -> reaper stop -> pool close), migrations, and a Compose stack starting Postgres -> migrations -> coordinator. The domain is complete and covered by unit tests that need no database: lease ownership, stale attempts, idempotent result replay, retry budgets, and lease expiry. Repository methods are stubs returning ErrNotImplemented (HTTP 501). The SQL for atomic claiming (FOR UPDATE SKIP LOCKED) and for lease expiry is written and ready to wire up. See coordinator/ARCHITECTURE.md for the layer map and a request traced through every layer.
55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
version: "2"
|
|
|
|
run:
|
|
timeout: 3m
|
|
|
|
linters:
|
|
# "standard" = errcheck, govet, ineffassign, staticcheck, unused.
|
|
default: standard
|
|
enable:
|
|
# Catches `err == ErrFoo` where errors.Is is required. Directly relevant
|
|
# here: domain exposes sentinel errors that use cases may wrap with %w.
|
|
- errorlint
|
|
# Returning nil after checking a non-nil error — a silent bug factory.
|
|
- nilerr
|
|
# http.Get/Do without a context: every outbound call must be cancellable.
|
|
- noctx
|
|
# Unclosed response bodies leak connections.
|
|
- bodyclose
|
|
# Common security mistakes (weak crypto, unhandled file perms).
|
|
- gosec
|
|
# Style and naming consistency.
|
|
- revive
|
|
- misspell
|
|
- unconvert
|
|
|
|
settings:
|
|
errcheck:
|
|
# Deferred Close/Rollback are intentionally ignored in a few places
|
|
# (rollback after commit is a documented no-op).
|
|
check-type-assertions: true
|
|
revive:
|
|
rules:
|
|
- name: exported
|
|
disabled: true # internal packages need no exported-symbol comments
|
|
gosec:
|
|
excludes:
|
|
- G404 # math/rand is fine for jitter; nothing here is security-sensitive
|
|
|
|
exclusions:
|
|
rules:
|
|
# Tests may skip error checks and use long literals freely.
|
|
- path: _test\.go
|
|
linters:
|
|
- errcheck
|
|
- gosec
|
|
|
|
formatters:
|
|
enable:
|
|
- gofmt
|
|
- goimports
|
|
settings:
|
|
goimports:
|
|
local-prefixes:
|
|
- github.com/emil28092005/SciMesh/coordinator
|