research: delete Hono backend (do not merge) (#25667)

This commit is contained in:
Kit Langton
2026-05-09 09:10:42 -04:00
committed by GitHub
parent 32684e70e6
commit 28b03595bf
81 changed files with 224 additions and 7566 deletions

View File

@@ -1,5 +1,4 @@
import { afterEach, describe, expect, test } from "bun:test"
import { Flag } from "@opencode-ai/core/flag/flag"
import * as Log from "@opencode-ai/core/util/log"
import { Server } from "../../src/server/server"
import { resetDatabase } from "../fixture/db"
@@ -7,17 +6,13 @@ import { disposeAllInstances } from "../fixture/fixture"
void Log.init({ print: false })
const original = Flag.OPENCODE_EXPERIMENTAL_HTTPAPI
afterEach(async () => {
Flag.OPENCODE_EXPERIMENTAL_HTTPAPI = original
await disposeAllInstances()
await resetDatabase()
})
function app(experimental: boolean) {
Flag.OPENCODE_EXPERIMENTAL_HTTPAPI = experimental
return experimental ? Server.Default().app : Server.Legacy().app
function app() {
return Server.Default().app
}
const PREFLIGHT_HEADERS = {
@@ -33,19 +28,8 @@ const PREFLIGHT_HEADERS = {
// cached for one origin against a different origin. corsVaryFixLayer
// restores the merged form.
describe("CORS preflight Vary header", () => {
test("Hono backend preflight Vary contains Origin", async () => {
const response = await app(false).request("/global/config", {
method: "OPTIONS",
headers: PREFLIGHT_HEADERS,
})
expect([200, 204]).toContain(response.status)
expect(response.headers.get("access-control-allow-origin")).toBe("http://localhost:3000")
expect((response.headers.get("vary") ?? "").toLowerCase()).toContain("origin")
})
test("HTTP API backend preflight Vary contains Origin", async () => {
const response = await app(true).request("/global/config", {
const response = await app().request("/global/config", {
method: "OPTIONS",
headers: PREFLIGHT_HEADERS,
})
@@ -56,7 +40,7 @@ describe("CORS preflight Vary header", () => {
})
test("HTTP API backend preflight Vary still preserves Access-Control-Request-Headers", async () => {
const response = await app(true).request("/global/config", {
const response = await app().request("/global/config", {
method: "OPTIONS",
headers: PREFLIGHT_HEADERS,
})
@@ -67,7 +51,7 @@ describe("CORS preflight Vary header", () => {
})
test("HTTP API backend does not duplicate Origin in Vary", async () => {
const response = await app(true).request("/global/config", {
const response = await app().request("/global/config", {
method: "OPTIONS",
headers: PREFLIGHT_HEADERS,
})
@@ -75,8 +59,8 @@ describe("CORS preflight Vary header", () => {
const vary = response.headers.get("vary") ?? ""
const originCount = vary
.split(",")
.map((s) => s.trim().toLowerCase())
.filter((s) => s === "origin").length
.map((s: string) => s.trim().toLowerCase())
.filter((s: string) => s === "origin").length
expect(originCount).toBe(1)
})
})