Skip to content

test(e2e): import model and GitHub credentials from a secret file - #1165

Open
Robert0622 wants to merge 1 commit into
mainfrom
codex/e2e-credential-import
Open

Robert0622 wants to merge 1 commit into
mainfrom
codex/e2e-credential-import

Conversation

@Robert0622

Copy link
Copy Markdown
Collaborator

Changes

  • Add optional import of model API keys and a GitHub HTTPS token from a protected JSON file for dedicated E2E accounts.
  • Skip empty values and preserve existing credentials. Repeated GitHub token imports update the same host credential.
  • Connect the import to E2E auth setup when AGENTFLOW_E2E_MODEL_KEYS_FILE is set. The public installer and runtime entry points retain their current behavior.

Verification

  • Built and ran LoopForge from this branch against a disposable MySQL 8.4 container. Verified real HTTP password login, model and GitHub credential persistence, token rotation without duplicate rows, account isolation, and the blank/no-file paths. This run used fixture credentials and exercised LoopForge without calling external providers.
  • node --test e2e/unit/*.test.mjs
  • Focused Go tests for password login, Git HTTP credentials, and model credential APIs and storage
  • python3 scripts/test-install.py -v (49 tests)
  • python3 scripts/check-public.py

@crispinhu27 crispinhu27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

初审 #1165(head 5741ebf,base main afc6e7d)。

审查范围:e2e/setup-model-keys.mjs、e2e/setup-auth.mjs 的导入入口、单测、示例配置和 README;对照了服务端接口契约:POST /api/auth/password(cookie、Origin 校验、每 IP 每分钟 10 次限流)、PUT /api/users/:id/credentials(DisallowUnknownFields、空值保留已存 key、agentCliCredentials 合并)、Agent CLI ID 列表(domain.AgentCLIExecutorKinds)、GET/PUT /api/users/:id/git-http-credentials(按 id 更新已有 github.com 行)。脚本的报错和日志只输出登录名和数量,不输出 key 或 token。

验证(隔离工作区,合成测试账号和假 key,不含真实凭据):

  • node --test e2e/unit/*.test.mjs:24/24 通过,含新增 5 个用例。
  • 实际运行:在 127.0.0.1 上起真实 gin 路由(sqlite 测试库),建本地账号并预置 codex、opencode key,两次运行 node e2e/setup-model-keys.mjs(第二次换了 key 值)。导入的 key 和 ioa 环境都写入成功,预置 key 两次都保留,github.com 凭据始终只有 1 行且 token 被更新。setup-auth.mjs 设置环境变量时先导入再建 API token,不设置时行为与 main 相同。
  • CI 全部检查通过。

未覆盖:没有用 MySQL 跑完整生产服务(本机无 Docker)。本 PR 只改 e2e 工具,服务端代码未改,CI e2e 已通过,因此不影响结论。

本 Review 由自动化 Code Review 任务发布,结论只针对上面列出的验证范围。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants