From a36858f36c45ca538633944e3bbb33772a30bdcd Mon Sep 17 00:00:00 2001 From: Sanaei Date: Wed, 25 Nov 2026 11:02:24 +0330 Subject: [PATCH] chore(ci): run the real-core tests in CI The tests gated on XRAY_E2E_BINARY start the core pinned in go.mod as a child process and drive its gRPC API: user add and remove, hot apply, balancer overrides, the REALITY probe and the AmneziaWG relay. No job set the variable, so they skipped in every run and a green CI had never touched the core. `make xray-e2e` builds that core from the module cache and runs every package holding such a test; the new job fails when one of them still skips for want of the binary. The reviewer and analyst context files said these tests never run in CI and now name the job that does. --- .github/claude/issue-analyst-context.md | 6 ++++-- .github/workflows/ci.yml | 16 ++++++++++++++++ CLAUDE.md | 8 +++++--- Makefile | 8 ++++++++ REVIEW.md | 3 ++- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.github/claude/issue-analyst-context.md b/.github/claude/issue-analyst-context.md index 0234460f0..6c755c65d 100644 --- a/.github/claude/issue-analyst-context.md +++ b/.github/claude/issue-analyst-context.md @@ -148,6 +148,7 @@ It is paths-filtered, so a docs-only or workflow-only change produces no run. | `go-test` | `go test -shuffle=on -count=1` over every package except `frontend/node_modules` | | `race` | the same set under `-race -shuffle=on` | | `postgres-durable-first` | live PostgreSQL 16: the `PostgresCommitFailure` tests plus `TestHostAutoMigrateCreatesColumns_Postgres` and `TestMigrate_Postgres`. Both steps COUNT passes rather than assert on SKIP, so a renamed or deleted test fails the job | +| `xray-e2e` | `make xray-e2e`: the `XRAY_E2E_BINARY` tests in `internal/xray/`, `internal/web/service/` and `internal/amneziawgnet/` against the core pinned in `go.mod`, run as a real child process. A skip naming the binary fails the job | | `govulncheck` | known vulnerabilities | | `golangci` | `golangci-lint` | | `fuzz-smoke` | 30s each on `FuzzParseLink` and `FuzzDecodeCertPin` | @@ -155,13 +156,14 @@ It is paths-filtered, so a docs-only or workflow-only change produces no run. | `frontend` | lint, format:check, typecheck, `npm test` (Vitest + headless-Chromium Storybook), build, build-storybook, `npm audit` | **What CI does NOT prove.** These test families `t.Skip` unless an environment -variable is set, and CI sets only the PostgreSQL ones above: +variable is set. CI sets the PostgreSQL ones in `postgres-durable-first` and +`XRAY_E2E_BINARY` in `xray-e2e` only, so every other job still skips them: | gate | covers | | --- | --- | | `XUI_TEST_PG_DSN` | PostgreSQL-specific paths | | `XUI_DB_TYPE` + `XUI_DB_DSN` | dialect-dependent behaviour | -| `XRAY_E2E_BINARY` | the Xray gRPC end-to-end tests in `internal/xray/` | +| `XRAY_E2E_BINARY` | the real-core tests: Xray gRPC API, hot apply, balancer overrides, the AmneziaWG relay | | `XUI_SCALE_TEST` | scale tests in `internal/sub/`, `internal/web/job/`, `internal/web/service/` | Mutation testing (`mutation.yml`) runs nightly and never on a pull request, so a diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c856c11ec..d4e2337f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -282,6 +282,22 @@ jobs: make node-e2e 2>&1 | tee /tmp/node-e2e.log if grep -q -- '--- SKIP' /tmp/node-e2e.log; then echo "node-e2e skipped"; exit 1; fi + # The core pinned in go.mod as a real child process, driven over its gRPC API. + # A skip naming the binary means it was never handed over, so it fails the job. + xray-e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: go.mod + cache: true + - name: Real core end to end + run: | + set -o pipefail + make xray-e2e 2>&1 | tee /tmp/xray-e2e.log + if grep -q -- '_test.go:[0-9]*: .*XRAY_E2E_BINARY' /tmp/xray-e2e.log; then echo "a real-core test skipped"; exit 1; fi + # Brief native-fuzz smoke on the security-/parser-critical decoders. Each runs the # generated corpus plus 30s of exploration; a crash here is a real input-handling bug. fuzz-smoke: diff --git a/CLAUDE.md b/CLAUDE.md index ae2e20e8a..1302608ba 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -200,9 +200,11 @@ reads as a broken repo, not a missing step. Run `make dist-stub` once; every That is the *fast* gate, not all of CI. `ci.yml` also runs `make race`, `make vulncheck`, a live-Postgres job (where a SKIP counts as a failure), -`make node-e2e` (a real master and node panel, `internal/nodee2e/`) and a -30s fuzz smoke on `FuzzParseLink`/`FuzzDecodeCertPin` — run those locally when -you touch DB/dialect, node sync or parser code. Node sync has two layers: every +`make node-e2e` (a real master and node panel, `internal/nodee2e/`), +`make xray-e2e` (the `XRAY_E2E_BINARY` tests against the core pinned in `go.mod`, +run as a real child process) and a 30s fuzz smoke on +`FuzzParseLink`/`FuzzDecodeCertPin` — run those locally when you touch +DB/dialect, node sync, the Xray gRPC API or hot apply, or parser code. Node sync has two layers: every `runtime.Remote` call gets a cell in `internal/web/node_contract_test.go` (fast, in `make test-go`; a method without one fails it), and a multi-tick flow (cron, adopt, node down) gets one in `internal/nodee2e/node_sync_test.go`. diff --git a/Makefile b/Makefile index 9eed80c0e..ac9712a36 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,14 @@ node-e2e: dist-stub ## Master+node sync end to end with two real panel processes go build -o $(NODE_E2E_BIN) . XUI_NODE_E2E_BINARY=$(NODE_E2E_BIN) go test -count=1 -timeout 20m -v ./internal/nodee2e/ +.PHONY: xray-e2e +# The core pinned in go.mod as a real child process; test-go only runs these as skips. +XRAY_E2E_BIN = $(CURDIR)/.cache/xray-e2e/xray$(shell go env GOEXE) +XRAY_E2E_PKGS = $(shell grep -rl --include='*_test.go' 'Getenv("XRAY_E2E_BINARY")' internal | xargs -n1 dirname | sort -u | sed 's|^|./|') +xray-e2e: dist-stub ## Real-core tests against the xray-core pinned in go.mod + go build -o $(XRAY_E2E_BIN) github.com/xtls/xray-core/main + XRAY_E2E_BINARY=$(XRAY_E2E_BIN) go test -count=1 -timeout 20m -v $(XRAY_E2E_PKGS) + .PHONY: test-fe test-fe: ## Frontend tests (vitest) cd $(FRONTEND) && npm test diff --git a/REVIEW.md b/REVIEW.md index 165dac943..93c2dd76c 100644 --- a/REVIEW.md +++ b/REVIEW.md @@ -178,7 +178,8 @@ near-certain about and that actually breaks something: - "CI passed" is a claim too, and needs the same evidence: say it only of a run you actually read. A green one proves less here than it looks — only `postgres-durable-first` runs against PostgreSQL, `go-test` and `race` are - SQLite, and `XRAY_E2E_BINARY` and `XUI_SCALE_TEST` are set by no job, so + SQLite, only `xray-e2e` starts the real core (the gRPC API and hot-apply + tests skip in every other job), and `XUI_SCALE_TEST` is set by no job, so those tests have never run in CI at all. Where a change touches dialect, migration or Xray gRPC code that no job exercised, say it is unverified rather than repeating a green tick as proof.