Repository navigation
Conversation
Add atomic Redis Stream outbox, SQL idempotency, bounded retries/dead letters, exact money, activity stock reservations, JWT revocation and WebSocket authentication. Include Chinese operating guide and real-stack CI.
xrfc
marked this pull request as ready for review
October 7, 2026 04:05
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.
原秒杀链路在 Redis 扣库存后发布失败、消息重复或消费落库异常时可能丢单或重复下单。此改动增加同库 Stream outbox、发布确认、数据库唯一约束幂等、有限重试与死信,并提供完整容器部署和可核查的可视化实验室。
一键部署包含六个服务及 MySQL/Redis/RabbitMQ、随机凭据、保留数据的数据库初始化/升级、依赖就绪检查和跨平台入口;补齐活动库存预留/关闭回收、精确金额、参数与资源边界、Token 撤销、WebSocket 鉴权/代理及 AI 显式降级。
新增 /lab 随网关交付,不需要 Node 或前端构建。原理演示提供 12 个逐步场景、库存/消息/订单变化、示意 JSON、代码位置、验证方法和面试追问;真实观测经管理员鉴权,只读采样实际活动、Stream/pending、MQ 主/重试/死信统计、已提交订单与请求证据。不可读显示未知、失败标注旧数据;Token 仅保存在页面内存,CSP 限制同源资源,不可信商品名称按文本渲染。跨存储采样不是原子快照,未实现逐请求 MQ 追踪。
真实重启验收发现并修复查询窗口:第一次 SQL 查询尚无订单,随后 Redis 已标记 created。现在使用新的 SQL 事务再次确认,避免返回 created 却没有 order_id;再次无订单时返回异常并要求核查,不把 Redis 状态当作提交证明。
验证:78 项本地 Python 测试、6 项场景测试通过;真实 Chromium 检查桌面/手机交互、实际管理员采样/请求核查/注销,以及故障样本、过期和 XSS。最终 GitHub Actions unit/integration 全部通过,包括完整 Compose、真实 HTTP/MySQL/Redis/RabbitMQ/WebSocket、服务重启、MQ 停止/恢复,以及正常 MQ 统计与停止时未知状态检查。运行记录:https://github.com/xrfc/WebBackend_2026SS/actions/runs/37589250253 。Actions 附有 visualization-screenshots 截图。
启动:python scripts/deploy.py;页面:http://localhost:8000/lab;验收:python scripts/deploy.py test。中文说明见 README.md、docs/可视化实验室.md、docs/异常处理与部署说明.md。
升级先备份已有数据,旧浮点金额按分转换,旧 Token 需重新登录。旧活动/消息不能自动补造为新记录;单节点数据整体丢失仍需备份对账。支付/退款、高可用和真实系统峰值 QPS 尚未验证或实现,历史模拟性能口径已校正。