Repository navigation
修复第 3 轮(正确性):按审查报告修复前后端正确性与可靠性问题 - #122
Merged
todosdev[bot] merged 4 commits intoOct 17, 2026
Merged
Conversation
- BE-C1: shared parseIntParam/parsePagination helpers guard page, limit and days against NaN in links, admin and analytics routes - BE-C3: map D1 UNIQUE violations to 409 in register and admin create user - FE-C1/C2: drop stale expiry fields from the create payload and use local time for datetime-local; edit only sends expiresAt when changed - FE-C3/C4: replace render-time navigate in TwoFactorPage; only treat verify-email as signed in when an access token is returned - FE-R1/R2: keep the session on transient refresh failures, handle expiry once in-SPA and clear the query cache when signed out - FE-R3: expose AppConfig isLoading/loadFailed; register and login pages wait for config and surface load errors - add node --test worker unit tests and a pnpm test script Co-Authored-By: Claude Code <noreply@anthropic.com> Checkpoint: dedJ4t0xV3KkeaGQPpASD
- /auth/refresh returns 401 (and clears the cookie) only for invalid tokens; KV/D1 errors now return 503 and rotation runs after all reads - session restore keeps the transient outcome: guards show a retry screen instead of redirecting to /login, and retry when back online Co-Authored-By: Claude Code <noreply@anthropic.com> Checkpoint: xnld6jmMrKwfyDfiv40E_
…5-752b-9b19-c908804463be
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.
Summary
docs/review/REVIEW.md(分支tds/conv-01a149a5-…)中第 3 轮的正确性和可靠性问题:BE-C1、BE-C3、FE-C1C4、FE-R1R3。smtp.ts每次读写都有 10s 超时,Resend 请求用了AbortSignal.timeout(10_000)。本轮没有改它。.github/**也只有从 main 合并进来的改动,本分支自己没有动。Changes
Worker
lib/params.ts,提供parseIntParam和parsePagination。缺失或非数字的值回退到默认值,并限定取值范围,page 最大 100 万。links、admin 的 users/links,以及 analytics 的days都改用这两个函数(BE-C1)。lib/db.ts新增isUniqueConstraintError。注册(两条 INSERT 路径)和管理员创建用户时,遇到唯一约束冲突返回 409,不再报 500(BE-C3)。/auth/refresh只有在 token 无效时才返回 401 并清除 cookie;KV/D1 故障改为返回 503 并保留 cookie。旧 token 改为在所有读取都成功之后才拉黑(FE-R1)。package.json加上"type": "module"和test脚本(node --test,不新增依赖)。新增test/params.test.ts和test/db.test.ts。Web
api/client.ts:refresh 的结果分为ok、expired、transient三种,只有expired才结束会话(FE-R1)。会话过期在每个会话里只处理一次,由 AuthProvider 在应用内处理,不再整页跳转(FE-R2)。AuthContext:restoreFailed,联网后自动重试。App.tsx:会话恢复失败时,路由守卫显示"重试"页面,不再跳到/login。AppConfigContext:新增isLoading和loadFailed。注册页会等配置加载完成再决定去向;注册页和登录页在加载失败时显示错误并提供重试(FE-R3)。LinksPage:datetime-local改为按本地时区格式化和解析;编辑时只有改过过期时间才发送expiresAt(FE-C2)。TwoFactorPage:去掉渲染期间调用的navigate,改用<Navigate>;验证成功后先跳转,再清除 pending 状态(FE-C3)。RegisterPage:verify-email 的响应带 access token 才进入 dashboard;返回 2FA 时转到二次验证页;其他情况提示后回到登录页(FE-C4)。Root
pnpm test(turbo run test),turbo.json加test任务,CLAUDE.md补了说明。CI 目前还没有运行这些单测,接入留到后续轮次。Testing
pnpm install --frozen-lockfile、pnpm check、typecheck、build、shellcheck .github/scripts/*.sh、两个部署脚本测试(17/17)、worker 单测(5/5)、pnpm audit --prod --audit-level=high(No known vulnerabilities found)。合并最新 main 之后又跑了 install、typecheck 和单测,也都通过。"type": "module"之后,d1-migrations.mjs SL的输出和加之前逐字节一致;wrangler deploy --dry-run打包正常。wrangler dev冒烟测试:/auth/refresh的有效、复用、伪造、缺失四种 token 分别返回 200、401、401、401。