2.0 KiB
2.0 KiB
Task 1 Report: Safe and Audit Resource Rename Contracts
Scope
Added only RED contract tests. No production source, database table, or data migration code was changed.
Contract Coverage
- Backend resource catalogue:
safe_rule,safe_event,safe_inspection, andsafe_event_disposalundersafety;audit_operation_log,audit_export_log, andaudit_approvalunderaudit. - Backend routes:
/safety/safe_*, the safe-event disposal action,/audit/audit_*, and the audit-approval action. - Frontend resource definitions: required
safe_eventandaudit_approvalresource/path declarations.
RED Evidence
Backend
Command run from backend/api:
$env:GIN_MODE='release'; go test ./internal/logic/platform ./internal/routers -run 'Test.*(Safe|Audit)' -v
Result: failed as expected (exit code 1).
TestSafeAndAuditResourceContractsreports the missingsafety/safe_rulecontract; the current catalogue still definessaf_rule(and the other historicalsaf_*/aud_*names).TestPlatformDeviceSafetyCommerceAndDeliveryRoutesFollowTheirContractsreports unregistered/heqi/platform/v1/safety/safe_*routes and thesafe_eventdisposal route.TestPlatformFinanceContentAndAuditRoutesFollowTheirContractsreports unregistered/heqi/platform/v1/audit/audit_*routes and/audit/audit_approval/:identity/approve.
Frontend
Command run from frontend/platform_admin:
node --test scripts/audit-check.test.mjs
Result: failed as expected (exit code 1; 6 passing, 1 failing).
- The new
资源定义使用 safe 和 audit 前缀test fails becausesrc/api/resources.tscurrently definessaf_eventat/safety/saf_event; it therefore does not match the requiredsafe_eventdeclaration. The requiredaudit_approvaldeclaration remains absent as well.
Handoff
The red baseline is intentional. The next task should rename production resource contracts, backend routes, and frontend definitions without preserving the historical public names.