MCPcopy Create free account
hub / github.com/coder/mux / renameCorruptGoal

Method renameCorruptGoal

src/node/services/workspaceGoalService.ts:673–688  ·  view source on GitHub ↗
(
    workspaceId: string,
    filePath: string,
    error: unknown
  )

Source from the content-addressed store, hash-verified

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);

Callers 1

readGoalFileMethod · 0.95

Calls 3

pushSnapshotMethod · 0.95
isNotFoundFunction · 0.85
renameMethod · 0.65

Tested by

no test coverage detected