fix: resolve TypeScript errors in orchestrator and API
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Fixed CI typecheck failures: - Added missing AgentLifecycleService dependency to AgentsController test mocks - Made validateToken method async to match service return type - Fixed formatting in federation.module.ts All affected tests pass. Typecheck now succeeds. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -135,7 +135,7 @@ export class FederationAuthController {
|
|||||||
*/
|
*/
|
||||||
@Post("validate")
|
@Post("validate")
|
||||||
@Throttle({ short: { limit: 3, ttl: 1000 } })
|
@Throttle({ short: { limit: 3, ttl: 1000 } })
|
||||||
validateToken(@Body() dto: ValidateFederatedTokenDto): FederatedTokenValidation {
|
async validateToken(@Body() dto: ValidateFederatedTokenDto): Promise<FederatedTokenValidation> {
|
||||||
this.logger.debug(`Validating federated token from ${dto.instanceId}`);
|
this.logger.debug(`Validating federated token from ${dto.instanceId}`);
|
||||||
|
|
||||||
return this.oidcService.validateToken(dto.token, dto.instanceId);
|
return this.oidcService.validateToken(dto.token, dto.instanceId);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { ConfigModule } from "@nestjs/config";
|
|||||||
import { HttpModule } from "@nestjs/axios";
|
import { HttpModule } from "@nestjs/axios";
|
||||||
import { ThrottlerModule } from "@nestjs/throttler";
|
import { ThrottlerModule } from "@nestjs/throttler";
|
||||||
import { FederationController } from "./federation.controller";
|
import { FederationController } from "./federation.controller";
|
||||||
import { FederationAuthController} from "./federation-auth.controller";
|
import { FederationAuthController } from "./federation-auth.controller";
|
||||||
import { FederationService } from "./federation.service";
|
import { FederationService } from "./federation.service";
|
||||||
import { CryptoService } from "./crypto.service";
|
import { CryptoService } from "./crypto.service";
|
||||||
import { FederationAuditService } from "./audit.service";
|
import { FederationAuditService } from "./audit.service";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
|||||||
import { AgentsController } from "./agents.controller";
|
import { AgentsController } from "./agents.controller";
|
||||||
import { QueueService } from "../../queue/queue.service";
|
import { QueueService } from "../../queue/queue.service";
|
||||||
import { AgentSpawnerService } from "../../spawner/agent-spawner.service";
|
import { AgentSpawnerService } from "../../spawner/agent-spawner.service";
|
||||||
|
import { AgentLifecycleService } from "../../spawner/agent-lifecycle.service";
|
||||||
import { KillswitchService } from "../../killswitch/killswitch.service";
|
import { KillswitchService } from "../../killswitch/killswitch.service";
|
||||||
import type { KillAllResult } from "../../killswitch/killswitch.service";
|
import type { KillAllResult } from "../../killswitch/killswitch.service";
|
||||||
|
|
||||||
@@ -17,6 +18,9 @@ describe("AgentsController - Killswitch Endpoints", () => {
|
|||||||
let mockSpawnerService: {
|
let mockSpawnerService: {
|
||||||
spawnAgent: ReturnType<typeof vi.fn>;
|
spawnAgent: ReturnType<typeof vi.fn>;
|
||||||
};
|
};
|
||||||
|
let mockLifecycleService: {
|
||||||
|
getAgentLifecycleState: ReturnType<typeof vi.fn>;
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockKillswitchService = {
|
mockKillswitchService = {
|
||||||
@@ -32,9 +36,14 @@ describe("AgentsController - Killswitch Endpoints", () => {
|
|||||||
spawnAgent: vi.fn(),
|
spawnAgent: vi.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mockLifecycleService = {
|
||||||
|
getAgentLifecycleState: vi.fn(),
|
||||||
|
};
|
||||||
|
|
||||||
controller = new AgentsController(
|
controller = new AgentsController(
|
||||||
mockQueueService as unknown as QueueService,
|
mockQueueService as unknown as QueueService,
|
||||||
mockSpawnerService as unknown as AgentSpawnerService,
|
mockSpawnerService as unknown as AgentSpawnerService,
|
||||||
|
mockLifecycleService as unknown as AgentLifecycleService,
|
||||||
mockKillswitchService as unknown as KillswitchService
|
mockKillswitchService as unknown as KillswitchService
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { AgentsController } from "./agents.controller";
|
import { AgentsController } from "./agents.controller";
|
||||||
import { QueueService } from "../../queue/queue.service";
|
import { QueueService } from "../../queue/queue.service";
|
||||||
import { AgentSpawnerService } from "../../spawner/agent-spawner.service";
|
import { AgentSpawnerService } from "../../spawner/agent-spawner.service";
|
||||||
|
import { AgentLifecycleService } from "../../spawner/agent-lifecycle.service";
|
||||||
import { KillswitchService } from "../../killswitch/killswitch.service";
|
import { KillswitchService } from "../../killswitch/killswitch.service";
|
||||||
import { BadRequestException } from "@nestjs/common";
|
import { BadRequestException } from "@nestjs/common";
|
||||||
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
||||||
@@ -13,6 +14,9 @@ describe("AgentsController", () => {
|
|||||||
let spawnerService: {
|
let spawnerService: {
|
||||||
spawnAgent: ReturnType<typeof vi.fn>;
|
spawnAgent: ReturnType<typeof vi.fn>;
|
||||||
};
|
};
|
||||||
|
let lifecycleService: {
|
||||||
|
getAgentLifecycleState: ReturnType<typeof vi.fn>;
|
||||||
|
};
|
||||||
let killswitchService: {
|
let killswitchService: {
|
||||||
killAgent: ReturnType<typeof vi.fn>;
|
killAgent: ReturnType<typeof vi.fn>;
|
||||||
killAllAgents: ReturnType<typeof vi.fn>;
|
killAllAgents: ReturnType<typeof vi.fn>;
|
||||||
@@ -28,6 +32,10 @@ describe("AgentsController", () => {
|
|||||||
spawnAgent: vi.fn(),
|
spawnAgent: vi.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lifecycleService = {
|
||||||
|
getAgentLifecycleState: vi.fn(),
|
||||||
|
};
|
||||||
|
|
||||||
killswitchService = {
|
killswitchService = {
|
||||||
killAgent: vi.fn(),
|
killAgent: vi.fn(),
|
||||||
killAllAgents: vi.fn(),
|
killAllAgents: vi.fn(),
|
||||||
@@ -37,6 +45,7 @@ describe("AgentsController", () => {
|
|||||||
controller = new AgentsController(
|
controller = new AgentsController(
|
||||||
queueService as unknown as QueueService,
|
queueService as unknown as QueueService,
|
||||||
spawnerService as unknown as AgentSpawnerService,
|
spawnerService as unknown as AgentSpawnerService,
|
||||||
|
lifecycleService as unknown as AgentLifecycleService,
|
||||||
killswitchService as unknown as KillswitchService
|
killswitchService as unknown as KillswitchService
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user