Commit Graph

15 Commits

Author SHA1 Message Date
wangjia 8356547c2f test(ci): 第7刀 — CI 依赖缓存(C 效率)
host-mode runner 宿主机持久,给四个拉依赖的 job 挂宿主缓存目录,
消掉每次全量下载:
- go-server / e2e-smoke:挂 $HOME/.cache/pangolin-ci/{gomod,gobuild}
  → /go/pkg/mod + /root/.cache/go-build。
- flutter-client / golden:挂 $HOME/.cache/pangolin-ci/pubcache → /root/.pub-cache。

本地实测 go build:首次 204s(含全量 downloading)→ 二次 1s(0 downloading)。
testcontainers 镜像由 Docker Desktop 宿主层天然缓存,无需额外处理。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 21:25:38 +08:00
wangjia f8f4ee0ce8 test(ci): 第6刀 — CI gate 补全(覆盖率闸 A1 + 集成测试 job A2)
A 类「闸的完整性」:

- A1 覆盖率闸(防断崖,非追高):
  · go-server job 加 -coverprofile,host 侧解析 total,< 30% 失败(当前 34.9%)。
  · flutter-client job 加 --coverage,host 侧 awk 解析 lcov,< 28% 失败(当前 32.7%)。
  阈值留 ~5% 缓冲,只拦回归断崖,不卡日常波动。

- A2 集成测试进 CI(新 go-integration job,Job 10):
  真 mysql:8/redis 经 testcontainers 跑 -tags integration(跨库可移植/按租户
  记账/配额/兑换/节点生命周期/migrate·时区——sqlite 单测覆盖不到的真库行为)。
  · 在 host-mode runner 宿主机直接跑 go(不套 golang 容器):testcontainers 要真
    docker,DooD 在 Docker Desktop(mac)上网络不通;依赖宿主 go + docker。
  · -p 1 串行:一次只起一个 mysql 容器,避免并发压垮 Docker Desktop。

covers/ 覆盖率产物入 .gitignore。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 21:19:34 +08:00
wangjia 62a86c5c0e fix(ci): shellcheck 去掉多余的 shellcheck 命令(预存 bug)
ci-pangolin / Lint — shellcheck (pull_request) Successful in 6s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 20s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 7s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 43s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 5s
ci-pangolin / Go — build + test (pull_request) Successful in 2m19s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 2m11s
ci-pangolin / Golden — 视觉回归 (components + auth) (pull_request) Successful in 33s
koalaman/shellcheck 镜像 ENTRYPOINT 已是 shellcheck;ci.yml 命令又写了一遍,
变成 'shellcheck shellcheck -S warning …',把字面 'shellcheck' 当文件检查→
'openBinaryFile: does not exist' 报错。去掉多余的 shellcheck 即可。
这是 CI 从没跑过、谁都没发现的预存 bug,首次真跑暴露。本地验证去掉后 exit 0。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 18:25:21 +08:00
wangjia dc22328eb4 ci(debug): shellcheck 改挂整个 repo + 加 checkout 诊断
ci-pangolin / Lint — shellcheck (pull_request) Failing after 9s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 18s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 6s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 42s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 4s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 5s
ci-pangolin / Go — build + test (pull_request) Successful in 2m7s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 2m15s
ci-pangolin / Golden — 视觉回归 (components + auth) (pull_request) Successful in 37s
shellcheck 在 mac runner 上 $PWD/deploy 挂载为空(openapi 的 design/server 子路径却
能挂),怀疑 act host checkout 没拉 deploy。改挂 $PWD:/repo(codegen 已证整 repo 挂载
可用)+ 加 ls 诊断,定位 deploy 是否在 checkout 里。整 repo 挂载在 Linux 也对。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 18:21:29 +08:00
wangjia 58e06708f4 test(ci): 闸2 Go go vet 进 CI(支柱-adjacent;golangci-lint 暂受 go1.25 阻)
ci-pangolin / Lint — shellcheck (pull_request) Failing after 15s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 26s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 5s
ci-pangolin / Flutter — analyze + test (pull_request) Failing after 29s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 4s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 5m10s
ci-pangolin / Go — build + test (pull_request) Failing after 5m55s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 14m36s
ci-pangolin / Golden — 视觉回归 (components + auth) (pull_request) Successful in 35s
go-server job 加 go vet ./...(项目工具链,零版本摩擦):
- golangci-lint(errcheck/depguard)暂用不了:其 go1.23 构建 < 项目 go1.25.10,
  报版本错;待 golangci-lint 跟上 go1.25 再上 errcheck(支柱4)+ depguard(import 方向)
- go vet 当前零违规,接进 go build+vet+test 链

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 13:51:41 +08:00
wangjia bb2688cede test(ci): L3 golden 进 CI(components+auth 子集,Linux 权威基线)
L3 视觉回归真进 CI(此前卡 docker daemon 未起 + dirty 纠缠;现启 Docker 落地干净子集):
- 在 ghcr.io/cirruslabs/flutter 容器重生成 components+auth 的 14 张 Linux 权威基线
  (auth_login/connect 三态/quota/smart_card;mac 渲染与 CI Linux 不一致,故钉死 Linux),
  容器内 --update-goldens 后无 flag 复跑幂等通过
- ci.yml 新增 golden job(第9个):flutter test components_golden_test + auth_redesign_golden_test
- 解耦干净:这俩只 import clean widget;stats-overhaul 的 l10n 改动纯新增(现有键未动)
  → 渲染不受影响、不裹挟 dirty;tablet/desktop-stats golden 仍耦合 stats-overhaul,待合并后并入
- docs/test-architecture.html:L3 状态更新为「已进 CI(子集)」

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 13:20:55 +08:00
wangjia dbd183ee00 fix(ci): 修 flutter analyze 闸长期 exit 1(形同虚设)
发现:CI flutter analyze 退出码 1(1204 个 info,0 error/warning),其中 1191 来自
第三方 vendored 包 lucide_icons_patched —— 这道闸一直红/无效。
- analysis_options.yaml:exclude packages/lucide_icons_patched/**(去 1191 噪音)
- ci.yml:flutter analyze --no-fatal-infos(info 是建议级不该硬挡 merge;
  error/warning 仍致命)→ analyze EXIT 0、闸真正可用
- 顺手清 11 个 clean 文件 info:auth_api 删 >>>AUTHLOG 调试 print 残留(+unused sw)、
  account_page/plan_card withOpacity→withValues、vpn_bridge where(is Map)→whereType、
  测试文件删多余 import + final→const
- 剩 2 个 info 在 stats-overhaul dirty 文件(stats_page/device_stat_row),留其合并清
- 验证:flutter analyze --no-fatal-infos EXIT 0(1204→2)、flutter test 48 全过

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 07:39:14 +08:00
wangjia 6bd5c04cba test(ci): 第5刀c e2e-smoke CI job + 文档 L4 状态更新
- ci.yml 新增 e2e-smoke job(golang:1.25 + apt openssl/curl/python3);容器内无
  docker daemon → 脚本走内嵌 miniredis 兜底,无需 docker-in-docker——CI 走的
  正是本机已验证绿的同款路径
- docs/test-architecture.html:L4 从「完全缺·最大缺口」更新为已落地
  scripts/e2e-smoke.sh + server/test/e2e/
- 注:本机无 docker,e2e job 未在真 nas runner 实跑;逻辑等同本机已绿的
  miniredis 路径,首次 CI 运行需观察 apt 包/go module 下载

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 07:06:35 +08:00
wangjia 747ceb06f0 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>
2026-06-24 23:35:23 +08:00
wangjia 149aa90cfa test(contract): 第2刀b Dart 契约快照(stats + /v1 API 字段面冻结)
支柱 2(契约单源)守门 — 堵 mac-stats-0 一类跨进程契约悄悄分叉:
- test/contract/stats_contract_test.dart:冻结 pangolin/vpn/stats payload
  字段面 + status 四值,改契约即测试红、逼同步原生产出端 + 文档
- test/contract/api_contract_test.dart:冻结 /v1/me、/v1/usage、
  /v1/usage/devices 的 snake_case 字段面
- ci.yml:flutter job 测试纳入 test/contract;本地 15 用例全过

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 23:32:00 +08:00
wangjia c34d8d8fb5 test(ci): 第2刀a codegen 漂移检查(token 单源不漂移)
支柱 2(契约单源)守门:
- ci/check-codegen-drift.sh:重生成 pangolin_tokens.gen.dart,与已提交版本
  不一致即失败(改了 CSS 真相源没重生成,或手改了生成物 *.gen.dart)
- ci.yml:新增 codegen-drift job(node:20 镜像,含 git/bash)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 23:28:41 +08:00
wangjia 2bf6701def test(ci): 第1刀 可移植 SQL 扫描硬闸 + 五支柱 PR 自检模板
执行机制四道闸 → 闸4(CI 硬闸) + 评审兜底落地:
- ci/scan-portable-sql.sh:扫 server Go 运行时查询禁用 MySQL 专属构造
  (UTC_TIMESTAMP/UTC_DATE/NOW()/FIELD(/ON DUPLICATE KEY/IFNULL),
  豁免方言层 dialect*.go / _test.go / 注释行;当前 152 文件 0 违规
- ci.yml:新增 portable-sql-scan job;push 触发路径补 server/**
- .gitea/PULL_REQUEST_TEMPLATE.md:可测试性五支柱 + 测试 + 红线自检清单
- 守支柱 3(纯逻辑/IO 分离·双库可移植),见 docs/dev-conventions.html

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 23:25:26 +08:00
wangjia bf81c786b2 chore(deploy): 删除 EC2 部署栈,转向 RackNerd 自建节点栈
EC2(marzban 共存)分发面不再由本仓库管理,全面转向新 VPS 自建。删除:
- deploy/{edge,singbox,xray,certbot,backup,scripts,docker-compose.yml,.env.example,README.md}
- .gitea/workflows/deploy.yml(EC2 自动部署 CD)
- ci/nginx-test.sh(edge nginx 校验)
保留 deploy/{bootstrap,single-node}(新节点初始化 + 全套自建)。

ci.yml 去掉 EC2 相关 job(compose/nginx 校验、edge 镜像构建),
shellcheck 改为校验 bootstrap/single-node 脚本;openapi/脱敏/flutter 不变。
deadman-watch 的"EC2"特指改为"任意常在线主机"。

注:EC2 上正在跑的服务不受影响(仅本仓库不再管理它)。文档(CLAUDE.md、
docs/回滚手册.md、app/kernel/poc/README.md)仍引用旧栈,待单独更新。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 06:55:25 +08:00
wangjia f97ae8186b feat(client): Flutter 逐屏还原 + iPad ≥900 断点 (tsk_gpPXi-icyeOE)
对照 design/ui_kits mobile+tablet 原型逐屏补齐 Flutter 客户端:

- l10n 资源层(strings_zh/en,单显)+ Riverpod 状态层(连接状态机/免费额度/
  节点选择/语言/主题),UI 与数据解耦,mock 数据接 API 不动 UI。
- 连接键严格三态(off 虚线轨道环 / connecting 旋转弧 / on 满环+计时+光晕),
  状态来自 connectionProvider,点击只派发事件——禁止乐观显示。
- 节点页置顶「智能选择」推荐卡(clay 渐变 zap + 推荐胶囊,默认选中);
  免费额度卡(剩余分钟+进度条 ≤3 分钟切 warning + 看广告解锁变绿)。
- Tab 左右滑动切换(手势竞技场仲裁,子页滚动不误触发,200ms 方向感知滑入)。
- iPad/宽屏 ≥900 LayoutBuilder 切侧栏分栏(导航行高 ≥48,连接页双栏/节点双列网格),
  复用同一批原子组件,不 fork 页面。
- 语义 token 零硬编码;文案全部走 l10n;套餐数字对齐 §7;无支付表单/emoji 国旗。
- CI 红线词扫描扩展到 client/lib;新增 Flutter analyze+test CI 任务。
- 测试:连接状态机/额度/节点单测、连接键三态与卡片组件测试、
  golden(连接键三态/推荐卡/额度卡 × 明暗)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 14:32:36 +08:00
wangjia c92cd11cc5 feat: CI 流水线 — lint + 单测 + OpenAPI 校验 + 脱敏扫描 + 镜像构建 [tsk_P5b5nIrEsfrV]
新增 .gitea/workflows/ci.yml 五个 Job:
  1. lint        — shellcheck -S warning 扫描全部 deploy/ shell 脚本
  2. unit-test   — docker-compose config 语法校验 + nginx -t(桩证书)
  3. openapi-check — openapi-spec-validator 验证 design/server/openapi.yaml
  4. redline-scan  — ci/scan-redline.sh 扫描 UI 文案红线词(design/ jsx/dart/html)
  5. image-build   — docker build pangolin-edge:ci

附带:
  - ci/scan-redline.sh:脱敏扫描脚本,过滤注释行与外部渠道 handle
  - ci/nginx-test.sh:自签桩证书 + nginx -t,CI 免依赖真实 Let's Encrypt
  - design/server/openapi.yaml:依据 ARCHITECTURE.md §3 展开的 OAS 3.0 完整契约
  - dparts.jsx / parts.jsx:修复 killSwitchSub EN 文案「the VPN drops」红线词
    → 改为「connection drops」(行为描述,不提产品类别)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 01:19:28 +08:00