Files
ccdi/docs/plans/frontend/2026-03-22-lsfx-rule-hit-mode-frontend-implementation.md

120 lines
4.4 KiB
Markdown

# LSFX Mock Rule Hit Mode Frontend Implementation Plan
> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 明确本次 `lsfx-mock-server` 规则命中模式切换不引入前端代码改动,同时完成对前端接口契约和页面影响面的核验。
**Architecture:** 本次需求仅作用于 Mock 服务启动方式与命中计划生成逻辑,不新增接口字段、页面交互、路由或状态管理逻辑。前端计划采用“零代码变更 + 契约核验 + 文档记录”的最短路径;若核验发现契约漂移,则停止执行并回到设计阶段,不在本计划中临时扩展实现。
**Tech Stack:** Vue 2, Axios request wrapper, npm, Markdown
---
## File Structure
- `ruoyi-ui/src/api/`: 本次预期不修改,只用于核验现有接口封装是否依赖 Mock 启动方式或新增字段。
- `ruoyi-ui/src/views/`: 本次预期不修改,只用于核验与流水拉取、标签结果、流水明细相关页面是否无需联动调整。
- `docs/reports/implementation/2026-03-22-lsfx-rule-hit-mode-frontend-record.md`: 记录本次前端零代码改动的范围说明。
- `docs/tests/records/2026-03-22-lsfx-rule-hit-mode-frontend-verification.md`: 记录前端契约核验与页面影响判断依据。
### Task 1: 核验前端接口契约与页面触点不受影响
**Files:**
- Reference: `ruoyi-ui/src/api/`
- Reference: `ruoyi-ui/src/views/`
- Reference: `docs/superpowers/specs/2026-03-22-lsfx-rule-hit-mode-design.md`
- [ ] **Step 1: Identify existing frontend touchpoints**
检查以下触点,不写任何前端源码:
- 与“拉取本行信息”相关的接口封装
- 与项目打标、结果总览、流水详情相关的调用链
- 是否存在对 Mock 启动方式、端口或命中模式的前端硬编码依赖
- [ ] **Step 2: Verify no contract change is required**
Run:
```bash
cd ruoyi-ui
rg -n "getJZFileOrZjrcuFile|getBSByLogId|tag|result|statement" src
```
Expected:
- 只命中现有接口调用和结果展示代码
- 未发现前端依赖新增请求参数或新增响应字段
- [ ] **Step 3: Stop if any contract drift is found**
若核验发现以下任一情况,则停止,不做补丁式前端改造:
- 后端返回结构新增前端必填字段
- 页面需要新增新的命中模式展示入口
- 现有页面对热重载脚本入口有直接依赖
若未发现,则维持前端零代码改动。
- [ ] **Step 4: Record the no-op decision**
在实施记录中明确写明:
- 本次需求仅影响 Mock 服务
- 前端页面、接口封装、路由、权限和状态管理均无需改动
- 不为“展示模式切换”新增无业务价值 UI
- [ ] **Step 5: Commit**
```bash
git add docs/reports/implementation/2026-03-22-lsfx-rule-hit-mode-frontend-record.md docs/tests/records/2026-03-22-lsfx-rule-hit-mode-frontend-verification.md
git commit -m "记录Mock命中模式前端零改动结论"
```
### Task 2: 补充前端实施与验证记录
**Files:**
- Create: `docs/reports/implementation/2026-03-22-lsfx-rule-hit-mode-frontend-record.md`
- Create: `docs/tests/records/2026-03-22-lsfx-rule-hit-mode-frontend-verification.md`
- [ ] **Step 1: Write implementation record**
`docs/reports/implementation/2026-03-22-lsfx-rule-hit-mode-frontend-record.md` 中记录:
- 需求范围仅涉及 `lsfx-mock-server`
- 前端无新增字段、无新增交互、无新增构建要求
- 维持零代码改动是本次需求的最短正确路径
- [ ] **Step 2: Write verification record**
`docs/tests/records/2026-03-22-lsfx-rule-hit-mode-frontend-verification.md` 中记录:
- 核验范围
- 检查命令
- “无需前端改动”的依据
- 最终结论
- [ ] **Step 3: Confirm build is not required**
若前端源码无改动,则不执行 `npm run build:prod`;在验证记录中明确写明“本次为零代码变更核验,因此未执行前端构建”。
- [ ] **Step 4: Verify git diff stays docs-only**
Run:
```bash
git diff --name-only -- ruoyi-ui
```
Expected:
- 无输出
- 证明本次前端计划执行期间没有引入前端源码改动
- [ ] **Step 5: Commit**
```bash
git add docs/reports/implementation/2026-03-22-lsfx-rule-hit-mode-frontend-record.md docs/tests/records/2026-03-22-lsfx-rule-hit-mode-frontend-verification.md
git commit -m "补充Mock命中模式前端核验记录"
```