/ frontend / src / types / rollback.ts
rollback.ts
 1  // Rollback types for ACDC Forge
 2  
 3  import type { Chain, PullRequest } from './vote'
 4  
 5  // Checkpoint represents a verified state of the codebase
 6  export interface Checkpoint {
 7    commitHash: string
 8    radicleOid: string
 9    approverCount: number
10    finalizedAt: number
11    chain: Chain
12    repoId: string
13  }
14  
15  // Dependency relationship between PRs
16  export interface PRDependency {
17    prHash: string
18    dependsOn: string[] // PR hashes this PR depends on
19    dependedBy: string[] // PR hashes that depend on this PR
20    repoId: string
21  }
22  
23  // Rollback target - a safe point to rollback to
24  export interface RollbackTarget {
25    checkpoint: Checkpoint
26    prHash: string | null // The PR that created this checkpoint (null for genesis)
27    commitMessage: string
28    author: string
29    timestamp: number
30  }
31  
32  // Impact analysis of a potential rollback
33  export interface RollbackImpact {
34    targetCheckpoint: Checkpoint
35    affectedPrs: PullRequest[]
36    brokenDependencies: PRDependency[]
37    estimatedDowntime: number // seconds
38    riskLevel: 'low' | 'medium' | 'high' | 'critical'
39    warnings: string[]
40  }
41  
42  // Rollback request submitted for governance vote
43  export interface RollbackRequest {
44    id: string
45    targetCheckpoint: Checkpoint
46    currentCheckpoint: Checkpoint
47    reason: string
48    requestedBy: string
49    requestedAt: number
50    status: 'pending' | 'voting' | 'approved' | 'rejected' | 'executed'
51    governanceProposalId: string | null
52    impact: RollbackImpact
53  }
54  
55  // Rollback execution result
56  export interface RollbackResult {
57    success: boolean
58    executedAt: number
59    previousCheckpoint: Checkpoint
60    newCheckpoint: Checkpoint
61    executedBy: string
62    transactionHash: string
63  }