Public: anyone can read this; the crew can change it.
A person imports a Claude Code or Codex session from /traces in the browser #18382
Merged 3h 47m ago, live in production
scout/forge:scout/18376-a-person-imports-a-claude-code-or-codex → main 0 commits fork 5 threads · 5 unresolved
docs/features/traces.md +4
| @@ -65,6 +65,10 @@ A new source is one file implementing `ImportAdapter` (`src/trace/import_adapter | ||
| 65 | 65 | |
| 66 | 66 | `GET /api/v1/traces/:id` answers the thread, its turns and their steps as one tree, rebuilt from the raw log with `parseRunLog` (a Talk turn's log is a run log): the thread's figures are the list's row (model, account, tokens in, cached and out, cost, outcome, started, ended, steps, errors), each step has its start and end in ms, kind, name, line, model, tokens and outcome (a run log holds no tokens per step, so those are 0). `timed` is false where the log kept no times. `truncated` is true when the log's start was cut (it is read from its last 512 KB) or it holds more than `MAX_STEPS` (20,000) steps. A trace the caller may not see answers exactly as an unknown id: 404 `not_found`. The tree is answered whole (about 15 ms for 5,000 steps). Code: `readTraceTree` in `src/http/api/traces.ts`. |
| 67 | 67 | |
| 68 | ## Import from the page (#18376) | |
| 69 | ||
| 70 | `/traces` has an **Import** control for a signed-in person: choose a Claude Code or Codex session file (`.jsonl`, 32 MiB at most; kept private to you) and press Import (`POST /traces/import`, a same-origin multipart form, `src/web/pages/trace_import.ts`). It is the API's importer, `importSession` and its `ADAPTERS`, with the same cap and per-account quota; the filename is never used. On success you land on `/traces/<id>`; a file that is too big, not a session or over quota draws `/traces` again with the reason and stores nothing. Cross-site posts are a 403 and a signed-out post is refused. Terminal: `y` in the Traces screen (`src/tui/screens/traces.ts`) says where the form is on the web: the terminal runs on the forge's host, so a path typed there would read the host's files, not the person's; the API (`POST /api/v1/traces/import`) takes a file from any client. | |
| 71 | ||
| 68 | 72 | ## Saved searches (#18369) |
| 69 | 73 | |
| 70 | 74 | A search you repeat (a repository, a model, a failed outcome, a tool) is kept under a name and is one tap away. A saved search is a name and the query string `/traces` already takes; each person keeps at most 50, private to them, and a name used twice replaces its query. A trace is never touched: removing deletes the saved query only, so the control says so and asks for no typed name. |
src/http/lazy_lists.ts +1
src/http/routes/operations.ts +2
| @@ -26,6 +26,7 @@ import { tracePage, traceStep } from "../../web/pages/trace.ts"; | ||
| 26 | 26 | import { traceComparePage } from "../../web/pages/trace_compare.ts"; |
| 27 | 27 | import { traceShare, traceShared, traceUnshare } from "../../web/pages/trace_share.ts"; |
| 28 | 28 | import { tracesPage } from "../../web/pages/traces.ts"; |
| 29 | import { traceImport } from "../../web/pages/trace_import.ts"; | |
| 29 | 30 | import { traceSave, traceSavedRemove } from "../../web/pages/traces_saved.ts"; |
| 30 | 31 | import { oauthCallbackUri } from "../api.ts"; |
| 31 | 32 | import { gamesRoutes } from "../games_routes.ts"; |
| @@ -125,6 +126,7 @@ export function operationsRoutes(router: Router<Handler>, knownPatterns: () => s | ||
| 125 | 126 | router.add("GET", "/runs/:id", runRedirect); |
| 126 | 127 | // A crew run as a tree of steps (#17993). Literal, above /:owner. |
| 127 | 128 | router.add("GET", "/traces", tracesPage); |
| 129 | router.add("POST", "/traces/import", traceImport); | |
| 128 | 130 | router.add("POST", "/traces/saved", traceSave); |
| 129 | 131 | router.add("POST", "/traces/saved/:id/remove", traceSavedRemove); |
| 130 | 132 | router.add("GET", "/traces/:id", tracePage); |
src/tui/screens/traces.ts +3 −2
| @@ -81,7 +81,7 @@ function tracesScreen(f: Session, ctx: Ctx): Screen { | ||
| 81 | 81 | }; |
| 82 | 82 | return { |
| 83 | 83 | title: "Traces", |
| 84 | keys: [binding(["j", "k"], "move"), binding(["enter"], "open the trace"), binding(["v"], "mark"), binding(["d"], "compare marked"), binding(["n"], "older"), binding(["/"], "search"), binding(["i", "r", "m", "o", "p"], "kind, repo, model, outcome, person"), binding(["u", "e"], "tool used, file touched"), binding(["f", "t"], "from, to day"), binding(["b", "w", "x"], "open, save, remove a saved search"), binding(["c"], "clear filters"), binding(["esc"], "close")], | |
| 84 | keys: [binding(["j", "k"], "move"), binding(["enter"], "open the trace"), binding(["v"], "mark"), binding(["d"], "compare marked"), binding(["n"], "older"), binding(["/"], "search"), binding(["i", "r", "m", "o", "p"], "kind, repo, model, outcome, person"), binding(["u", "e"], "tool used, file touched"), binding(["f", "t"], "from, to day"), binding(["b", "w", "x"], "open, save, remove a saved search"), binding(["y"], "import a session on the web"), binding(["c"], "clear filters"), binding(["esc"], "close")], | |
| 85 | 85 | render(area, s) { |
| 86 | 86 | const c = ctx.theme.c; |
| 87 | 87 | s.text(area.x, area.y, truncate(`${typing === undefined ? "/ to search" : typing === "q" ? "Search" : typing === "from" ? "From (YYYY-MM-DD)" : typing === "to" ? "To (YYYY-MM-DD)" : typing === "tool" ? "Tool (Edit, Bash…)" : "File (path)"}: ${typing === undefined || typing === "q" ? (facet.q ?? "") : (facet[typing] ?? "")}${typing === undefined ? "" : "_"}${summary()}`, area.w), style(c.fg, c.bg), area.x + area.w); |
| @@ -156,7 +156,8 @@ function tracesScreen(f: Session, ctx: Ctx): Screen { | ||
| 156 | 156 | if (repo === undefined || !sameIssue(ra, rb)) ctx.toast("those two are not runs of one issue", "attn"); |
| 157 | 157 | else ctx.push(traceScreen(f, ctx, repo, ra.id, rb.id)); |
| 158 | 158 | } |
| 159 | } else if (e.key === "c") { | |
| 159 | } else if (e.key === "y") openOnWeb(f, ctx, "/traces#traces-import", "the import form (a file input)"); | |
| 160 | else if (e.key === "c") { | |
| 160 | 161 | for (const k of Object.keys(facet)) delete facet[k as keyof typeof facet]; |
| 161 | 162 | before = undefined; |
| 162 | 163 | read(); |
src/web/form.ts +5
| @@ -96,6 +96,11 @@ export function refused(form: Form, errors: Record<string, string>): Refused { | ||
| 96 | 96 | return { form, errors }; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | /** A refusal that carries messages only, for a handler with no typed values to keep. */ | |
| 100 | export function refusal(errors: Record<string, string>): Refused { | |
| 101 | return { form: new FormData() as unknown as Form, errors }; | |
| 102 | } | |
| 103 | ||
| 99 | 104 | /** |
| 100 | 105 | * A refusal a page draws in place: a POST handler that has no page of its own |
| 101 | 106 | * stashes it against the request, then calls the GET page, whose form reads it |
src/web/pages/trace_import.ts added +33
| @@ -0,0 +1,33 @@ | ||
| 1 | /** | |
| 2 | * POST /traces/import (#18376): the file a person chose on `/traces`, through the one importer | |
| 3 | * (`importSession` and its adapters) with the API's cap and quota. A same-origin multipart form | |
| 4 | * (`readForm`: cross-site is 403, signed out is 403). The filename is never used: only the bytes. | |
| 5 | * Success lands on the new trace; a refused file draws `/traces` again with the reason (422, or | |
| 6 | * 413 for too big or over quota) and nothing is stored. | |
| 7 | */ | |
| 8 | import { importSession } from "../../trace/import.ts"; | |
| 9 | import { traceHref } from "../../trace/read.ts"; | |
| 10 | import type { Ctx } from "../../http/context.ts"; | |
| 11 | import { BODY_CAPS } from "../../http/limits.ts"; | |
| 12 | import { asRefusal, readForm, refuseHere, refusal } from "../form.ts"; | |
| 13 | import { flashTo } from "../layout.ts"; | |
| 14 | import { tracesPage } from "./traces.ts"; | |
| 15 | ||
| 16 | export async function traceImport(ctx: Ctx): Promise<Response> { | |
| 17 | const cap = BODY_CAPS.traceImport.bytes; | |
| 18 | const tooBig = `a session file is at most ${cap / 1048576} MiB`; | |
| 19 | const refuse = async (reason: string, status: 413 | 422): Promise<Response> => { | |
| 20 | refuseHere(ctx, refusal({ session: reason })); | |
| 21 | const res = await asRefusal(tracesPage(ctx)); | |
| 22 | return status === 422 ? res : new Response(res.body, { status, headers: res.headers }); | |
| 23 | }; | |
| 24 | // Counted as it arrives; the multipart framing is a little over the file. | |
| 25 | const form = await readForm(ctx, "rw", cap + 65536); | |
The cap is checked three times: against Content-Length, again inside readForm, and again on file.size. Keep the one that counts bytes actually read (readForm's cap plus the file.size check) and delete the Content-Length pre-check. The wording is also repeated three times, so build the message once. |
||
| 26 | if (form instanceof Response) return form.status === 413 ? refuse(tooBig, 413) : form; | |
| 27 | const file = form.get("session"); | |
| 28 | if (typeof file === "string" || file === null) return refuse("choose a session file to import", 422); | |
| 29 | if (file.size > cap) return refuse(tooBig, 413); | |
| 30 | const done = await importSession(ctx.app.db, ctx.app.config.dataDir, ctx.auth.user!.id, new Uint8Array(await file.arrayBuffer())); | |
| 31 | if (!done.ok) return refuse(done.reason, done.quota ? 413 : 422); | |
| 32 | return flashTo(ctx, traceHref(done.row.id), { message: done.updated ? "Session imported again: its trace was replaced." : "Session imported." }); | |
| 33 | } |
src/web/pages/traces.ts +14 −1
| @@ -10,9 +10,10 @@ import type { Ctx } from "../../http/context.ts"; | ||
| 10 | 10 | import { costWords, filterQuery, listTraces, OUTCOMES, SOURCES, readFilter, type TraceFilter, type TraceList, type TraceRow } from "../../trace/list.ts"; |
| 11 | 11 | import { openedSaved, NAME_MAX, savedWords, type OpenedSearch } from "../../trace/saved.ts"; |
| 12 | 12 | import { pageHead } from "../chrome.ts"; |
| 13 | import { refusedHere } from "../form.ts"; | |
| 13 | 14 | import { html, type Html } from "../html.ts"; |
| 14 | 15 | import { page } from "../layout.ts"; |
| 15 | import { badge, btn, disclosure, empty, listCard, row, time } from "../ui.ts"; | |
| 16 | import { badge, btn, field, disclosure, empty, listCard, row, time } from "../ui.ts"; | |
| 16 | 17 | |
| 17 | 18 | const FILTERS: readonly [keyof TraceFilter, string][] = [ |
| 18 | 19 | ["q", "Search"], |
| @@ -68,6 +69,16 @@ function controls(f: TraceFilter, list: TraceList): Html { | ||
| 68 | 69 | : html`<p class="small" id="traces-active">${active.map(([k, label]) => html`<a href="/traces${filterQuery(f, { [k]: undefined, before: undefined })}" aria-label="Remove ${label}: ${f[k] ?? ""}">${badge(`${label}: ${f[k] ?? ""}`, { variant: "secondary", icon: "x" })}</a> `)}</p>`}`; |
| 69 | 70 | } |
| 70 | 71 | |
| 72 | /** The import control (#18376): a file and a button, same-origin POST, for a signed-in viewer. */ | |
| 73 | function importForm(ctx: Ctx): Html | null { | |
| 74 | if (ctx.auth.user === undefined) return null; | |
| 75 | const why = refusedHere(ctx)?.errors.session; | |
| 76 | return html`<form method="post" action="/traces/import" enctype="multipart/form-data" class="traces-import" id="traces-import"> | |
| 77 | ${field({ name: "session", id: "traces-import-file", label: "Import a session (.jsonl, 32 MiB at most)", type: "file", accept: ".jsonl", required: true, ...(why === undefined ? {} : { error: why }) })} | |
Principle 1 and principle 8: the label explains itself in a long parenthetical (the file type, the size, 'private to you'). The page's sentence is the only explanation a page needs. Shorten the label to something like 'Import a session (.jsonl, 32 MiB at most)', and say once, in docs, that imports are private. The |
||
| 78 | ${btn("Import", { size: "sm" })} | |
| 79 | </form>`; | |
| 80 | } | |
| 81 | ||
| 71 | 82 | /** The viewer's saved searches as links above the results, and the forms that keep and end them. */ |
| 72 | 83 | function saved(f: TraceFilter, mine: readonly OpenedSearch[], searching: boolean): Html { |
| 73 | 84 | const keep = html`<form method="post" action="/traces/saved" class="bar small" id="traces-save"> |
| @@ -88,6 +99,7 @@ function saved(f: TraceFilter, mine: readonly OpenedSearch[], searching: boolean | ||
| 88 | 99 | } |
| 89 | 100 | |
| 90 | 101 | const CSS = ` |
| 102 | .traces-import{display:flex;flex-wrap:wrap;gap:.5rem;align-items:end;margin-bottom:.5rem} | |
| 91 | 103 | .traces-search{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin-bottom:.5rem} |
| 92 | 104 | .traces-search>.input{flex:1 1 14rem;min-width:0} |
| 93 | 105 | .traces-search .disclosure{flex:1 0 100%} |
| @@ -108,6 +120,7 @@ export function tracesPage(ctx: Ctx): Response { | ||
| 108 | 120 | const searching = Object.keys(f).some((k) => k !== "before"); |
| 109 | 121 | const body = html`${pageHead("Traces", { sub: "Every crew run, Talk turn and imported session you may open, newest first." })} |
| 110 | 122 | ${controls(f, list)} |
| 123 | ${importForm(ctx)} | |
| 111 | 124 | ${ctx.auth.user === undefined ? null : saved(f, mine, searching)} |
| 112 | 125 | ${list.unindexed === 0 |
| 113 | 126 | ? null |
src/web/ui.ts +3
| @@ -1290,6 +1290,8 @@ export interface FieldOptions { | ||
| 1290 | 1290 | inputmode?: "decimal" | "numeric"; |
| 1291 | 1291 | placeholder?: string; |
| 1292 | 1292 | pattern?: string; |
| 1293 | /** `type: "file"`'s accepted extensions, as the attribute spells them. */ | |
| 1294 | accept?: string; | |
| 1293 | 1295 | /** The id of a `<datalist>` (drawn with `after`) whose values it suggests. */ |
| 1294 | 1296 | list?: string; |
| 1295 | 1297 | minlength?: number; |
| @@ -1378,6 +1380,7 @@ ${o.value ?? ""}</textarea | ||
| 1378 | 1380 | ${o.autocomplete ? html`autocomplete="${o.autocomplete}"` : null} |
| 1379 | 1381 | ${o.inputmode ? html`inputmode="${o.inputmode}"` : null} |
| 1380 | 1382 | ${o.pattern ? html`pattern="${o.pattern}"` : null} |
| 1383 | ${o.accept ? html`accept="${o.accept}"` : null} | |
| 1381 | 1384 | ${o.list ? html`list="${o.list}"` : null} |
| 1382 | 1385 | ${o.minlength !== undefined ? html`minlength="${o.minlength}"` : null} |
| 1383 | 1386 | ${o.maxlength !== undefined ? html`maxlength="${o.maxlength}"` : null} |
test/private-by-default.test.ts +1
| @@ -122,6 +122,7 @@ const DOORS: Readonly<Record<string, Door>> = { | ||
| 122 | 122 | }, |
| 123 | 123 | "POST /settings/origins/apps": { noRepository: "an OAuth app for connecting origins" }, |
| 124 | 124 | "POST /talk/new": { noRepository: "a conversation" }, |
| 125 | "POST /traces/import": { noRepository: "a trace of an imported session" }, | |
| 125 | 126 | "mcp app_data_import": { noRepository: "an app's data" }, |
| 126 | 127 | "mcp branches create": { noRepository: "a branch" }, |
| 127 | 128 | "mcp claim_link": { noRepository: "a spawned forge's claim link" }, |
test/traces-import-page.test.ts added +118
| @@ -0,0 +1,118 @@ | ||
| 1 | /** | |
| 2 | * The import control on /traces (#18376): a chosen file goes through the one importer; a refusal | |
| 3 | * says why and stores nothing; cross-site and signed-out posts are refused. | |
| 4 | */ | |
| 5 | import { afterAll, beforeAll, expect, test } from "bun:test"; | |
| 6 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 7 | import { tmpdir } from "node:os"; | |
| 8 | import { join } from "node:path"; | |
| 9 | import { createApp, type App } from "../src/app.ts"; | |
| 10 | import { mkdirSync, statSync, writeFileSync } from "node:fs"; | |
| 11 | import { IMPORT_QUOTA_BYTES, importedId } from "../src/trace/import.ts"; | |
| 12 | import { createToken } from "../src/core/tokens.ts"; | |
| 13 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 14 | import { seedAdmin } from "./helpers/admin.ts"; | |
| 15 | ||
| 16 | const rec = (o: object): string => JSON.stringify({ sessionId: "sess-web", cwd: "/w", ...o }); | |
| 17 | const SESSION = [ | |
| 18 | rec({ type: "user", timestamp: "2026-12-01T09:00:00Z", message: { role: "user", content: "import from the page" } }), | |
| 19 | rec({ type: "assistant", timestamp: "2026-12-01T09:00:05Z", message: { id: "m2", model: "claude-x", role: "assistant", content: [{ type: "text", text: "Done" }], usage: { input_tokens: 6, output_tokens: 2 } } }), | |
| 20 | ].join("\n"); | |
| 21 | ||
| 22 | let dir = ""; | |
| 23 | let app: App; | |
| 24 | let servers: Servers; | |
| 25 | let token = ""; | |
| 26 | ||
| 27 | const post = (file: string, headers: Record<string, string> = { authorization: `Bearer ${token}` }): Promise<Response> => { | |
| 28 | const form = new FormData(); | |
| 29 | form.set("session", new File([file], "../../etc/x.jsonl")); | |
| 30 | return fetch(`${servers.url}/traces/import`, { method: "POST", headers, body: form, redirect: "manual" }); | |
| 31 | }; | |
| 32 | const stored = (): number => (app.db.query("SELECT COUNT(*) AS n FROM trace_index WHERE owner IS NOT NULL AND owner <> ''").get() as { n: number }).n; | |
| 33 | ||
| 34 | beforeAll(async () => { | |
| 35 | dir = await mkdtemp(join(tmpdir(), "forge-traces-import-page-")); | |
| 36 | app = createApp({ dataDir: dir, port: 0 }); | |
| 37 | servers = await serve(app); | |
| 38 | const a = await seedAdmin(app, { username: "alice", email: "[email protected]", password: "correct-horse-battery" }); | |
| 39 | if (!a.ok) throw new Error(a.error); | |
| 40 | token = createToken(app.db, a.value.id, "t", "rw").token; | |
| 41 | }, 30_000); | |
| 42 | ||
| 43 | afterAll(async () => { | |
| 44 | await servers.stop(); | |
| 45 | await rm(dir, { recursive: true, force: true }); | |
| 46 | }); | |
| 47 | ||
| 48 | test("the page offers the control to a signed-in person only", async () => { | |
| 49 | const mine = await (await fetch(`${servers.url}/traces`, { headers: { authorization: `Bearer ${token}` } })).text(); | |
| 50 | expect(mine).toContain('action="/traces/import"'); | |
| 51 | expect(mine).toContain('type="file"'); | |
| 52 | expect(await (await fetch(`${servers.url}/traces`)).text()).not.toContain('action="/traces/import"'); | |
| 53 | }); | |
| 54 | ||
| 55 | test("a valid session imports and opens", async () => { | |
| 56 | const res = await post(SESSION); | |
| 57 | expect(res.status).toBe(303); | |
| 58 | const to = res.headers.get("location") ?? ""; | |
| 59 | expect(to).toMatch(/^\/traces\/[0-9a-f]{32}/); | |
| 60 | expect(stored()).toBe(1); | |
| 61 | const opened = await fetch(`${servers.url}${to.split("?")[0]}`, { headers: { authorization: `Bearer ${token}` } }); | |
| 62 | expect(opened.status).toBe(200); | |
| 63 | }); | |
| 64 | ||
| 65 | test("a wrong file is refused with its reason and stores nothing more", async () => { | |
| 66 | const before = stored(); | |
| 67 | const res = await post("this is not a session\n"); | |
| 68 | expect(res.status).toBe(422); | |
| 69 | const text = await res.text(); | |
| 70 | expect(text).toContain("traces-import-file-err"); | |
| 71 | expect(stored()).toBe(before); | |
| 72 | const none = await post(""); | |
| 73 | expect(none.status).toBe(422); | |
| 74 | expect(stored()).toBe(before); | |
| 75 | }); | |
| 76 | ||
| 77 | test("a cross-site post is 403 and signed out is refused", async () => { | |
| 78 | const before = stored(); | |
| 79 | expect((await post(SESSION, { authorization: `Bearer ${token}`, origin: "https://evil.example" })).status).toBe(403); | |
| 80 | expect((await post(SESSION, {})).status).toBe(403); | |
| 81 | expect(stored()).toBe(before); | |
| 82 | }); | |
| 83 | ||
| 84 | test("a signed-out page shows no import control", async () => { | |
| 85 | const res = await fetch(`${servers.url}/traces`); | |
| 86 | expect(res.status).toBe(200); | |
| 87 | const text = await res.text(); | |
| 88 | expect(text).not.toContain('action="/traces/import"'); | |
| 89 | expect(text).not.toContain('type="file"'); | |
| 90 | }); | |
| 91 | ||
| 92 | test("the control says its one type and size, and accepts that type only", async () => { | |
| 93 | const text = await (await fetch(`${servers.url}/traces`, { headers: { authorization: `Bearer ${token}` } })).text(); | |
| 94 | expect(text).toContain("Import a session (.jsonl, 32 MiB at most)"); | |
| 95 | expect(text).toContain('accept=".jsonl"'); | |
| 96 | }); | |
| 97 | ||
| 98 | test("a file over the cap is a 413 naming the cap, and nothing is stored", async () => { | |
| 99 | const before = stored(); | |
| 100 | const res = await post("x".repeat(32 * 1048576 + 1)); | |
| 101 | expect(res.status).toBe(413); | |
| 102 | expect(await res.text()).toContain("a session file is at most 32 MiB"); | |
| 103 | expect(stored()).toBe(before); | |
| 104 | }); | |
| 105 | ||
| 106 | test("an account over its quota is a 413 with the reason, and the new session is not kept", async () => { | |
| 107 | const me = (app.db.query("SELECT id FROM user WHERE username = 'alice'").get() as { id: string }).id; | |
| 108 | const filler = importedId(me, "claude-code", "filler"); | |
| 109 | app.db.query("INSERT INTO trace_index (id, kind, title, started, ended, owner) VALUES (?1,'review','x','2026-12-01T00:00:00.000Z','2026-12-01T00:00:00.000Z',?2)").run(filler, me); | |
| 110 | const own = join(dir, "traces", "imported", `${importedId(me, "claude-code", "sess-web")}.jsonl.gz`); | |
| 111 | mkdirSync(join(dir, "traces", "imported"), { recursive: true }); | |
| 112 | writeFileSync(join(dir, "traces", "imported", `${filler}.jsonl.gz`), new Uint8Array(IMPORT_QUOTA_BYTES - statSync(own).size)); | |
| 113 | const before = stored(); | |
| 114 | const res = await post(SESSION.replaceAll("sess-web", "sess-other")); | |
| 115 | expect(res.status).toBe(413); | |
| 116 | expect(await res.text()).toContain("imported sessions are at most"); | |
| 117 | expect(stored()).toBe(before); | |
| 118 | }); |
test/traces-tui.test.ts +12
| @@ -87,3 +87,15 @@ test("i cycles the kind: runs, then only Talk, then only imported; Enter on an i | ||
| 87 | 87 | expect(after).toContain("an outside session"); // still on the list: nothing was pushed |
| 88 | 88 | app.stop(); |
| 89 | 89 | }); |
| 90 | ||
| 91 | test("y says where the import form is on the web, and the key is listed", async () => { | |
| 92 | const { app, session } = createForgeApp(forge, { sshUsername: "alice", remoteAddress: "127.0.0.1", user: alice }, { terminal: headlessTerminal(120, 30), exitHooks: false }); | |
| 93 | app.start(); | |
| 94 | await settleApp(app); | |
| 95 | entry.run(session, app.ctx); | |
| 96 | await settleApp(app); | |
| 97 | app.dispatch({ type: "key", key: "y", ctrl: false, alt: false, shift: false }); | |
| 98 | await settleApp(app); | |
| 99 | expect(app.screen.toText()).toContain("/traces#traces-import"); | |
| 100 | app.stop(); | |
| 101 | }); |
refused(new FormData() as never, ...)is a type cast used to get past the types, and it builds a fake form just to carry one message. Give form.ts a helper that takes the error message directly, or use an existing one. Do not cast tonever.