File tree Expand file tree Collapse file tree
spaces/20260522-unified-account-detail-system
src/features/accounts/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ func mapAccountRecord(record accountsdomain.AccountRecord) AccountRecord {
3333 CredentialSource : record .CredentialSource ,
3434 DisplayName : record .DisplayName ,
3535 Status : record .Status ,
36+ StatusMessage : record .StatusMessage ,
3637 Priority : record .Priority ,
3738 Disabled : record .Disabled ,
3839 Email : record .Email ,
Original file line number Diff line number Diff line change 66 "strings"
77 "testing"
88
9+ accountsdomain "github.com/linhay/gettokens/internal/accounts"
910 wailsapp "github.com/linhay/gettokens/internal/wailsapp"
1011 "github.com/wailsapp/wails/v2/pkg/menu"
1112)
@@ -130,6 +131,21 @@ func TestConsumeLoginItemArgReportsMissingArg(t *testing.T) {
130131 }
131132}
132133
134+ func TestMapAccountRecordPreservesStatusMessage (t * testing.T ) {
135+ record := mapAccountRecord (accountsdomain.AccountRecord {
136+ ID : "auth-file:broken.json" ,
137+ Provider : "codex" ,
138+ CredentialSource : "auth-file" ,
139+ DisplayName : "broken.json" ,
140+ Status : "error" ,
141+ StatusMessage : "refresh token expired" ,
142+ })
143+
144+ if got := record .StatusMessage ; got != "refresh token expired" {
145+ t .Fatalf ("StatusMessage = %q, want refresh token expired" , got )
146+ }
147+ }
148+
133149func findMenuItemByLabel (appMenu * menu.Menu , label string ) * menu.MenuItem {
134150 for _ , item := range appMenu .Items {
135151 if found := findMenuItemByLabelInItem (item , label ); found != nil {
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ type AccountRecord struct {
8282 CredentialSource string `json:"credentialSource"`
8383 DisplayName string `json:"displayName"`
8484 Status string `json:"status"`
85+ StatusMessage string `json:"statusMessage,omitempty"`
8586 Priority int `json:"priority,omitempty"`
8687 Disabled bool `json:"disabled,omitempty"`
8788 Email string `json:"email,omitempty"`
Original file line number Diff line number Diff line change 1313- Codex `Feature 配置` 页面完成配置项语义分组与控件收敛:root 按启动默认、模型输出、权限沙箱、工作区文档、工具集成、高级兼容分组;features 按推荐稳定、实验性、高级、兼容旧项分组;notice 按安全提示、迁移提示、结构化 notice 分组;model providers 按 provider id 分组。分组只影响展示层,不改变 draft、preview、save 的字段路径和保留式 TOML patch 语义。固定 enum options 已统一渲染为 `SegmentedControl`,bool / boolean 继续使用 `ToggleSwitch`,并按本地 Codex 源码 `7d47056ea4` 的 `codex-rs/core/config.schema.json` 校准 `approvals_reviewer`、`personality`、`model_auto_compact_token_limit_scope`、`model_providers.*.wire_api` 等选项;布尔型缺省假值不会被误显示成 `false` 枚举项。验证:`go test ./internal/wailsapp -run 'TestGetCodexFeatureConfigReturnsTypedRootDefinitionsAndValues|TestGetCodexFeatureConfigReturnsAllModelProviderSchemaFields'`、`node --test frontend/src/features/status/tests/codexFeatureConfig.test.mjs`、`npm --prefix frontend run typecheck`、`npm --prefix frontend run build` 通过;浏览器确认 `http://127.0.0.1:34115/#frame=codex` 已出现实际非空分组标题,且 DOM 命中 `SegmentedControl: 16`、`ToggleSwitch: 79`、`selectCount: 0`。
1414- 2026-05-25 的 Account Routing Engine 补充实现已落地 shadow/event ledger:`internal/wailsapp/channel_routing.go` 新增 `shadowEnabled` / `shadowRouteMode`、`ListChannelRouteEvents`、`snapshotVersion`、`policyVersion` 和安全 route event ledger;前端 `ChannelRoutingWorkbench` 已显示 shadow 开关、shadow 选择和 snapshot/policy 摘要;Codex / Claude 浏览器预览截图已落位 `docs-linhay/spaces/20260524-account-routing-engine/screenshots/20260525/codex/20260525-codex-account-routing-shadow-after-v01.png` 与 `docs-linhay/spaces/20260524-account-routing-engine/screenshots/20260525/claude/20260525-claude-account-routing-shadow-after-v01.png`。验证:`go test . ./internal/wailsapp -run 'Test.*ChannelRouting|TestChannelRouteEvent'`、`go test ./...`、`go test ./...`(CLIProxyAPI fork)、`npm --prefix frontend run test:unit -- src/features/channel-routing/tests/channelRouting.test.mjs`、`npm --prefix frontend run typecheck`、`npm --prefix frontend run build` 通过。当前仍未完成真实 upstream 请求冒烟和最后的 legacy path 收敛。
1515- Codex live sessions 请求信息补齐完成:新建 `docs-linhay/spaces/20260525-codex-live-session-request-info/`;按用户确认不兼容旧 sidecar,`projectName` 主来源改到 CLIProxyAPI fork 的 live tracker。sidecar 在生成 snapshot 时扫描 `CODEX_HOME || ~/.codex` 下 `sessions/` 与 `archived_sessions/` 的 Codex JSONL,从 `session_meta.id`、conversation/window/session key、`turn_context.cwd`、`session_meta.cwd` 或 git repo 反查项目名并返回 `projectName`,lookup 加 10 秒 TTL;GetTokens Wails 侧只透传 sidecar 字段,已移除本地兼容反查层。详情页 `请求时间线` 从事件行改为请求监控信息,展示 request/client/upstream id、账号、provider、transport、耗时、速率、token、错误和关键事件摘要。验证:CLIProxyAPI fork `go test ./internal/gettokenshooks -run LiveSessions`、GetTokens `go test ./internal/wailsapp -run CodexLive`、`node --test frontend/src/features/codex-live-sessions/model.test.mjs`、`npm --prefix frontend run typecheck` 通过;浏览器预览截图已归档到 `docs-linhay/spaces/20260525-codex-live-session-request-info/screenshots/20260525/codex-live-sessions/20260525-codex-live-sessions-request-info-after-v01.png`。
16+ - 账号异常详情 fallback 修复:根因是 sidecar / Wails 内部账号记录已有 ` StatusMessage ` ,但 root ` main.AccountRecord ` DTO 和 ` mapAccountRecord ` 未透传,前端账号详情只能显示“当前账号状态异常,但 sidecar 未返回具体原因”。已补 ` app_types.go ` 、` app_mappers.go ` 、` frontend/wailsjs/go/models.ts ` 及回归测试;验证:先用新增测试确认红灯,再跑 ` go test ./... ` 、` npm --prefix frontend run typecheck ` 、账号相关前端 unit(456 passed)通过。
Original file line number Diff line number Diff line change 10910920 . ` AccountDetailOverviewGrid ` 新增 equal-height 标记与 stretch slot,确保 ` AccountRuntimeSnapshotSection ` 与 ` CodexAccountEvidenceSection ` 等顶部 evidence 模块在宽屏并排时等高。
11011021 . ` CodexModelRoutingSection ` 的新增模型按钮移入 section header actions,显示在模块右上角;底部只保留错误提示。
11111122 . ` UnifiedAccountDetailModal ` 接入 ` buildAccountDetailStatusMessage ` ,失败态账号在详情弹窗显示 ` statusMessage ` 或明确兜底原因,正常 / 禁用 / 本地草稿不显示错误条。
112+ 23 . 2026-05-25 补齐 root Wails DTO 透传链路:` accountsdomain.AccountRecord.StatusMessage -> main.AccountRecord.statusMessage -> frontend/wailsjs -> AccountRecord ` ,修复账号详情只能显示“sidecar 未返回具体原因”的问题。
112113
113114## 验证记录
114115- ` node --test frontend/src/features/design-system/storyCatalog.test.mjs ` :通过。
126127- 浏览器预览:` http://127.0.0.1:5173/#frame=accounts ` 与 ` #frame=codex&workspace=account-list ` 已验证详情弹窗可打开;唯一 console error 为本地 ` favicon.ico ` 404,与本次改动无关。
127128- Storybook 静态预览:` AccountDetailSections ` story 已验证 ` AccountDetailOverviewGrid ` 、标准模块头部与 ` quota-balance ` 资源网格均渲染;唯一 console error 为本地 ` favicon.ico ` 404,与本次改动无关。
128129- Storybook 静态预览:` CodexAccountOrder Detail ` story 已验证 ` AccountDetailOverviewGrid ` 、` CodexAccountEvidenceSection ` 、` AccountRuntimeSnapshotSection ` 均渲染;1440px 宽度下 runtime slot 与 evidence slot 并排且高度均为 ` 327.8515625px ` ,新增模型按钮位于 ` CodexModelRoutingSection ` 头部右上角,console 无错误。
130+ - 2026-05-25:` go test ./... ` 、` npm --prefix frontend run typecheck ` 、` npm --prefix frontend run test:unit -- src/features/accounts/tests/accountConfig.test.mjs src/features/accounts/tests/accountPresentation.test.mjs ` 通过;新增 root mapper 回归测试和 generated Wails ` AccountRecord.statusMessage ` 断言。
129131
130132## 截图归档
131133- ` screenshots/20260522/accounts/20260522-accounts-detail-api-key-after-v01.png `
Original file line number Diff line number Diff line change @@ -262,6 +262,7 @@ test('buildQuotaCurlTemplate resolves Xiaomi MiMo token plan usage preset withou
262262test ( 'generated Wails account models preserve quota curl fields' , ( ) => {
263263 const source = readFileSync ( wailsModelsPath , 'utf8' ) ;
264264
265+ assert . match ( source , / e x p o r t c l a s s A c c o u n t R e c o r d [ \s \S ] * s t a t u s M e s s a g e \? : s t r i n g ; / ) ;
265266 assert . match ( source , / e x p o r t c l a s s A c c o u n t R e c o r d [ \s \S ] * q u o t a C u r l \? : s t r i n g ; [ \s \S ] * q u o t a E n a b l e d \? : b o o l e a n ; / ) ;
266267 assert . match ( source , / e x p o r t c l a s s C r e a t e C o d e x A P I K e y I n p u t [ \s \S ] * q u o t a C u r l \? : s t r i n g ; [ \s \S ] * q u o t a E n a b l e d \? : b o o l e a n ; / ) ;
267268 assert . match ( source , / e x p o r t c l a s s U p d a t e C o d e x A P I K e y C o n f i g I n p u t [ \s \S ] * q u o t a C u r l \? : s t r i n g ; [ \s \S ] * q u o t a E n a b l e d \? : b o o l e a n ; / ) ;
Original file line number Diff line number Diff line change @@ -596,6 +596,7 @@ export namespace main {
596596 credentialSource : string ;
597597 displayName : string ;
598598 status : string ;
599+ statusMessage ?: string ;
599600 priority ?: number ;
600601 disabled ?: boolean ;
601602 email ?: string ;
@@ -631,6 +632,7 @@ export namespace main {
631632 this . credentialSource = source [ "credentialSource" ] ;
632633 this . displayName = source [ "displayName" ] ;
633634 this . status = source [ "status" ] ;
635+ this . statusMessage = source [ "statusMessage" ] ;
634636 this . priority = source [ "priority" ] ;
635637 this . disabled = source [ "disabled" ] ;
636638 this . email = source [ "email" ] ;
You can’t perform that action at this time.
0 commit comments