记录前端冗余清理证据(07-16-second-stage-frontend-cleanup-wave1)
这个提交包含在:
@@ -0,0 +1 @@
|
||||
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
|
||||
@@ -0,0 +1,43 @@
|
||||
# `tokens.ts` 安全删除设计
|
||||
|
||||
## Scope And Safety Boundary
|
||||
|
||||
- 唯一代码删除项:`client/src/design/tokens.ts`。
|
||||
- 保留 `client/src/design/theme.css`、`client/src/design/types.ts`、`client/src/index.css` 和 Tailwind 配置。
|
||||
- 不修改历史 Issue CSV、归档 Trellis task、页面样式、业务逻辑、依赖或构建配置。
|
||||
|
||||
## Pre-Deletion Evidence
|
||||
|
||||
- 精确符号和路径搜索确认当前运行时代码、配置、脚本与 CI 没有消费者。
|
||||
- 未发现 glob、生成器或目录复制机制读取 `client/src/design/`。
|
||||
- `index.css` 直接导入 `theme.css`;Portal schema 直接导入 `design/types`。
|
||||
- `tokens.ts` 与现行 CSS 的部分圆角和阴影值已漂移,不是运行时事实源。
|
||||
|
||||
## Deletion Operation
|
||||
|
||||
通过单文件 Git 删除移除 `tokens.ts`,不迁移其常量,也不新增忽略规则。源文件若未来因明确需求重新引入,应重新建立单一事实源和消费者,而不是自动恢复旧副本。
|
||||
|
||||
## Validation Matrix
|
||||
|
||||
| 条件 | 预期结果 |
|
||||
| --- | --- |
|
||||
| 当前代码搜索 `semanticTokens` / `SemanticTokens` / `design/tokens` | 活跃消费者为 0;历史审计引用允许保留 |
|
||||
| 检查 `theme.css` 和 `types.ts` | 两个文件及其当前导入链仍存在 |
|
||||
| 前端 TypeScript 检查 | 通过 |
|
||||
| Vite production build | 通过,PWA 产物正常生成 |
|
||||
| Trellis task / governance / diff 门禁 | 全部通过 |
|
||||
| 验证结束后的 `client/dist/` | 已删除,不进入 Git 变更 |
|
||||
|
||||
## Failure Handling
|
||||
|
||||
- 任一活跃消费者存在:停止删除,恢复文件并重新审计调用链。
|
||||
- TypeScript 或构建失败且可归因于删除:恢复文件,记录依赖入口,不扩大修改范围。
|
||||
- 仅历史审计引用存在:保留历史记录,不视为运行时阻断。
|
||||
|
||||
## Rollback
|
||||
|
||||
从删除提交的父提交恢复 `client/src/design/tokens.ts` 即可;本任务不涉及数据库、迁移、配置或生产数据回滚。
|
||||
|
||||
## Verification Boundary
|
||||
|
||||
本任务只证明本地引用、类型和构建门禁通过。未部署、未做公网检查,也不宣称页面出现可见变化或已经线上可测。
|
||||
@@ -0,0 +1 @@
|
||||
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
|
||||
@@ -0,0 +1,111 @@
|
||||
# 第二阶段前端冗余清理首批
|
||||
|
||||
## Goal
|
||||
|
||||
以可复核的引用、构建和回滚证据删除首个低风险 Git 跟踪冗余项,减少前端设计事实源重复;本批优先处理未被消费且已与现行 CSS 视觉变量漂移的 `client/src/design/tokens.ts`,不顺带扩大到业务模块或其他兼容层。
|
||||
|
||||
## What I Already Know
|
||||
|
||||
- 上一任务已把 `client/src/design/tokens.ts` 列为第二批首选候选,并要求再次确认静态引用、动态消费和构建影响。
|
||||
- 当前 Git 跟踪代码中,`semanticTokens` 与 `SemanticTokens` 除文件自身外没有引用。
|
||||
- 未发现 import glob、代码生成器、构建脚本、Vite 插件或外部同步脚本读取该文件或 `client/src/design/` 全目录。
|
||||
- 运行时视觉事实源是 `client/src/index.css` 导入的 `client/src/design/theme.css`,Tailwind 类使用 `client/tailwind.config.js`。
|
||||
- `tokens.ts` 的圆角与阴影值已经和 `theme.css` 不一致,继续保留会制造错误的第二事实源。
|
||||
- 历史 Issue CSV 和已归档 Trellis task 仍提到该路径;它们是审计材料,不因本次删除改写。
|
||||
- `client/src/design/types.ts` 仍被 Portal schema 使用,`theme.css` 仍被 `index.css` 导入,两者不属于删除范围。
|
||||
|
||||
## Scope
|
||||
|
||||
- 本批采用最小切片,只删除 `tokens.ts`,不同时处理旧 `Portal`、Postman、PWA 图标、ERP 或冻结业务模块。
|
||||
- 删除不会改变页面视觉、运行时路由、数据、权限或部署契约。
|
||||
- 若验证发现任何动态消费或构建回归,立即恢复该文件并回到证据审计。
|
||||
- 用户于 2026-07-16 选择方案 1,批准按上述最小范围实施。
|
||||
|
||||
## Open Questions
|
||||
|
||||
- 无。
|
||||
|
||||
## Requirements
|
||||
|
||||
- 删除前保留当前代码、历史和构建引用证据。
|
||||
- 只删除已确认无消费者的 `client/src/design/tokens.ts`。
|
||||
- 保留 `theme.css`、`types.ts`、Tailwind 配置以及历史 Issue/Trellis 审计引用。
|
||||
- 删除后验证 TypeScript、Vite 构建和 Trellis 治理。
|
||||
- 验证产生的 `client/dist/` 在取证后清理,不把生成物纳入提交。
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [x] `client/src/design/tokens.ts` 从 Git 跟踪工作树删除。
|
||||
- [x] 当前运行时代码、配置、脚本和 CI 中不存在对 `semanticTokens`、`SemanticTokens` 或 `design/tokens` 的消费者引用。
|
||||
- [x] `client/src/design/theme.css` 仍由 `client/src/index.css` 导入,`client/src/design/types.ts` 的现有消费者不受影响。
|
||||
- [x] `cd client && npm run typecheck && npm run build` 通过。
|
||||
- [x] 当前 task validate、Trellis governance 和 `git diff --check` 通过。
|
||||
- [x] 最终工作树不包含 `client/dist/` 等本次验证生成物。
|
||||
- [x] Git 删除项具有无运行时依赖、无数据破坏、验证通过和明确回滚方式的证据。
|
||||
|
||||
## Definition of Done
|
||||
|
||||
- 删除范围和验证结果记录在当前 task。
|
||||
- 前端类型检查、生产构建及项目治理门禁通过。
|
||||
- 不改写历史审计材料,不宣称页面视觉或公网部署已变更。
|
||||
- 形成中文本地提交计划并另行取得提交确认;不自动 push 或部署。
|
||||
|
||||
## Technical Approach
|
||||
|
||||
1. 用精确符号、路径、glob/生成器和 Git 历史搜索确认零消费者。
|
||||
2. 删除单个冗余 TypeScript 文件,不迁移其常量,因为现行 CSS/Tailwind 已有实际事实源且数值存在漂移。
|
||||
3. 运行 TypeScript 与 Vite 构建,复核活跃设计文件和 Git 删除范围。
|
||||
4. 清理构建生成物,运行 Trellis/task/diff 门禁并做只读删除复核。
|
||||
|
||||
详细安全边界、验证矩阵和回滚步骤见 `design.md`。
|
||||
|
||||
## Decision (ADR-lite)
|
||||
|
||||
**Context**:`tokens.ts` 原用于设计系统脚手架,但没有进入任何运行时 import;实际视觉已由 CSS 变量和 Tailwind 承担,且两套数值已漂移。
|
||||
|
||||
**Decision**:用户已选择方案 1;本批直接删除 `tokens.ts`,不把其内容迁移到新文件,也不修改现行 CSS 视觉值。
|
||||
|
||||
**Consequences**:减少一个误导性的设计事实源并保持页面行为不变;历史审计记录仍会提到已删除路径,回滚可从删除提交的父提交恢复单文件。
|
||||
|
||||
## Test Plan
|
||||
|
||||
```bash
|
||||
git grep -n -E 'semanticTokens|SemanticTokens|design/tokens' -- ':!client/src/design/tokens.ts'
|
||||
cd client && npm run typecheck && npm run build
|
||||
python3 ./.trellis/scripts/task.py validate 07-16-second-stage-frontend-cleanup-wave1
|
||||
node scripts/qa/check-trellis-governance.mjs
|
||||
git diff --check
|
||||
```
|
||||
|
||||
## Verification Results
|
||||
|
||||
- 活跃源码、配置、脚本、CI 和服务端范围的精确搜索结果为 `ACTIVE_CONSUMERS=0`;命中项只剩受保护的历史 Issue CSV 和归档 Trellis 证据。
|
||||
- `client/src/index.css` 仍导入 `client/src/design/theme.css`,`client/src/features/portal/schema.ts` 仍导入 `client/src/design/types.ts`。
|
||||
- `cd client && npm run typecheck` 通过。
|
||||
- `cd client && npm run build` 退出码为 0:Vite 转换 2381 个模块,PWA 生成 102 个预缓存条目;仅有既有 Browserslist 数据陈旧提示。
|
||||
- 构建产生的 `client/dist/` 已删除,未进入 Git 变更。
|
||||
- task validate、Trellis governance 和 `git diff --check` 严格模式通过;治理结果无 warning/error。
|
||||
- 最终只读删除复核无阻断:确认唯一删除项已获批准、无活跃消费者、保留文件与历史审计边界正确。
|
||||
- 未运行 Playwright:本次只删除零消费者源文件,不修改页面、样式或交互输出。
|
||||
- 未执行部署、push、公网检查或任何数据写入。
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- 旧 `Portal` 测试/规约兼容清理。
|
||||
- Postman collection/environment 的保留或删除决策。
|
||||
- PWA 占位图标替换。
|
||||
- ERP、预算、差旅、薪酬、绩效等业务模块删除。
|
||||
- 修改 `theme.css`、Tailwind 视觉值或现有页面设计。
|
||||
- 改写历史 `issues/*.csv` 或已归档 Trellis task。
|
||||
- push、部署、公网验证或任何数据写入。
|
||||
|
||||
## Technical Notes
|
||||
|
||||
- 证据:`research/tokens-deletion-audit.md`。
|
||||
- 前端规约:`.trellis/spec/hyb-oa/frontend-react-vite-design.md`。
|
||||
- 治理规约:`.trellis/spec/hyb-oa/project-governance.md`。
|
||||
- 上一批候选清单:`.trellis/tasks/archive/2026-07/07-15-production-trust-closeout-cleanup/research/cleanup-candidate-inventory.md`。
|
||||
|
||||
## Research References
|
||||
|
||||
- `research/tokens-deletion-audit.md`:静态/动态/构建引用、事实源漂移、历史审计引用与回滚结论。
|
||||
@@ -0,0 +1,62 @@
|
||||
# `client/src/design/tokens.ts` 删除审计
|
||||
|
||||
## 结论
|
||||
|
||||
该文件满足进入删除实施的技术前置条件:当前运行时和构建链零消费者、无动态目录消费、无数据或迁移影响、现行视觉事实源明确,且可从 Git 单文件恢复。
|
||||
|
||||
## 当前文件职责
|
||||
|
||||
- 导出 `semanticTokens` 常量及其派生类型 `SemanticTokens`。
|
||||
- 内容覆盖颜色、圆角、阴影和间距,但没有副作用、注册逻辑或数据读取。
|
||||
- Git 历史显示该文件在早期设计系统脚手架中引入,后续只做过视觉值刷新。
|
||||
|
||||
## 引用审计
|
||||
|
||||
### 精确符号与路径
|
||||
|
||||
- `git grep` 对 `semanticTokens`、`SemanticTokens`、`design/tokens`、`src/design` 的当前代码搜索未发现文件自身之外的运行时消费者。
|
||||
- `git log -S` 仅定位到引入该导出的历史提交,未发现导出曾被其他前端模块导入后又删除的活动链路。
|
||||
|
||||
### 动态与构建消费
|
||||
|
||||
- 未发现 `import.meta.glob`、代码生成器、复制脚本或 Vite 插件扫描 `client/src/design/`。
|
||||
- Vite 从 `client/src/main.tsx` 进入应用;`main.tsx` 只导入 `index.css`,没有自动加载全部 TypeScript 文件。
|
||||
- TypeScript `include: ["src", "vite.config.ts"]` 会检查现存源码,但不要求保留没有 import 的文件。
|
||||
|
||||
## 现行事实源
|
||||
|
||||
- `client/src/index.css` 明确导入 `client/src/design/theme.css`。
|
||||
- Tailwind 主题来自 `client/tailwind.config.js`。
|
||||
- `client/src/design/types.ts` 被 `client/src/features/portal/schema.ts` 使用,必须保留。
|
||||
- `tokens.ts` 与 `theme.css` 的部分圆角和阴影值已经不同,说明前者不是同步维护的运行时事实源。
|
||||
|
||||
## 历史引用处理
|
||||
|
||||
- 历史 Issue CSV 和已归档 Trellis task 中仍有 `tokens.ts` 或 `client/src/design/` 路径。
|
||||
- 这些文件用于历史验收、审计或当时的回滚描述,不是当前运行时依赖。
|
||||
- 按项目永久保护规则不批量改写历史 Issue CSV,也不改写已归档 task。
|
||||
|
||||
## 风险与回滚
|
||||
|
||||
- 运行时风险:低;没有 import 或动态注册。
|
||||
- 构建风险:低;以 typecheck 和 production build 验证。
|
||||
- 视觉风险:低;不修改 `theme.css`、Tailwind 或页面类名。
|
||||
- 数据/迁移风险:无。
|
||||
- 回滚:从删除提交的父提交恢复 `client/src/design/tokens.ts`,无需数据回滚。
|
||||
|
||||
## 必须验证
|
||||
|
||||
1. 删除后精确搜索仍无当前消费者。
|
||||
2. `cd client && npm run typecheck && npm run build` 通过。
|
||||
3. `theme.css`、`types.ts` 和其消费者仍存在。
|
||||
4. Trellis governance、task validate 与 `git diff --check` 通过。
|
||||
5. 删除验证生成的 `client/dist/` 后再提交。
|
||||
|
||||
## 2026-07-16 执行结果
|
||||
|
||||
- 已删除唯一批准项 `client/src/design/tokens.ts`。
|
||||
- 活跃消费者精确搜索为 0;历史 Issue CSV 和归档 task 引用按保护规则保留。
|
||||
- 前端 typecheck 与 production build 通过,Vite/PWA 产物生成正常。
|
||||
- `theme.css`、`types.ts` 及其当前导入链保持不变。
|
||||
- `client/dist/` 已在取证后清理。
|
||||
- task validate、Trellis governance 与 `git diff --check` 通过。
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"id": "second-stage-frontend-cleanup-wave1",
|
||||
"name": "second-stage-frontend-cleanup-wave1",
|
||||
"title": "第二阶段前端冗余清理首批",
|
||||
"description": "基于静态、动态和构建引用证据,删除未被消费且已与现行 CSS 漂移的前端设计 token 文件。",
|
||||
"status": "in_progress",
|
||||
"dev_type": null,
|
||||
"scope": "client/src/design/tokens.ts and current Trellis task evidence",
|
||||
"package": null,
|
||||
"priority": "P2",
|
||||
"creator": "shunli",
|
||||
"assignee": "shunli",
|
||||
"createdAt": "2026-07-16",
|
||||
"completedAt": null,
|
||||
"branch": null,
|
||||
"base_branch": "main",
|
||||
"worktree_path": null,
|
||||
"commit": null,
|
||||
"pr_url": null,
|
||||
"subtasks": [],
|
||||
"children": [],
|
||||
"parent": null,
|
||||
"relatedFiles": [
|
||||
"client/src/design/tokens.ts",
|
||||
"client/src/design/theme.css",
|
||||
"client/src/design/types.ts",
|
||||
"client/src/index.css",
|
||||
"client/tailwind.config.js"
|
||||
],
|
||||
"notes": "用户于 2026-07-16 选择方案 1,仅批准删除 tokens.ts;其他兼容和冗余候选不在本批范围。",
|
||||
"meta": {}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户