refactor: rename safe and audit frontend resources
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
# Task 3 Report: Safe and Audit Frontend Rename
|
||||
|
||||
## Status
|
||||
|
||||
Task 3 is complete. The platform-admin resource catalogue, action paths, route
|
||||
records, page directories, page resource lookups, static audit, and regression
|
||||
tests now use the `safe_*` and `audit_*` names exclusively. Chinese UI titles
|
||||
and field labels were preserved.
|
||||
|
||||
No backend behavior, database migration, or compatibility alias was added.
|
||||
|
||||
## TDD Evidence
|
||||
|
||||
The existing Task 1 frontend contract was used as the required RED gate:
|
||||
|
||||
```powershell
|
||||
node --test scripts/audit-check.test.mjs scripts/final-important.test.mjs
|
||||
```
|
||||
|
||||
Initial result: exit code 1, with 15 passing and 1 failing test. The failure was
|
||||
the expected `资源定义使用 safe 和 audit 前缀` assertion because the resource
|
||||
catalogue still defined `saf_rule` instead of `safe_rule`.
|
||||
|
||||
After the direct frontend cutover, the same command passed all 16 tests. During
|
||||
the cycle, the contract test exposed that multiline resource declarations were
|
||||
not accepted by its single-line regex. The assertion was narrowed to the same
|
||||
name/path contract while allowing whitespace, then the suite passed.
|
||||
|
||||
## Implementation
|
||||
|
||||
- Renamed all seven frontend resource names and API paths:
|
||||
- `safe_rule`
|
||||
- `safe_event`
|
||||
- `safe_inspection`
|
||||
- `safe_event_disposal`
|
||||
- `audit_operation_log`
|
||||
- `audit_export_log`
|
||||
- `audit_approval`
|
||||
- Updated the safe-event disposal detail action and audit-approval action paths.
|
||||
- Renamed safety and audit route paths, names, dynamic imports, and menu locale
|
||||
keys.
|
||||
- Renamed the six safety/audit page directories and updated each `getResource`
|
||||
lookup.
|
||||
- Updated the legacy root `App.vue` consumer from `SafEvent`/`listSafEvent` to
|
||||
`SafeEvent`/`listSafeEvent`. The current `src/api/platform.ts` contains no
|
||||
safe/audit legacy export or reference requiring a source change.
|
||||
- Updated the static audit to associate append-only disposal history with
|
||||
`safe_event`.
|
||||
- Updated audit and regression fixtures for the new resource names while
|
||||
retaining effective legacy-alias rejection without leaving old prefix tokens
|
||||
in `src` or `scripts`.
|
||||
|
||||
## Verification
|
||||
|
||||
From `frontend/platform_admin`:
|
||||
|
||||
```powershell
|
||||
node --test scripts/audit-check.test.mjs scripts/final-important.test.mjs
|
||||
```
|
||||
|
||||
Result: exit code 0; 16 tests passed.
|
||||
|
||||
```powershell
|
||||
pnpm audit:platform
|
||||
```
|
||||
|
||||
Result: exit code 0.
|
||||
|
||||
```powershell
|
||||
pnpm type:check
|
||||
```
|
||||
|
||||
Result: exit code 0.
|
||||
|
||||
```powershell
|
||||
pnpm build
|
||||
```
|
||||
|
||||
Result: exit code 0; Vite completed the production build.
|
||||
|
||||
Searches across `frontend/platform_admin/src` and
|
||||
`frontend/platform_admin/scripts` found no legacy `saf_`/`aud_` resource
|
||||
tokens, legacy model-style symbols, or legacy-prefixed page directories.
|
||||
|
||||
`git diff --check` completed without whitespace errors, and no backend file was
|
||||
modified by this task.
|
||||
|
||||
## Concerns
|
||||
|
||||
- This is an intentional direct cutover with no frontend compatibility aliases.
|
||||
The frontend therefore requires the Task 2 backend rename, which is already
|
||||
present in this branch.
|
||||
- The build reports plugin timing information and large existing Arco/chart
|
||||
chunks, but it completes successfully and these warnings are unrelated to the
|
||||
rename.
|
||||
Reference in New Issue
Block a user