Files
Kilo-Org_kilocode/packages/opencode/test/kilocode/server/httpapi-public.test.ts
T
Imanol Maiztegui 8e053f34b5 refactor(opencode): extract indexing event schema and align OpenAPI contracts
Move the IndexingStatus Effect schema out of the KiloIndexing namespace into
a dedicated `indexing-event.ts` module so it can be shared between the bus
event system and the HttpApi layer without circular imports.

Additionally fix several OpenAPI spec inconsistencies:
- Inline PermissionReplyBody into the endpoint payload schema
- Make `organizationId` nullable in the organization set endpoint
- Replace opaque string response for `/kilo/fim` with a structured
  streaming completion schema
- Register `indexing.status` as a typed SSE event in the global event union
- Add `matchLegacyKiloOpenApi` post-processor for backward-compatible
  nullable fields and FIM response shape
- Relocate Kilo-specific bridge tests to `test/kilocode/server/` and trim
  duplicated assertions from the core bridge test file
2026-05-19 10:50:52 +02:00

25 lines
886 B
TypeScript

import { describe, expect, test } from "bun:test"
import { OpenApi } from "effect/unstable/httpapi"
import { KiloGatewayPaths } from "../../../src/kilocode/server/httpapi/groups/kilo-gateway"
import { PublicApi } from "../../../src/server/routes/instance/httpapi/public"
type Schema = {
anyOf?: Schema[]
properties?: Record<string, Schema>
type?: string
}
type Body = {
content?: Record<string, { schema?: Schema }>
}
describe("Kilo PublicApi OpenAPI contract", () => {
test("keeps personal organization resets nullable", () => {
const spec = OpenApi.fromApi(PublicApi)
const body = spec.paths[KiloGatewayPaths.organization]?.post?.requestBody as Body | undefined
const schema = body?.content?.["application/json"]?.schema
const props = schema?.properties
expect(props?.organizationId).toEqual({ anyOf: [{ type: "string" }, { type: "null" }] })
})
})