ci(engineering): Gitea Actions 门禁 + 前端测试设施 + 版本注入修复
CI / Backend (go vet + test) (push) Canceled after 0s
CI / Frontend (lint + build + test) (push) Canceled after 0s

- .gitea/workflows/ci.yml:后端 gofmt/vet/test + 前端 lint/test/build 双 job 门禁
- vitest + @testing-library + jsdom 落地,14 个命脉用例:useListQuery 乱序丢弃/卸载中止、
  http.ts 401 单飞刷新+队列重放+失败登出+silent 直拒、审计防抖、StepDeploy 部署目标、query-utils
- 版本注入断裂修复:main 补 buildTime/gitCommit 符号,build.sh/Dockerfile 注入 main.version,
  /health 返回真实版本,前端 package.json 版本对齐 2.0.0
- gofmt 清零(8 个存量未格式化文件)
This commit is contained in:
opsx committed 2026-10-29 13:02:19 +08:00
1 parent 2975452c21
commit 4f74fe6c3f
23 files changed
+1399 -77

No files matched your search

+7 -7
View File
@@ -67,13 +67,13 @@ func TestInferAuditFieldsFiveSegments(t *testing.T) {
// 语义化动作不能被位置解析覆盖
func TestInferAuditFieldsSemanticActions(t *testing.T) {
cases := map[string]string{
"/api/v1/deployments/1/deploy": "deploy",
"/api/v1/deployments/1/stop": "stop",
"/api/v1/collectors/2/install": "install",
"/api/v1/collectors/2/uninstall": "uninstall",
"/api/v1/users/3/reset-password": "reset-password",
"/api/v1/hosts/2/validate": "validate",
"/api/v1/storage/1/test": "test",
"/api/v1/deployments/1/deploy": "deploy",
"/api/v1/deployments/1/stop": "stop",
"/api/v1/collectors/2/install": "install",
"/api/v1/collectors/2/uninstall": "uninstall",
"/api/v1/users/3/reset-password": "reset-password",
"/api/v1/hosts/2/validate": "validate",
"/api/v1/storage/1/test": "test",
}
for path, want := range cases {
if _, action, _, _ := inferAuditFields(http.MethodPost, path); action != want {
+7 -7
View File
@@ -13,18 +13,18 @@ import (
// ipLimiter 内存滑动窗口 IP 限流(简化实现)。
// 用于登录防爆破:超限返回 429。单实例部署下内存实现即可,无需外部存储。
type ipLimiter struct {
mu sync.Mutex
window time.Duration
max int
hits map[string][]time.Time
mu sync.Mutex
window time.Duration
max int
hits map[string][]time.Time
lastSweep time.Time
}
func newIPLimiter(max int, window time.Duration) *ipLimiter {
return &ipLimiter{
window: window,
max: max,
hits: make(map[string][]time.Time),
window: window,
max: max,
hits: make(map[string][]time.Time),
}
}