Remove pre-1.0 audit and protected request scaffolding

This commit is contained in:
npc0-hue
2026-08-20 23:42:02 +08:00
parent 40b35b05c7
commit a7e2e4c6c0
130 changed files with 526 additions and 3767 deletions
+3 -3
View File
@@ -12,12 +12,12 @@ Required model groups:
- jobs and job events.
- artifacts and chunks.
- log streams and ingestion cursors.
- audit events.
- durable alerts and their acknowledgement/resolution audit links.
- operational events.
- durable alerts and their acknowledgement/resolution metadata.
- server-bound plugin lifecycle installations and linked jobs.
- reviewable AI config diffs and approval fences.
Every implemented database model must include field comments, JSON/database tags, and an explicit table name function or equivalent mapping in the chosen stack.
# Durable Client Manager persistence
File and MySQL stores persist the Client Manager installation aggregate, component sessions, registration nonce fences, and lifecycle audit references. Session tokens are stored only as hashes; nonce and heartbeat sequence checks are bounded and restart-safe. Reset, ownership/endpoint reassignment, update activation, rollback, revoke, and uninstall fence or expire component sessions without deleting distribution or audit history.
File and MySQL stores persist the Client Manager installation aggregate, component sessions, registration nonce fences, and lifecycle metadata. Session tokens are stored only as hashes; nonce and heartbeat sequence checks are bounded and restart-safe. Reset, ownership/endpoint reassignment, update activation, rollback, revoke, and uninstall fence or expire component sessions without deleting distribution history.
+4 -79
View File
@@ -183,7 +183,7 @@ type GamePlugin struct {
Tags []string `json:"tags" db:"tags"`
// AIPurposes stores platform-mediated AI usage purposes.
AIPurposes []string `json:"aiPurposes" db:"ai_purposes"`
// ProductionLifecycle stores declared server-bound plugin lifecycle governance.
// ProductionLifecycle stores declared server-bound plugin lifecycle operations.
ProductionLifecycle domain.GamePluginProductionLifecycle `json:"productionLifecycle" db:"production_lifecycle"`
// RemoteAccess stores plugin-declared remote access metadata.
RemoteAccess GamePluginRemoteAccess `json:"remoteAccess" db:"remote_access"`
@@ -319,7 +319,7 @@ type JobExecutionResult struct {
Version int `json:"version,omitempty" db:"version"`
Checksum string `json:"checksum,omitempty" db:"checksum"`
SizeBytes int64 `json:"sizeBytes,omitempty" db:"size_bytes"`
AuditSummary string `json:"auditSummary,omitempty" db:"audit_summary"`
Summary string `json:"summary,omitempty" db:"summary"`
Content string `json:"content,omitempty" db:"content"`
}
@@ -433,53 +433,6 @@ type LogStream struct {
func (LogStream) TableName() string { return "log_streams" }
type AuditEvent struct {
// ID is the stable audit event identifier.
ID string `json:"id" db:"id"`
// ActorID references the user or system actor.
ActorID string `json:"actorId" db:"actor_id"`
// Action is the stable action key.
Action string `json:"action" db:"action"`
// ResourceKind identifies the audited resource type.
ResourceKind string `json:"resourceKind" db:"resource_kind"`
// ResourceID identifies the audited resource.
ResourceID string `json:"resourceId" db:"resource_id"`
// Result is the audit outcome.
Result domain.AuditResult `json:"result" db:"result"`
// Summary is a bounded redacted summary.
Summary string `json:"summary" db:"summary"`
// CreatedAt is the audit timestamp.
CreatedAt time.Time `json:"createdAt" db:"created_at"`
}
func (AuditEvent) TableName() string { return "audit_events" }
type Alert struct {
ID string `json:"id" db:"id"`
SourceKind string `json:"sourceKind" db:"source_kind"`
SourceID string `json:"sourceId" db:"source_id"`
RuleKey string `json:"ruleKey" db:"rule_key"`
Severity domain.AlertSeverity `json:"severity" db:"severity"`
State domain.AlertState `json:"state" db:"state"`
Title string `json:"title" db:"title"`
Message string `json:"message" db:"message"`
OccurrenceCount int `json:"occurrenceCount" db:"occurrence_count"`
Retryable bool `json:"retryable" db:"retryable"`
RetryAfterSeconds int `json:"retryAfterSeconds" db:"retry_after_seconds"`
LastJobID string `json:"lastJobId,omitempty" db:"last_job_id"`
LastAuditEventID string `json:"lastAuditEventId,omitempty" db:"last_audit_event_id"`
LastSeenAt time.Time `json:"lastSeenAt" db:"last_seen_at"`
AcknowledgedBy string `json:"acknowledgedBy,omitempty" db:"acknowledged_by"`
AcknowledgedAt time.Time `json:"acknowledgedAt,omitempty" db:"acknowledged_at"`
ResolvedBy string `json:"resolvedBy,omitempty" db:"resolved_by"`
ResolvedAt time.Time `json:"resolvedAt,omitempty" db:"resolved_at"`
ResolutionNote string `json:"resolutionNote,omitempty" db:"resolution_note"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
func (Alert) TableName() string { return "alerts" }
type PluginLifecycleInstallation struct {
ID string `json:"id" db:"id"`
PluginID string `json:"pluginId" db:"plugin_id"`
@@ -493,8 +446,6 @@ type PluginLifecycleInstallation struct {
Compatibility string `json:"compatibility" db:"compatibility"`
DependencyState domain.DependencyState `json:"dependencyState" db:"dependency_state"`
JobID string `json:"jobId,omitempty" db:"job_id"`
AlertID string `json:"alertId,omitempty" db:"alert_id"`
AuditEventID string `json:"auditEventId,omitempty" db:"audit_event_id"`
FailureReason string `json:"failureReason,omitempty" db:"failure_reason"`
IdempotencyKey string `json:"idempotencyKey" db:"idempotency_key"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
@@ -930,11 +881,11 @@ func (input JobExecutionInput) ToDomain() domain.JobExecutionInput {
}
func executionResultFromDomain(result domain.JobExecutionResult) JobExecutionResult {
return JobExecutionResult{Kind: result.Kind, ProcessState: result.ProcessState, ExitClassification: result.ExitClassification, ExitCode: result.ExitCode, Version: result.Version, Checksum: result.Checksum, SizeBytes: result.SizeBytes, AuditSummary: result.AuditSummary, Content: result.Content}
return JobExecutionResult{Kind: result.Kind, ProcessState: result.ProcessState, ExitClassification: result.ExitClassification, ExitCode: result.ExitCode, Version: result.Version, Checksum: result.Checksum, SizeBytes: result.SizeBytes, Summary: result.Summary, Content: result.Content}
}
func (result JobExecutionResult) ToDomain() domain.JobExecutionResult {
return domain.JobExecutionResult{Kind: result.Kind, ProcessState: result.ProcessState, ExitClassification: result.ExitClassification, ExitCode: result.ExitCode, Version: result.Version, Checksum: result.Checksum, SizeBytes: result.SizeBytes, AuditSummary: result.AuditSummary, Content: result.Content}
return domain.JobExecutionResult{Kind: result.Kind, ProcessState: result.ProcessState, ExitClassification: result.ExitClassification, ExitCode: result.ExitCode, Version: result.Version, Checksum: result.Checksum, SizeBytes: result.SizeBytes, Summary: result.Summary, Content: result.Content}
}
func (policy JobRetryPolicy) ToDomain() domain.JobRetryPolicy {
@@ -1020,29 +971,3 @@ func (stream LogStream) ToDomain() domain.LogStream {
UpdatedAt: stream.UpdatedAt,
}
}
func AuditEventFromDomain(event domain.AuditEvent) AuditEvent {
return AuditEvent{
ID: event.ID,
ActorID: event.ActorID,
Action: event.Action,
ResourceKind: event.ResourceKind,
ResourceID: event.ResourceID,
Result: event.Result,
Summary: event.Summary,
CreatedAt: event.CreatedAt,
}
}
func (event AuditEvent) ToDomain() domain.AuditEvent {
return domain.AuditEvent{
ID: event.ID,
ActorID: event.ActorID,
Action: event.Action,
ResourceKind: event.ResourceKind,
ResourceID: event.ResourceID,
Result: event.Result,
Summary: event.Summary,
CreatedAt: event.CreatedAt,
}
}
-2
View File
@@ -17,8 +17,6 @@ func TestTableNames(t *testing.T) {
Job{}.TableName(): "jobs",
Artifact{}.TableName(): "artifacts",
LogStream{}.TableName(): "log_streams",
AuditEvent{}.TableName(): "audit_events",
Alert{}.TableName(): "alerts",
PluginLifecycleInstallation{}.TableName(): "plugin_lifecycle_installations",
AIConfigDiff{}.TableName(): "ai_config_diffs",
ClientManagerInstallation{}.TableName(): "client_manager_installations",