test(contract): 第2刀c Go 契约快照(/v1/me·usage·UsageEntry)+ Go CI job

支柱 2(契约单源)后端守门 + 两端对账:
- httpapi/contract_test.go:冻结 /v1/me 字段面(12 key,与 Dart _frozenMeKeys 对账,
  注明后端多发 uuid/dp_uuid + expire_at 别名)
- usage/contract_test.go:冻结 /v1/usage(UsagePoint)、/v1/usage/devices
  (DeviceUsagePoint + envelope)字段面
- pb/agentv1/contract_test.go:冻结 agent↔控制面 UsageEntry 字段面
- ci.yml:新增 go-server job(golang:1.25 build+test)——此前 server 测试未进 CI
- 本地:5 契约用例 + 全量 go test ./...(25 包)绿

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-24 23:35:23 +08:00
parent 149aa90cfa
commit 747ceb06f0
4 changed files with 205 additions and 0 deletions
+17
View File
@@ -108,3 +108,20 @@ jobs:
-v "$PWD:/repo" -w /repo \
node:20 \
bash ci/check-codegen-drift.sh
# ── Job 7: Go 服务端(build + test:含契约快照 + sqlite 真库,跳过 integration)──
# 此前 server 测试未进 CI;契约快照(支柱 2)等需在此守门。integration 测试走
# -tags integration(需 docker 起 mysql/redis),不在本 job,由 run_mysql_test.sh 手动跑。
go-server:
name: Go — build + test
runs-on: nas
steps:
- name: Checkout
uses: actions/checkout@v4
- name: go build + test (non-integration)
run: |
docker run --rm \
-v "$PWD/server:/app" -w /app \
golang:1.25 \
bash -c "go build ./... && go test ./..."