🎨 控制台设备页:加下一台设备的引导 - #17
Merged
Merged
Conversation
第 3 步复用既有的六格 CodeInput 与 userCode 归一化规则:填满六位就带着 归一化后的设备码跳到既有的 /device 授权确认屏,不足六位就地标红且保留 已填字符。代码存不存在由那一屏回答,设备页不复制风险说明/核对/允许拒绝 /倒计时中的任何一项。 顺带把 e2e 零设备断言指向展开的引导——它取代的那句空态文案已被删除。
CommandCard 只记「复制过没有」,而第 1 步那张卡的命令会随所选系统更换:
复制完 curl 那条再切到 Windows,按钮仍在对一条从没进过剪贴板的 PowerShell
命令显示「已复制」。改成记住复制走的是哪一条命令,复制态由它与当前命令
比对得出;两秒计时仍从点击那一刻起算。
顺带修两条形同虚设的断言:devices.test.tsx 里 queryByText("No devices yet.")
钉的是本轮已删除的空态文案,永远为真。空态用例删掉它(引导在场已由 testid
断言),加载失败用例换成断言顶栏计数不渲染——写着 0 的计数与那句空句
是同一句谎话,且它可被证伪(把 deviceCount 的 loadError 判断去掉即红)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为什么
控制台「设备」页整页没有任何添加设备的入口:所有动作都是对已有设备的(展开、查看对话、解除授权)。空态只有一句「还没有任何设备。」—— 陈述一个事实,然后什么也不做。更别扭的是输入设备码那一屏(
/device)其实早就实现了,但导航里到不了它,只有客户端打印的链接能进去,链接丢了就没有第二条路。规格:
agentre/docs/specs/2026-08-14-add-device-guidance.md(桌面端那一半在agentre仓库同名分支;两仓分别提交)改了什么
CodeInput收 6 位设备码,填满后跳到既有授权确认屏/device?user_code=…不新增第二份批准界面
风险说明、代码核对、允许/拒绝、过期倒计时全部继续只由既有授权屏承担 —— 设备页一个字都不复制(规格硬不变量 2)。守卫测试断言第 3 步正文里没有这些东西。
后端一行未改:diff 全在
frontend/+ 一行e2e/smoke.spec.ts,无 Go / 迁移 / API。真机验证
正式构建
89c43b6经pnpm serve起在127.0.0.1:18443,连真 MySQL 与真 Redis;设备接入走真 Device Flow(/v1/oauth/device/authorize→ 浏览器批准 →/v1/oauth/device/token,注册成device_id=4)。报告与截图在e2e/scratch/2026-08-14-add-device-guidance/(gitignore)。8 条判据 7 holds,2 条未观察:加载失败态(诱发需改码或用替身,红线禁止)、设备码被拒的错误分支(本次未构造被拒的码,正路已覆盖交接本身)。
运行副作用已由 harness 清理并自校验
no residue,全程无DROP/TRUNCATE/FLUSHDB。收尾
规格核对 + 代码审查两轮独立 review,各修一个真问题:
685870b:本轮删掉device.manage.empty后,既有守卫「加载失败不得改口说没有设备」变成了对已不存在字符串的恒真断言 —— 它一直是绿的89c43b6:CommandCard只存一个copied布尔,切换系统后按钮仍显示「已复制」,而剪贴板里是上一条命令全量:42 文件 / 529 用例 exit 0;
tsc -b --noEmit0;eslint . --max-warnings 00。