Files
cc-web/.trellis/spec/frontend/quality-guidelines.md
2026-08-07 14:22:52 +08:00

65 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Quality Guidelines
> Code quality standards for frontend development.
---
## Overview
<!--
Document your project's quality standards here.
Questions to answer:
- What patterns are forbidden?
- What linting rules do you enforce?
- What are your testing requirements?
- What code review standards apply?
-->
(To be filled by the team)
---
## Forbidden Patterns
<!-- Patterns that should never be used and why -->
(To be filled by the team)
---
## Required Patterns
<!-- Patterns that must always be used -->
### 长驻页面的静态资源版本握手
- 前端脚本改动不能只依赖固定查询参数或服务重启来生效。已打开的标签页会继续
执行内存中的旧 JavaScript,直到页面被重新加载。
- `app.js` 的资源版本必须由服务端根据实际文件内容生成,并同时用于入口页脚本
URL、页面运行时版本和 WebSocket 鉴权结果,避免三处版本语义漂移。
- 客户端只在本地版本和服务端版本均合法且不一致时刷新,并设置单次刷新 guard,
防止重连或异常版本数据造成刷新循环。
- 版本自检只能覆盖已经加载该机制的页面;机制上线前已打开的旧页面仍需手动刷新
一次,验收标准不得承诺旧代码自身无法执行的自动升级行为。
---
## Testing Requirements
<!-- What level of testing is expected -->
- 修改入口页、静态资源版本或 WebSocket 鉴权协议时,必须同时覆盖静态契约和隔离
服务集成测试。
- 集成测试至少验证入口页脚本 URL、页面运行时版本和
`auth_result.frontendAssetVersion` 三者一致,并覆盖版本一致、不合法、不一致及
单次刷新 guard。
---
## Code Review Checklist
<!-- What reviewers should check -->
(To be filled by the team)