Files
platforms/.superpowers/sdd/2026-07-27-safe-audit-model-prefix-rename/task-1-report.md

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, and safe_event_disposal under safety; audit_operation_log, audit_export_log, and audit_approval under audit.
  • Backend routes: /safety/safe_*, the safe-event disposal action, /audit/audit_*, and the audit-approval action.
  • Frontend resource definitions: required safe_event and audit_approval resource/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).

  • TestSafeAndAuditResourceContracts reports the missing safety/safe_rule contract; the current catalogue still defines saf_rule (and the other historical saf_*/aud_* names).
  • TestPlatformDeviceSafetyCommerceAndDeliveryRoutesFollowTheirContracts reports unregistered /heqi/platform/v1/safety/safe_* routes and the safe_event disposal route.
  • TestPlatformFinanceContentAndAuditRoutesFollowTheirContracts reports 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 because src/api/resources.ts currently defines saf_event at /safety/saf_event; it therefore does not match the required safe_event declaration. The required audit_approval declaration 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.