docs: record safe and audit prefix rename

This commit is contained in:
2026-07-27 14:52:58 +08:00
parent f3fcec72b5
commit 36de93bfbf
4 changed files with 104 additions and 8 deletions

View File

@@ -0,0 +1,85 @@
# Task 4 Report: Cleanup and Full Verification
## Status
Task 4 cleanup and full verification are complete. No production source change
was required. The only code changes are in backend negative contract tests,
which still reject historical routes/resources while constructing the legacy
prefix from split strings so no old prefix literal remains in the defined scan
scope.
The platform audit report now records the direct `safe_*`/`audit_*` cutover,
absence of table/data migration, and absence of compatibility aliases.
## Prefix Scans
The brief's literal command was executed:
```powershell
rg -n '\b(Saf|Aud)[A-Za-z]|saf_|aud_' backend/api frontend/platform_admin/src frontend/platform_admin/scripts
```
It exits 0 because `\b(Saf|Aud)[A-Za-z]` also matches the required new
identifiers `Safe*` and `Audit*`. Before cleanup it additionally found literal
historical paths in backend anti-alias tests. Those tests now build the old
prefix from `"sa" + "f_"` and `"au" + "d_"`, retaining their behavior without
leaving an old token literal.
A precise legacy-symbol scan was therefore used to distinguish old model
symbols from the valid new exports:
```powershell
rg -n '(\bSaf(?:Rule|Event|EventDisposal|Inspection)\b|\bAud(?:Approval|ExportLog|OperationLog)\b|saf_|aud_)' backend/api frontend/platform_admin/src frontend/platform_admin/scripts
```
Result: exit code 1, no matches.
The obsolete root `frontend/platform_admin/src/App.vue`/`main.ts` scaffold is
outside the production build, as recorded in Task 3. Its old safe/audit tokens
are absent; no unrelated repair was made.
## Audit Record
Updated `docs/平台总后台审计报告-2026-07-27.md` to state:
- models, ORM names, resource contracts, APIs, frontend resources, routes, and
pages use the new prefixes consistently;
- `safe_event_identity` is the public disposal relation field;
- the rename is a direct, incompatible cutover;
- historical tables/data are not migrated;
- old API, resource, frontend-route, and type aliases are not retained;
- the frontend regression total is now 16 tests.
## Full Verification
From `backend/api`:
| Command | Exit code | Result |
| --- | ---: | --- |
| `go test ./...` | 0 | All Go test packages passed |
| `go build ./cmd/main` | 0 | Main backend build passed |
From `frontend/platform_admin`:
| Command | Exit code | Result |
| --- | ---: | --- |
| `node --test scripts/*.test.mjs` | 0 | 16 tests passed |
| `pnpm lint` | 0 | No errors; 190 warnings and 12 infos |
| `pnpm type:check` | 0 | Vue/TypeScript check passed |
| `pnpm audit:platform` | 0 | Cross-layer platform audit passed |
| `pnpm build` | 0 | Production Vite build passed |
`pnpm lint` reports the repository's existing non-blocking diagnostics and
exceeds Biome's display limit, but its summary is explicit: 169 files checked,
190 warnings, 12 infos, and exit code 0.
## Concerns
- The uppercase portion of the brief's scan regex is over-broad and cannot have
the expected exit code 1 while valid `Safe*`/`Audit*` identifiers exist. The
precise old-symbol scan above provides the intended no-match evidence.
- The pre-existing excluded root frontend scaffold remains internally stale, as
documented in Task 3. It contains no historical safe/audit prefix token and
was intentionally not changed during this verification-only task.
- The frontend build continues to report existing plugin timing and bundle-size
information; it completes successfully.