From 8d17864fd625f08ec55e84899f93c2150dfaf49a Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 3 May 2026 16:21:04 +0500 Subject: [PATCH] fix(ci): resolve two test failures introduced in dev branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Guard `run.progress` before calling `retainProvisioningProgress` in `TeamProvisioningService.cleanupRun` — test mocks omit the field, causing 4 crashes with "Cannot read properties of undefined (reading 'warnings')". - Invalidate the `TeamConfigReader` list-teams cache immediately after a successful team launch so `GET /api/teams` returns the fully-created team (no `pendingCreate`) rather than a 5-second-stale entry from before `config.json` was written. --- src/main/http/teams.ts | 2 ++ src/main/services/team/TeamProvisioningService.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/http/teams.ts b/src/main/http/teams.ts index 906d0915..19adbfa3 100644 --- a/src/main/http/teams.ts +++ b/src/main/http/teams.ts @@ -1,4 +1,5 @@ import { validateTeammateName, validateTeamName } from '@main/ipc/guards'; +import { TeamConfigReader } from '@main/services/team/TeamConfigReader'; import { getTeamsBasePath } from '@main/utils/pathDecoder'; import { extractUserFlags, PROTECTED_CLI_FLAGS } from '@shared/utils/cliArgsParser'; import { @@ -551,6 +552,7 @@ export function registerTeamRoutes(app: FastifyInstance, services: HttpServices) parseLaunchRequest(teamName, request.body), () => undefined ); + TeamConfigReader.invalidateListTeamsCache(); return reply.send(response); } catch (error) { const statusCode = getStatusCode(error); diff --git a/src/main/services/team/TeamProvisioningService.ts b/src/main/services/team/TeamProvisioningService.ts index dce403c8..d0933ff6 100644 --- a/src/main/services/team/TeamProvisioningService.ts +++ b/src/main/services/team/TeamProvisioningService.ts @@ -24809,7 +24809,9 @@ export class TeamProvisioningService { } } // Remove from runs Map to free memory (stdoutBuffer, stderrBuffer, claudeLogLines) - this.retainProvisioningProgress(run.runId, run.progress); + if (run.progress) { + this.retainProvisioningProgress(run.runId, run.progress); + } this.runs.delete(run.runId); }