Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
139 lines
3.8 KiB
JavaScript
139 lines
3.8 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
|
|
import {
|
|
buildChangedGoValidationLanes,
|
|
parseChangedGoValidationArgs
|
|
} from "./run-changed-go-validation.mjs";
|
|
|
|
const moduleRoots = [
|
|
"packages/agent/daemon",
|
|
"packages/agent/session-replay",
|
|
"services/tuttid"
|
|
];
|
|
|
|
describe("parseChangedGoValidationArgs", () => {
|
|
it("parses the CI selection options", () => {
|
|
assert.deepEqual(
|
|
parseChangedGoValidationArgs([
|
|
"--base",
|
|
"base-sha",
|
|
"--head",
|
|
"head-sha",
|
|
"--kind",
|
|
"test",
|
|
"--max-parallel",
|
|
"2",
|
|
"--tail-lines",
|
|
"400"
|
|
]),
|
|
{
|
|
baseRef: "base-sha",
|
|
headRef: "head-sha",
|
|
kind: "test",
|
|
maxParallel: 2,
|
|
tailLines: 400
|
|
}
|
|
);
|
|
});
|
|
|
|
it("rejects an incomplete selector", () => {
|
|
assert.throws(
|
|
() => parseChangedGoValidationArgs(["--kind", "test"]),
|
|
/--base is required/
|
|
);
|
|
assert.throws(
|
|
() =>
|
|
parseChangedGoValidationArgs(["--base", "base-sha", "--kind", "all"]),
|
|
/--kind requires lint or test/
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("buildChangedGoValidationLanes", () => {
|
|
it("runs only the changed package for an ordinary Go change", () => {
|
|
const lanes = buildChangedGoValidationLanes({
|
|
changedFiles: ["packages/agent/daemon/runtime/session.go"],
|
|
kind: "test",
|
|
moduleRoots,
|
|
pathExists: () => true,
|
|
root: "/repo"
|
|
});
|
|
|
|
assert.equal(lanes.length, 1);
|
|
assert.equal(lanes[0].label, "test:go (packages/agent/daemon)");
|
|
assert.match(
|
|
lanes[0].command[2],
|
|
/cd packages\/agent\/daemon && go test \.\/runtime\/\.\.\./
|
|
);
|
|
});
|
|
|
|
it("uses the same package scope for lint", () => {
|
|
const lanes = buildChangedGoValidationLanes({
|
|
changedFiles: ["packages/agent/daemon/runtime/session.go"],
|
|
kind: "lint",
|
|
moduleRoots,
|
|
pathExists: () => true,
|
|
root: "/repo"
|
|
});
|
|
|
|
assert.equal(lanes.length, 1);
|
|
assert.equal(lanes[0].label, "lint:go (packages/agent/daemon)");
|
|
assert.match(lanes[0].command[2], /golangci-lint run/);
|
|
assert.match(lanes[0].command[2], / \.\/runtime$/);
|
|
assert.doesNotMatch(lanes[0].command[2], /generate:builtin-apps/);
|
|
});
|
|
|
|
it("keeps a changed module-root package scoped to the module root", () => {
|
|
const lanes = buildChangedGoValidationLanes({
|
|
changedFiles: ["services/tuttid/wiring.go"],
|
|
kind: "test",
|
|
moduleRoots,
|
|
pathExists: () => true,
|
|
root: "/repo"
|
|
});
|
|
|
|
assert.equal(lanes.length, 1);
|
|
assert.match(lanes[0].command[2], /cd services\/tuttid && .*go test \.$/u);
|
|
assert.doesNotMatch(lanes[0].command[2], /go test \.\/\.\.\./u);
|
|
});
|
|
|
|
it("does not expand lint beyond the established lint module set", () => {
|
|
const lanes = buildChangedGoValidationLanes({
|
|
changedFiles: ["packages/agent/session-replay/replay.go"],
|
|
kind: "lint",
|
|
moduleRoots,
|
|
pathExists: () => true,
|
|
root: "/repo"
|
|
});
|
|
|
|
assert.deepEqual(lanes, []);
|
|
});
|
|
|
|
it("does not create Go lanes for shared selection code changes", () => {
|
|
const lanes = buildChangedGoValidationLanes({
|
|
changedFiles: ["tools/scripts/run-changed-go-validation.mjs"],
|
|
kind: "test",
|
|
moduleRoots,
|
|
pathExists: () => true,
|
|
root: "/repo"
|
|
});
|
|
|
|
assert.deepEqual(lanes, []);
|
|
});
|
|
|
|
it("ensures builtin assets only for the selected tuttid lane", () => {
|
|
const lanes = buildChangedGoValidationLanes({
|
|
changedFiles: ["services/tuttid/service/workspace/apps.go"],
|
|
kind: "test",
|
|
moduleRoots,
|
|
pathExists: () => true,
|
|
root: "/repo"
|
|
});
|
|
|
|
assert.equal(lanes.length, 1);
|
|
assert.match(lanes[0].command[2], /package:builtin:check/);
|
|
assert.match(lanes[0].command[2], /go test \.\/service\/workspace\/\.\.\./);
|
|
});
|
|
});
|