Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "2"

run:
timeout: 5m

linters:
default: none
enable:
- govet
- ineffassign
- staticcheck
- unused

# Apply the new gate to changes while existing lint debt is addressed separately.
issues:
new-from-rev: HEAD
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ worker, and enqueue setup.

### Go

Requires Go 1.25 or newer.
Requires Go 1.27 or newer. See the [Go generics guide](docs/go-generics.md) for
typed APIs and the Go 1.27 migration.

```go
type WelcomeEmail struct {
Expand Down
10 changes: 8 additions & 2 deletions conformance/CAPABILITY_REGISTER.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions conformance/EVIDENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ evidence-debt: 0
- go-mysql: driver/headgatemysql/store_test.go::TestStickyRoutingIsStrictBoundedAndSurvivesRequeue

### Task aggregation / batch handlers
- go: batch_handler_test.go::TestRegistryBatchMethodRejectsInvalidConfiguration
- rust: crates/headgate-core/src/lib.rs::admission_units_group_same_kind_and_respect_bound
- rust: crates/headgate/tests/batch_handler.rs::typed_batch_handler_runs_once_and_acks_each_member_independently
- rust: crates/headgate/tests/batch_handler.rs::typed_batch_handler_flushes_at_max_delay
Expand Down Expand Up @@ -105,6 +106,7 @@ NOTE: these are the security/shape contract. A live PostgreSQL maintenance run i

### **CLI**
- go: headgatectl/main_test.go::TestClientUsesBoundedControlAPIAndBearerAuthentication
- go: headgatectl/main_test.go::TestClientTimeoutCancelsRequestAndBodyRead
NOTE: command construction is compile-tested with Cobra; the client test pins the API-only boundary and bearer propagation.

### **Redis Sentinel / Cluster**
Expand Down Expand Up @@ -163,6 +165,7 @@ NOTE: all six store/language cells assert newest-first retention at exactly 100
## Enqueue

### Typed enqueue
- go: runtime_test.go::TestRegistryMethodsPreserveValidationAndDispatch
- rust: crates/headgate/tests/derive.rs::derive_generates_identity_and_json_codec
- rust: crates/headgate/tests/runtime.rs::drain_success_retry_panic_and_control_outcomes
- go: driver/headgatepgx/runtime_test.go::TestGoRuntimeDrainStepsAndPanics
Expand Down Expand Up @@ -656,6 +659,8 @@ NOTE: round 32l. Deleting the lost-lease check from `extend_lease` (`let _ = los
- rust: crates/headgate/tests/task_data.rs::extensions_are_keyed_and_retrieved_by_concrete_type
- rust: crates/headgate/tests/task_data.rs::concurrent_jobs_have_isolated_typed_data_and_it_never_enters_the_envelope
- go: task_data_test.go::TestExtensionsAreKeyedAndRetrievedByConcreteType
- go: task_data_test.go::TestExtensionMethodsShareTypedState
- go: task_data_test.go::TestExtensionMethodsNilReceiver
- go: headgatetest/task_data_test.go::TestConcurrentJobsHaveIsolatedTypedDataAndItNeverEntersTheEnvelope
NOTE: round 32y. The container tests pin concrete-type lookup, wrong-type misses, replacement and removal; Go additionally requires `SetJobData` outside a handler to return `ErrTaskDataUnavailable` rather than falling back to a global. The runtime tests drive the real concurrent worker loop, not a type-map unit helper: two jobs store the SAME concrete type, both rendezvous before either reads, and each must recover its own marker while still seeing the unchanged worker default. They also require successful ack and inspect the retained envelope for the marker, so the proof covers dispatch lifetime and the persistence boundary together. Making the job map reuse the worker map failed both tests; the focused Go tests also pass `-race`. This is the storage substrate only—handler-parameter extraction remains a separate ❌ row.

Expand Down Expand Up @@ -1178,6 +1183,7 @@ NOTE: the two live Postgres control-channel tests deliver `restart` through a ru
- go: driver/headgatepgx/store_test.go::TestNotifyWakesAWaitingSubscriber
- go: driver/headgateredis/store_test.go::TestEnqueuePublishWakesAWaitingSubscriber
- rust: crates/headgate-api/tests/api.rs::sse_events_stream_queue_activity
- go: headgateapi/api_test.go::TestEventStreamHeartbeatCoalescingAndCancellation
NOTE: all four prove `wait_wakeup`/`WaitWakeup` returns on an enqueue (plus the NOTIFYING cap); nothing asserts the row's claim that a worker loop's poll wait is actually shortcut by it.

## Observability
Expand Down Expand Up @@ -1243,6 +1249,11 @@ NOTE: the runtime tests prove the `JobSpan` hook fires exactly once with the par
- sh: xlang §8.4: Go enqueues traceparent -> Rust reads back the IDENTICAL value
- sh: xlang §8.4 (Redis): a header-less job writes no headers field at all

### Go worker profiles
- go: runtime_test.go::TestWorkerProfileLabelsFollowDispatchAndRestoreCaller
- go: runtime_test.go::TestWorkerAndDutyProfileLabels
NOTE: Go-only operational profiles. The runtime supplies labels; the embedding application owns collection. The leak profile is the standard library detector and cannot diagnose every stuck handler.

### Metrics facade
- rust: crates/headgate/src/worker.rs::a_sweep_that_deleted_rows_says_so
- rust: crates/headgate/src/worker.rs::an_empty_sweep_stays_quiet
Expand Down
11 changes: 6 additions & 5 deletions conformance/TEST_INVENTORY.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ rust crates/headgate/tests/subscriptions.rs 2
rust crates/headgate/tests/task_data.rs 2
rust crates/headgate/tests/tracked_tasks.rs 5
go go/admission_unit_test.go 1
go go/batch_handler_test.go 3
go go/batch_handler_test.go 4
go go/circuit_breaker_test.go 4
go go/client_test.go 4
go go/cronspec_test.go 4
Expand All @@ -97,15 +97,16 @@ go go/driver/headgateredis/inspect_test.go 3
go go/driver/headgateredis/store_test.go 8
go go/enqueue_middleware_test.go 4
go go/fingerprint_test.go 2
go go/headgateapi/api_test.go 22
go go/headgateapi/api_test.go 23
go go/headgatecrypto/crypto_test.go 3
go go/headgatectl/main_test.go 1
go go/headgatectl/main_test.go 2
go go/headgatemigrate/cmd/hg-migrate/main_test.go 5
go go/headgatemigrate/live_mysql_test.go 2
go go/headgatemigrate/live_postgres_test.go 1
go go/headgatemigrate/migrate_test.go 4
go go/headgateotel/otel_test.go 2
go go/headgateshared/codec_test.go 4
go go/headgateshared/json_v2_test.go 2
go go/headgateshared/log_test.go 3
go go/headgatetest/batch_handler_test.go 1
go go/headgatetest/client_from_context_test.go 3
Expand All @@ -128,10 +129,10 @@ go go/plugin_test.go 3
go go/postgressql/namespace_test.go 4
go go/progress_test.go 2
go go/result_test.go 2
go go/runtime_test.go 14
go go/runtime_test.go 17
go go/schedulespec_test.go 1
go go/subscription_test.go 2
go go/task_data_test.go 1
go go/task_data_test.go 3
go go/tracecontext_test.go 4
go go/validate_test.go 10
sh scripts/test-admission.sh 547
80 changes: 80 additions & 0 deletions docs/benchmarks/go127-20260902/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 129189 1825 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 127676 1898 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 201837 1180 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 131478 1758 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 131521 1864 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 201735 1188 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 121776 1806 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 131298 1812 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 196459 1179 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 125052 1780 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 128444 1859 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 199689 1215 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 132097 1775 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 126903 1816 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 206232 1181 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 133269 1751 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 129523 1833 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 203760 1173 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 133440 1782 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 132100 1830 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 205899 1187 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 135367 1787 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 131401 1821 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 205000 1188 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 132212 1763 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 129570 1844 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 205252 1194 ns/op 1248 B/op 3 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 132861 1759 ns/op 1120 B/op 3 allocs/op
BenchmarkTypedDispatch1K 132075 1839 ns/op 1280 B/op 4 allocs/op
BenchmarkMarshalArgs1K 196597 1197 ns/op 1248 B/op 3 allocs/op
PASS
24 changes: 24 additions & 0 deletions docs/benchmarks/go127-20260902/legacy-json-vs-default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
│ legacy-json.txt │ default.txt │
│ sec/op │ sec/op vs base │
DecodeArgs1K 5.981µ ± 1% 1.778µ ± 2% -70.28% (p=0.000 n=10)
TypedDispatch1K 6.042µ ± 1% 1.836µ ± 2% -69.61% (p=0.000 n=10)
MarshalArgs1K 1.448µ ± 2% 1.188µ ± 1% -17.99% (p=0.000 n=10)
geomean 3.740µ 1.571µ -58.00%

│ legacy-json.txt │ default.txt │
│ B/op │ B/op vs base │
DecodeArgs1K 1.320Ki ± 0% 1.094Ki ± 0% -17.16% (p=0.000 n=10)
TypedDispatch1K 1.477Ki ± 0% 1.250Ki ± 0% -15.34% (p=0.000 n=10)
MarshalArgs1K 1.172Ki ± 0% 1.219Ki ± 0% +4.00% (p=0.000 n=10)
geomean 1.317Ki 1.186Ki -9.99%

│ legacy-json.txt │ default.txt │
│ allocs/op │ allocs/op vs base │
DecodeArgs1K 8.000 ± 0% 3.000 ± 0% -62.50% (p=0.000 n=10)
TypedDispatch1K 9.000 ± 0% 4.000 ± 0% -55.56% (p=0.000 n=10)
MarshalArgs1K 2.000 ± 0% 3.000 ± 0% +50.00% (p=0.000 n=10)
geomean 5.241 3.302 -37.00%
80 changes: 80 additions & 0 deletions docs/benchmarks/go127-20260902/legacy-json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 39598 5979 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 39650 6107 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 168183 1449 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 39522 5983 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 39613 6043 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 167858 1443 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 40575 6037 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 38998 6183 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 162414 1493 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 39621 6013 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 40065 6002 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 167923 1443 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 39369 6042 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 39805 6040 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 168828 1445 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 40070 5969 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 39417 6101 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 165369 1475 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 39558 5964 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 40039 5995 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 168151 1445 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 40399 5921 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 39837 6015 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 164977 1447 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 40203 5955 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 40221 6004 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 168115 1450 ns/op 1200 B/op 2 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
BenchmarkDecodeArgs1K 40054 6031 ns/op 1352 B/op 8 allocs/op
BenchmarkTypedDispatch1K 39528 6076 ns/op 1512 B/op 9 allocs/op
BenchmarkMarshalArgs1K 166473 1460 ns/op 1200 B/op 2 allocs/op
PASS
26 changes: 26 additions & 0 deletions docs/benchmarks/go127-20260902/previous-allocator-vs-default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
goos: darwin
goarch: arm64
pkg: github.com/mujhtech/headgate/go
cpu: Apple M2 Pro
│ previous-allocator.txt │ default.txt │
│ sec/op │ sec/op vs base │
DecodeArgs1K 1.778µ ± 3% 1.778µ ± 2% ~ (p=0.493 n=10)
TypedDispatch1K 1.860µ ± 1% 1.836µ ± 2% ~ (p=0.055 n=10)
MarshalArgs1K 1.192µ ± 2% 1.188µ ± 1% ~ (p=0.361 n=10)
geomean 1.580µ 1.571µ -0.57%

│ previous-allocator.txt │ default.txt │
│ B/op │ B/op vs base │
DecodeArgs1K 1.094Ki ± 0% 1.094Ki ± 0% ~ (p=1.000 n=10) ¹
TypedDispatch1K 1.250Ki ± 0% 1.250Ki ± 0% ~ (p=1.000 n=10) ¹
MarshalArgs1K 1.219Ki ± 0% 1.219Ki ± 0% ~ (p=1.000 n=10) ¹
geomean 1.186Ki 1.186Ki +0.00%
¹ all samples are equal

│ previous-allocator.txt │ default.txt │
│ allocs/op │ allocs/op vs base │
DecodeArgs1K 3.000 ± 0% 3.000 ± 0% ~ (p=1.000 n=10) ¹
TypedDispatch1K 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹
MarshalArgs1K 3.000 ± 0% 3.000 ± 0% ~ (p=1.000 n=10) ¹
geomean 3.302 3.302 +0.00%
¹ all samples are equal
Loading