- 08 Feb, 2026 1 commit
-
-
yangjianbo authored
系统性地修复、补充和强化项目的自动化测试能力: 1. 测试基础设施修复 - 修复 stubConcurrencyCache 缺失方法和构造函数参数不匹配 - 创建 testutil 共享包(stubs.go, fixtures.go, httptest.go) - 为所有 Stub 添加编译期接口断言 2. 中间件测试补充 - 新增 JWT 认证中间件测试(有效/过期/篡改/缺失 Token) - 补充 rate_limiter 和 recovery 中间件测试场景 3. 网关核心路径测试 - 新增账户选择、等待队列、流式响应、并发控制、计费、Claude Code 检测测试 - 覆盖负载均衡、粘性会话、SSE 转发、槽位管理等关键逻辑 4. 前端测试体系(11个新测试文件,163个测试用例) - Pinia stores: auth, app, subscriptions - API client: 请求拦截器、响应拦截器、401 刷新 - Router guards: 认证重定向、管理员权限、简易模式限制 - Composables: useForm, useTableLoader, useClipboard - Components: LoginForm, ApiKeyCreate, Dashboard 5. CI/CD 流水线重构 - 重构 backend-ci.yml 为统一的 ci.yml - 前后端 4 个并行 Job + Postgres/Redis services - Race 检测、覆盖率收集与门禁、Docker 构建验证 6. E2E 自动化测试 - e2e-test.sh 自动化脚本(Docker 启动→健康检查→测试→清理) - 用户注册→登录→API Key→网关调用完整链路测试 - Mock 模式和 API Key 脱敏支持 7. 修复预存问题 - tlsfingerprint dialer_test.go 缺失 build tag 导致集成测试编译冲突 Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
- 07 Feb, 2026 2 commits
-
-
yangjianbo authored
SSE 热路径中 replaceModelInSSELine 和 replaceModelInResponseBody 原来 使用 json.Unmarshal/Marshal 对每个事件做全量反序列化再序列化,现改为 gjson.Get/sjson.Set 精确字段操作,消除 O(n) 中间 map 分配,保持 JSON 字段顺序不变。涉及 OpenAIGatewayService 和 GatewayService 两个服务。 新增 23 个单元测试覆盖:顶层/嵌套 model 替换、不匹配跳过、空行/[DONE]/ 非法 JSON 等边界情况。 Fixes: P1-08 Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
erio authored
Key changes: - Upgrade model mapping: Opus 4.5 → Opus 4.6-thinking with precise matching - Unified rate limiting: scope-level → model-level with Redis snapshot sync - Load-balanced scheduling by call count with smart retry mechanism - Force cache billing support - Model identity injection in prompts with leak prevention - Thinking mode auto-handling (max_tokens/budget_tokens fix) - Frontend: whitelist mode toggle, model mapping validation, status indicators - Gemini session fallback with Redis Trie O(L) matching - Ops: enhanced concurrency monitoring, account availability, retry logic - Migration scripts: 049-051 for model mapping unification
-
- 06 Feb, 2026 1 commit
-
-
yangjianbo authored
将流式响应中 bufio.Scanner 的 64KB buffer 从每次 make 分配改为 sync.Pool 复用,统一切片表达式为 [:0]、变量命名为 scanBuf, 并补充对应的单元测试。 Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
- 02 Feb, 2026 1 commit
-
-
song authored
-
- 20 Jan, 2026 2 commits
-
-
yangjianbo authored
- Update/BulkUpdate 按不可调度字段触发缓存刷新 - GatewayCache 支持多前缀会话键清理 - 模型路由与混合调度优化粘性会话处理 - 补充调度与缓存相关测试覆盖
-
yangjianbo authored
- Update/BulkUpdate 按不可调度字段触发缓存刷新 - GatewayCache 支持多前缀会话键清理 - 模型路由与混合调度优化粘性会话处理 - 补充调度与缓存相关测试覆盖
-
- 19 Jan, 2026 1 commit
-
-
cyhhao authored
-
- 16 Jan, 2026 1 commit
-
-
IanShaw027 authored
opencode 请求不带 session_id/conversation_id,导致粘性会话失效。现在按 header 优先、prompt_cache_key 兜底生成 session hash,并补充单测验证优先级。
-
- 15 Jan, 2026 2 commits
- 14 Jan, 2026 1 commit
-
-
ianshaw authored
## 问题描述 调度器快照更新存在0.5-1秒的延迟(Outbox轮询间隔),导致在账号被限流或过载后的短时间窗口内, 可能仍会被选中,造成请求失败。 ## 根本原因 账号选择逻辑依赖调度器快照(listSchedulableAccounts),但快照更新有延迟: - Outbox轮询: 每1秒检查一次变更事件 - 全量重建: 每300秒重建一次 - 时间窗口: 账号状态变更后0.5-1秒内,快照可能未更新 ## 解决方案 在账号选择循环中添加IsSchedulable()实时检查,作为第二道防线: 1. 第一道防线: 调度器快照过滤(可能有延迟) 2. 第二道防线: IsSchedulable()实时检查(本次修复) IsSchedulable()会检查: - RateLimitResetAt: 限流重置时间 - OverloadUntil: 过载持续时间 - TempUnschedulableUntil: 临时不可调度时间 - Status: 账号状态 - Schedulable: 可调度标志 ## 修改范围 ### OpenAI Gateway Service - SelectAccountForModelWithExclusions: 添加IsSchedulable()检查 - SelectAccountWithLoadAwareness: 添加IsSchedulable()检查 ### Gateway Service (Claude/Gemini/Antigravity) - 负载感知选择候选账号筛选: 添加IsSchedulable()检查 - selectAccountForModelWithPlatform: 添加IsSchedulable()检查 - selectAccountWithMixedScheduling: 添加IsSchedulable()检查 ### 测试用例 - OpenAI: 添加2个测试用例验证限流账号过滤 - Gateway: 添加2个测试用例验证限流和过载账号过滤 ### 其他修复 - ops_repo_preagg.go: 修复platform为NULL时的聚合问题 ## 测试结果 所有单元测试通过
✅
-
- 10 Jan, 2026 1 commit
-
-
cyhhao authored
-
- 09 Jan, 2026 1 commit
-
-
cyhhao authored
-
- 05 Jan, 2026 2 commits
-
-
yangjianbo authored
实现 allow_insecure_http 并在关闭校验时执行最小格式验证 - 关闭 allowlist 时要求 URL 可解析且 scheme 合规 - 响应头过滤关闭时使用默认白名单策略 - 更新相关文档、示例与测试覆盖
-
yangjianbo authored
实现安全开关默认关闭与响应头透传逻辑 - URL 校验与响应头过滤支持开关并覆盖流式路径 - 非流式 Content-Type 透传/默认值按配置生效 - 接入 go test、golangci-lint 与前端 lint/typecheck - 补充相关测试与配置/文档说明
-
- 04 Jan, 2026 2 commits
-
-
yangjianbo authored
修正测试中的 APIKey 名称引用 移除不可达返回与未使用函数 统一 gofmt 格式并处理 Close 错误
-
yangjianbo authored
- 扩展SSE行长与间隔超时处理,补充keepalive - 写入失败与超长行时发送错误事件,修复并发释放 - 同步默认配置与示例配置,更新Caddy超时/压缩规则 - 新增OpenAI流式超时与超长行测试 测试: go test ./...
-