mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
Add a "Save to Runs" button that creates a run from the current playground draft (create-only — no execution) and surfaces server errors inline, alongside the existing Download/Run-for-real actions. Two server-compatibility fixes make playground-built manifests actually accepted at run creation: - Drop `[run.sandbox]` from the generated workflow.toml. The server parses that file into a `RunLayer` with `deny_unknown_fields` and no `sandbox` field, so the section made the whole manifest unparseable (400). Sandbox selection moves to project.toml's `[environments.default]`, the supported home for it. - Clamp the goal-derived run title to the server's 100 code-point limit (counting by code point to match Rust's `chars().count()`), so long goals no longer get rejected.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
|
|
import { createInitialDraft } from "../state/draft";
|
|
import { renderProjectToml, renderWorkflowToml } from "./render-toml";
|
|
|
|
describe("renderWorkflowToml", () => {
|
|
test("points the workflow at its graph without an unsupported [run.sandbox] section", () => {
|
|
// The server's RunLayer parses workflow.toml with deny_unknown_fields and
|
|
// has no `sandbox` field, so a `[run.sandbox]` section makes the manifest
|
|
// unparseable. Sandbox selection lives in project.toml instead.
|
|
expect(renderWorkflowToml(createInitialDraft())).toBe(
|
|
[
|
|
"_version = 1",
|
|
"",
|
|
"[workflow]",
|
|
'graph = "workflow.fabro"',
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("renderProjectToml", () => {
|
|
test("enables draft PRs and pins the default environment to the local sandbox", () => {
|
|
expect(renderProjectToml(createInitialDraft())).toBe(
|
|
[
|
|
"_version = 1",
|
|
"",
|
|
"[run.pull_request]",
|
|
"enabled = true",
|
|
"draft = true",
|
|
"",
|
|
"[environments.default]",
|
|
'provider = "local"',
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
});
|
|
});
|