(
workspaceId: string,
filePath: string,
error: unknown
)
| 671 | } |
| 672 | |
| 673 | private async renameCorruptGoal( |
| 674 | workspaceId: string, |
| 675 | filePath: string, |
| 676 | error: unknown |
| 677 | ): Promise<void> { |
| 678 | const corruptPath = `${filePath}.corrupt-${Date.now()}`; |
| 679 | try { |
| 680 | await fs.rename(filePath, corruptPath); |
| 681 | } catch (renameError) { |
| 682 | if (!isNotFound(renameError)) { |
| 683 | log.warn("Failed to rename corrupt goal.json", { workspaceId, error: renameError }); |
| 684 | } |
| 685 | } |
| 686 | log.warn("Ignoring corrupt goal.json", { workspaceId, corruptPath, error }); |
| 687 | await this.pushSnapshot(workspaceId, null); |
| 688 | } |
| 689 | |
| 690 | private async readGoalFile(workspaceId: string): Promise<GoalRecordV1 | null> { |
| 691 | const filePath = this.getFilePath(workspaceId); |
no test coverage detected