phamnazage-jpg
047ddca92c
docs(portal): record codegraph workspace integration + OMP AGENTS.md refresh
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
2026-06-03 13:29:28 +08:00
Hermes Agent
56474264d6
refactor(portal): dedup inline scripts in accounts + batch-import + providers
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
All three admin pages had two parallel inline <script> blocks (a modern S1
that used adminRuntime + a legacy S2 that was self-contained). Both had
a nested <script> text inside S1 that the browser tolerated only because
the second script re-ran any state-affecting calls. Merge into a single
inline script per page; fix the nested <script> comment.
- providers.html: 100371 -> 62761 chars (-37610, -37%)
- accounts.html: 54878 -> 33098 chars (-21780, -40%)
- batch-import: 43861 -> 26570 chars (-17291, -39%)
Also rename draftProviderIDInput -> providerIDInput in providers.html
(the old draft-provider-id input was removed during the earlier workflow
merge, leaving the script with a null addEventListener on draft id).
All scripts pass node --check. Both test_tksea_portal_assets.sh and
verify_frontend_smoke.sh PASS.
2026-06-03 13:14:31 +08:00
phamnazage-jpg
09f7c07de3
feat(portal): make provider/batch-import form fields self-explanatory + auto-fill
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
Problem: provider manifest form had all-empty fields with cryptic
placeholders, users had to know what model IDs to type.
Fix on /portal/admin/providers.html (Provider Manifest 草稿):
- DISPLAY NAME: datalist of common vendors (OpenAI / DeepSeek /
硅基流动 / Moonshot / 智谱 / Anthropic / 零一万物 / MiniMax / Qwen / Baichuan / 混元)
- PLATFORM: datalist of common platforms (openai / openai-compatible /
deepseek / anthropic / gemini / zhipu / moonshot / minimax / qwen / ...)
- SMOKE TEST MODEL: datalist of common smoke models + auto-fills with
first model from MODELS field if user leaves it empty
- BASE URL PLACEHOLDER: datalist of common base URLs (12 presets)
- MODELS: chip-row of 11 common models (gpt-5.4, gpt-5.4-mini,
deepseek-chat, MiniMax-M2.7-highspeed, kimi-k2.6, glm-4.6,
claude-sonnet-4-5, gemini-2.5-pro, qwen3-coder-plus, gpt-4o, o4-mini)
+ clear button. Click chip → append to MODELS field (dedup).
- KEYS textarea: 6 rows + example placeholder (sk-example-1/2/3)
Fix on /portal/admin-batch-import.html (发起导入):
- HOST ID: datalist of common host_ids + hint about loading pack first
- ENTRIES textarea: 6 rows + multi-line hint explaining
base_url|api_key|model1,model2 format, optional model, batch import
JS change: syncDraftHelperState() in providers.html now auto-fills
smoke_test_model with first model if user hasn't filled it yet.
Also fixed: 2 duplicate copies of syncDraftHelperState (from
earlier batch script restoration) — both now have the new logic.
Verification:
- bash scripts/test/test_tksea_portal_assets.sh → PASS
- bash scripts/test/verify_frontend_smoke.sh → PASS
- browser_console click test: gpt-5.4 + deepseek-chat + kimi-k2.6 chips
→ models='gpt-5.4,deepseek-chat,kimi-k2.6' + smoke='gpt-5.4' auto-fill ✓
- screenshot: /tmp/portal-screenshots/admin-providers-v5.png
2026-06-03 11:24:54 +08:00
phamnazage-jpg
122d6282e1
fix(portal): unify all input/select/textarea/label/button/table styles via global fallback
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
Root cause: only admin/index.html had explicit .input / .select / .label classes.
100+ inputs across logical-groups / route-health / accounts / providers /
admin-batch-import + public portal had no class → browser default styling →
页面看起来「未统一」。
Fix:
- portal.css: add global rules that auto-apply design system styling to
any input/select/textarea/label/button/table that doesn't opt out
via .raw-input / .field-label. The existing .input / .select /
.label / .btn classes still win (same styles, just explicit).
- portal.js: detectInitialTheme() now respects HTML's data-theme
attribute first (page author intent), then localStorage, then OS
preference. This makes admin pages' explicit data-theme="dark"
actually stick instead of being overridden.
- admin/index.html: h3 标题 8 个 article 统一用 class="card-title"
(前 4 个 inline 15px / 后 3 个 inline 16px 已统一)
- 6 admin pages: 修复 critical HTML 结构 bug — 之前 batch 处理的
残留让 <link> 和 <style> 嵌套在 <style>:root{} 块内,浏览器
解析时直接忽略,导致所有 stylesheet 不加载、整个页面无样式
Verification:
- bash scripts/test/test_tksea_portal_assets.sh → PASS
- bash scripts/test/verify_frontend_smoke.sh → PASS
- 8 张 screenshot v4 在 /tmp/portal-screenshots/ (各 600KB-1.2MB)
- 浏览器实测:3 stylesheets 加载,103 个 input 全部 38px/12px 圆角输入框
35 个 label 全部 12px uppercase slate-400
6 个 select 全部 38px + 自定义箭头
2026-06-03 11:05:10 +08:00
phamnazage-jpg
e804a830a0
docs(portal): record 2026-06-03 frontend visual upgrade + design system runbook
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
- EXECUTION_BOARD.md: new 2026-06-03 entry with full evidence trail
(asset tests, browser smoke, screenshot list, conclusion=已闭环)
- 2026-06-03-FRONTEND-DESIGN-SYSTEM-RUNBOOK.md (new, 10KB):
* file structure + design token quick reference
* standard page skeleton + component API (stat-card, statusbar,
Portal.icons, Portal.toast, Portal.copyText, Portal.theme,
Portal.renderModernAdminNav)
* test-contract string rules (70+ strings must remain in HTML)
* common pitfalls (duplicate <!doctype>, duplicate const AdminCommon,
stat-card ID drift, accidental script removal)
* submission workflow + screenshot evidence commands
2026-06-03 09:11:18 +08:00
phamnazage-jpg
cc8fc900ca
refactor(portal): migrate 8 pages to portal.css+portal.js design system
...
Each page now uses the new page-hero + stat-card + statusbar pattern
with the Linear/Vercel-aligned token system, while preserving all
admin-common.js nav render contract and 70+ test-contract strings.
- public portal: index.html (1816 → 1280 lines)
- admin entry: admin/index.html
- admin pages: logical-groups / route-health / accounts / providers
- batch import: admin/batch-import.html (39-line redirect to
admin-batch-import.html for legacy URL compatibility)
- admin-batch-import.html: real legacy URL handler page
Verified:
- bash scripts/test/test_tksea_portal_assets.sh → PASS
- bash scripts/test/verify_frontend_smoke.sh → PASS (all 7 admin
pages + public portal render with smoke-admin / Smoke Logical
Group / Smoke Provider Account / smoke-route-primary visible)
- 8 screenshot artifacts at /tmp/portal-screenshots/ (1440×2400
chromium headless, 269KB–1.2MB each = real content)
2026-06-03 09:11:07 +08:00
phamnazage-jpg
3a9061e11d
style(portal): add design system + shared layer (portal.css/portal.js/admin-common.css shim)
...
- portal.css: 777-line real design system (Linear/Vercel 信息建筑派)
* tokens: spacing 4/8/12/16/24/32/48, type 12/13/14/15/17/20/24/32/44
* colors: ink/paper/accent/success/warn/danger × 50/100/500/900
* teal #14b8a6 1:1 aligned with host sub2api Vue/Tailwind
* dark-first; light override for public portal
* components: page-hero, stat-card, card, status, pill, btn-primary,
toast-host, empty, skeleton, drawer, tabs
- portal.js: window.Sub2ApiPortal — toast, lucide 1.75px stroke SVG
icon registry (shield/group/activity/route/health/account/provider/
import/check/x/alert/info/copy/edit/trash/plus/refresh/...),
copyToClipboard, theme auto/dark/light, drawer, renderModernAdminNav
- admin-common.css: 4KB legacy shim — maps old class names
(.topnav/.primary/.secondary/.ghost/.danger/.metric/.statusbar/.stat/
.eyebrow/.hero-points/.page-hero__eyebrow/.shell/.fade-in/.topline/
.chip/.tag/.mono/.meta-card/.meta-label/.status-pill/.inline-code/
.tone-*) onto new tokens without breaking admin-common.js nav contract
Evidence:
- bash scripts/test/test_tksea_portal_assets.sh → PASS (70+ string assertions)
- bash scripts/test/verify_frontend_smoke.sh → PASS (chromium headless 7 pages)
2026-06-03 09:10:45 +08:00
phamnazage-jpg
35447be934
feat(deploy): add CRM-only online deployment to remote43
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
- scripts/deploy/deploy_crm_only.sh: 单进程部署 sub2api-cn-relay-manager
CRM 控制面到 remote43,不依赖 sub2api host / PG / Redis 容器。
复用 scripts/deploy/remote43_patched_stack_lib.sh 的 env 渲染
(render_remote43_crm_env),render_crm_only_bootstrap 用 $\{VAR\} 占位符 +
sed 注入避开 set -u + unquoted-heredoc 边缘问题。
部署前先 kill 老进程 (再 scp 二进制) 避免 ELF overwrite 失败。
- docs/DEPLOYMENT.md: 加 '在线部署节点' 段,记录 stack / 端口 / 入口 / 验证。
- docs/EXECUTION_BOARD.md: 顶部加 'Latest Online Stack' 段。
- artifacts/online-deploy-20260602/: 本次真实部署的证据
- 01-local-build.txt: 本地 server 二进制 md5 + git head
- 02-remote-inspect.txt: 远端 process / port / db tables
- 03-crm-api-checks.txt: /healthz /api/packs /api/hosts /metrics 真实响应
- 04-portal-public.txt: sub.tksea.top 公共入口
- 05-quality-gates.txt: gofmt / vet / test -race / integration
- manifest.json: 结构化汇总
验证(2026-06-02 21:32-21:43):
- /healthz: HTTP 200 'ok'
- /api/packs (Bearer): HTTP 200 '{"packs":[]}'
- /api/hosts (Bearer): HTTP 200 '{"hosts":[]}'
- /api/packs (no auth): HTTP 401
- /metrics (Prometheus): HTTP 200,含 active_hosts/active_providers/
db_connections_active + Go runtime
- sub.tksea.top/portal/: HTTP 200
- sub.tksea.top/portal-admin-api/healthz: HTTP 200 'ok'(反代到 CRM)
- go test -race ./internal/... ./tests/integration/...: PASS
- gofmt / go vet: 干净
2026-06-02 21:46:39 +08:00
phamnazage-jpg
4ec9dad44f
test: 修 build-broken edge-case 测试
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
- internal/store/sqlite/edge_cases_test.go: 把错误的 sqlite.New 调用换成
实际存在的 sqlite.Open(ctx, dsn),清掉阻塞 `go test ./internal/...`
的 build 失败
- internal/host/sub2api/edge_cases_test.go: gofmt
- internal/worker/runner_extra_test.go: TestRunnerLoggerCalled 加
sync.Mutex 保护 logger 写入的共享状态;测试结束前 cancel 并留 20ms
flush 窗口,避免 -race 检测到 goroutine 仍在写
验证: gofmt -l . 干净,go vet ./... 零警告,
go test -race -count=1 ./internal/... 全包通过,集成测试通过
2026-06-02 20:38:29 +08:00
phamnazage-jpg
f6600d663a
feat(monitoring): add complete Prometheus + Grafana monitoring stack
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
Add production-ready monitoring infrastructure:
- 15 alerting rules (4 Critical + 11 Warning)
- Grafana dashboard with service health panels
- Full documentation with deployment guide
Covers: service availability, error rates, latency,
routing health, database connections, and log metrics
2026-06-02 19:54:38 +08:00
phamnazage-jpg
fb32deb2b1
docs: 更新验证报告,记录 metrics 端点修复
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
2026-06-02 07:22:24 +08:00
phamnazage-jpg
5e3bd44e96
fix(metrics): 在主路由中注册 /metrics 端点
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
- 添加 metrics 包导入
- 在主 handler 中注册 GET /metrics 路由
2026-06-02 07:22:01 +08:00
phamnazage-jpg
278991bc9d
docs: 添加生产上线全面验证报告
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
2026-06-02 07:17:37 +08:00
phamnazage-jpg
8bbdffaf17
test: 补充真实功能验证测试
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
- ErrorMetrics 并发安全测试
- AsyncLogWriter 错误指标真实记录测试
- HTTP Server 超时配置真实验证
- Prometheus 指标 HTTP 端点真实测试
- 日志文件输出真实写入测试
2026-06-02 07:07:53 +08:00
phamnazage-jpg
28f377f2bd
feat(api): M-04 添加版本信息端点
...
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled
- 添加 /version 端点返回版本信息
- 版本变量支持构建时 ldflags 注入
- 返回 version、commit、build_time、go_version
2026-06-02 07:00:15 +08:00
phamnazage-jpg
133da2d442
test: M-03 添加边界测试
...
- 添加大量数据边界测试(100条记录)
- 添加特殊字符 PackID 边界测试
- 添加空字段验证边界测试
2026-06-02 06:58:45 +08:00
phamnazage-jpg
b69cb9166e
refactor: M-02 添加 errs 包提供错误处理基础设施
2026-06-02 06:57:13 +08:00
phamnazage-jpg
08f7db1bc2
test: M-01 替换测试代码中的 panic 为 t.Fatal
...
- packs_repo_test.go: panic → t.Fatal
- providers_repo_test.go: panic → t.Fatal
2026-06-02 06:56:30 +08:00
phamnazage-jpg
21065735dd
fix(docker): H-05 优化 Dockerfile 环境变量配置
...
- 添加清晰的注释说明 SUB2API_CRM_ADMIN_TOKEN 为必需配置
- 分离必需和可选环境变量到不同区块
- 更新 Go 版本到 1.23 以匹配 go.mod
2026-06-02 06:55:36 +08:00
phamnazage-jpg
d688722dd2
feat(metrics): H-04 Prometheus 指标暴露
...
- 创建 internal/metrics 包集成 Prometheus 客户端
- 添加 HTTP 请求指标(总量、延迟直方图)
- 添加业务指标(active_hosts、active_providers)
- 添加路由指标(decisions、failovers)
- 添加数据库指标(connections、operations)
- 添加日志指标(flush_errors、dropped_events)
- 添加 HTTP Middleware 自动收集请求指标
- 添加 StartServer 方法启动独立 metrics 服务
2026-06-02 06:53:24 +08:00
phamnazage-jpg
8984451845
feat(log): H-03 日志 flush 错误监控
...
- 添加 ErrorMetrics 结构体记录 flush/write/drop 错误数
- 添加 ErrorHandler 回调接口用于自定义错误处理
- 在 AsyncLogWriterOptions 中支持配置错误处理器
- 在 flushBatch 中记录 flush 错误指标并回调错误处理器
- 在 enqueue fallback 路径中记录丢弃事件数
- 添加 Metrics() 方法暴露错误统计
2026-06-02 06:51:14 +08:00
phamnazage-jpg
97502b8a86
test: H-02 补充 migrations 测试
...
- 验证迁移文件正确嵌入 embed.FS
- 测试所有迁移文件可读且非空
- 验证迁移文件命名规范(NNNN_前缀)
- 测试迁移文件排序一致性
- 验证初始迁移文件包含预期 SQL 内容
2026-06-02 06:50:02 +08:00
phamnazage-jpg
3838d78b00
test: H-01 补充 testutil 测试
...
- 添加 SQLiteTestDSN 函数测试(外键启用/禁用、特殊字符)
- 添加路径唯一性验证测试
- 添加 OpenSQLiteStore 功能测试(含并发测试)
- 添加 CloseSQLiteStore 测试
- 添加无效 DSN 错误处理测试
2026-06-02 06:49:07 +08:00
phamnazage-jpg
6865b3a33b
ci: B-04 添加 GitHub Actions CI/CD 工作流
...
- 添加完整的 CI 流水线:构建、测试、覆盖率检查
- 集成 golangci-lint 静态代码分析
- 集成 gosec 和 govulncheck 安全扫描
- 添加 Docker 镜像构建验证
- 添加 Release 自动打包(多架构支持)
- 设置覆盖率阈值 60%
2026-06-02 06:47:06 +08:00
phamnazage-jpg
cf7dd35e1d
feat(log): B-03 日志轮转配置 - 添加 lumberjack 支持
...
- 添加 lumberjack.v2 依赖实现日志轮转
- 支持配置文件输出(stdout/stderr/file)
- 支持文件轮转(100MB/3备份/7天/压缩)
- 添加 Config 结构体灵活配置
- 添加完整测试用例
测试验证:
- TestInitWithConfig PASS
- TestInitWithConfigFileOutput PASS
- TestDefaultConfig PASS
- 全量日志测试通过
2026-06-01 22:06:56 +08:00
phamnazage-jpg
714c4acbe4
fix(log): 修复测试文件未使用导入
2026-06-01 22:03:14 +08:00
phamnazage-jpg
91fa5d6ab4
fix(review): 完成系统性 Review 修复方案 - Task B-01 HTTP Server 超时配置
...
本次提交包含:
- B-01: HTTP Server 添加超时配置 (ReadTimeout/WriteTimeout/IdleTimeout/MaxHeaderBytes)
- 添加结构化日志包 internal/log/ (B-02 部分完成)
- 添加 Review 报告文档
- 添加系统性修复方案文档
- 添加最佳实践审核报告文档
- 更新任务清单和执行板
测试验证:
- TestServerHasTimeoutConfiguration 通过
关联文档:
- docs/2026-06-01-SYSTEMATIC-REVIEW-REPORT.md
- docs/2026-06-01-SYSTEMATIC-REPAIR-PLAN.md
- docs/2026-06-01-BEST-PRACTICE-AUDIT-REPORT.md
2026-06-01 22:02:01 +08:00
phamnazage-jpg
5fbac6ef0b
test(frontend): add provider admin acceptance coverage
...
Add a dedicated acceptance script for providers.html, cover it in the local real-host script regression suite, and document the current frontend review baseline, closure audit, providers action matrix, and remediation task board.
This keeps the frontend acceptance boundary explicit: providers.html now has a repeatable verification entry point for its page-level actions, while non-UI provider operations remain documented as backend-only capabilities.
2026-06-01 09:58:20 +08:00
phamnazage-jpg
c588a95c7d
fix(access): verify subscription readiness with real user keys
...
When subscription access is requested with an explicit access_api_key, assign the subscription to the real target user, bind that user's API key to the subscription group, and probe readiness with the same key instead of falling back to a managed synthetic user.
Update the runtime/reconcile flows, adapter tests, and source-of-truth docs so subscription_ready now reflects user-visible host access rather than managed-key-only closure success.
2026-06-01 09:55:11 +08:00
phamnazage-jpg
702ae19a61
feat(pack): publish provider admin draft provider-admin-publish-1780230107
2026-05-31 20:21:50 +08:00
phamnazage-jpg
fd12838519
docs(testing): record repo upsert closure
2026-05-30 18:54:07 +08:00
phamnazage-jpg
64e14ac30d
test(quality): cover repo upsert fallback branches
2026-05-30 18:54:07 +08:00
phamnazage-jpg
2f2653c76f
docs(testing): record upsert and open branch follow-up
2026-05-30 18:48:20 +08:00
phamnazage-jpg
9e32a24f8c
test(quality): cover upsert validation and redis open branches
2026-05-30 18:48:20 +08:00
phamnazage-jpg
d9216d5712
docs(testing): record narrow branch coverage follow-up
2026-05-30 18:28:03 +08:00
phamnazage-jpg
f895eb9035
test(quality): cover sqlite redis and overlay edge branches
2026-05-30 18:28:03 +08:00
phamnazage-jpg
51472e9951
docs(testing): record hotspot branch coverage uplift
2026-05-30 17:22:25 +08:00
phamnazage-jpg
6bbd55111c
test(quality): cover routing sqlite overlay hotspots
2026-05-30 17:22:11 +08:00
phamnazage-jpg
b33fa10677
test(quality): promote overlay coverage to core gate
2026-05-30 17:13:38 +08:00
phamnazage-jpg
249ad5938f
test(quality): promote sqlite coverage to core gate
2026-05-30 17:04:45 +08:00
phamnazage-jpg
b371c698cc
test(quality): promote routing coverage to core gate
2026-05-30 16:54:05 +08:00
phamnazage-jpg
2a925e2954
test(quality): promote internal app coverage to core gate
2026-05-30 16:48:55 +08:00
phamnazage-jpg
800096542b
docs(testing): record internal app coverage uplift
2026-05-30 16:41:05 +08:00
phamnazage-jpg
cbfaf4a28b
test(app): raise handler coverage above 70 percent
2026-05-30 16:40:55 +08:00
phamnazage-jpg
b5529eb9d4
docs(testing): record unified quality gate rollout
2026-05-30 15:28:58 +08:00
phamnazage-jpg
61a5a36c58
feat(testing): add unified quality gates and coverage baseline
2026-05-30 15:28:32 +08:00
phamnazage-jpg
347389c0a2
chore(skills): add project workflow skills
2026-05-30 14:55:16 +08:00
phamnazage-jpg
17c406b661
docs(skills): capture project learnings as reusable workflows
2026-05-30 14:55:05 +08:00
phamnazage-jpg
0a3828d682
docs(status): record false negative verification
2026-05-30 14:46:20 +08:00
phamnazage-jpg
15b7437edd
feat(status): suppress false negative provider readiness
2026-05-30 14:42:51 +08:00