mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
* feat!: remove Plan v1 distributed transport BREAKING CHANGE: Cloud adapters accept only Plan v2; producer v1 exports are removed. * ci: authorize Plan v1 cleanup deletions * docs: avoid citing generated smoke result file * fix(gcp): reject unsupported plan protocols in workflow * ci: preserve gcp package size reduction * fix: reject stale Plan v1 SDK options * chore: remove retired Plan parity scripts
89 lines
3.6 KiB
JavaScript
89 lines
3.6 KiB
JavaScript
import { strict as assert } from "node:assert";
|
|
import { test } from "node:test";
|
|
|
|
import { ALLOWED_DELETIONS, classify, parseBase } from "./check-no-main-deletions.mjs";
|
|
|
|
test("a branch that only adds reports nothing", () => {
|
|
const { deleted, renamed } = classify("A\tpackages/cli/src/new.ts\nM\tpackages/cli/src/old.ts\n");
|
|
assert.deepEqual(deleted, []);
|
|
assert.deepEqual(renamed, []);
|
|
});
|
|
|
|
test("a deleted file is named", () => {
|
|
const { deleted } = classify("D\t.agents/skills/README.md\nA\tsrc/new.ts\n");
|
|
assert.deepEqual(deleted, [".agents/skills/README.md"]);
|
|
});
|
|
|
|
test("a rename is not reported as a deletion", () => {
|
|
// The false alarm worth avoiding: in a name-only diff a rename looks exactly
|
|
// like loss, and a check that cried wolf on every move would be turned off.
|
|
const { deleted, renamed } = classify("R096\tsrc/old/name.ts\tsrc/new/name.ts\n");
|
|
assert.deepEqual(deleted, []);
|
|
assert.deepEqual(renamed, [{ from: "src/old/name.ts", to: "src/new/name.ts" }]);
|
|
});
|
|
|
|
test("deletions and renames are separated in one diff", () => {
|
|
const { deleted, renamed } = classify(
|
|
"D\tdocs/gone.md\nR100\ta.ts\tb.ts\nM\tc.ts\nD\tdocs/also-gone.md\n",
|
|
);
|
|
assert.deepEqual(deleted, ["docs/gone.md", "docs/also-gone.md"]);
|
|
assert.equal(renamed.length, 1);
|
|
});
|
|
|
|
test("the base ref defaults, and an explicit one is honoured", () => {
|
|
assert.equal(parseBase([]), "origin/main");
|
|
assert.equal(parseBase(["--base", "origin/release"]), "origin/release");
|
|
});
|
|
|
|
test("a --base with no value fails rather than silently defaulting", () => {
|
|
// Silently falling back would diff against the wrong ref and report a pass.
|
|
assert.throws(() => parseBase(["--base"]), /needs a ref/);
|
|
assert.throws(() => parseBase(["--base", "--other"]), /needs a ref/);
|
|
});
|
|
|
|
test("every agreed deletion names a path and says why", () => {
|
|
// The guard has no blanket override on purpose: a flag or an env var would
|
|
// be reached for by the branch deleting something by accident. An entry has
|
|
// to be written down, so the removal shows up in review.
|
|
for (const [path, reason] of ALLOWED_DELETIONS) {
|
|
assert.ok(path.length > 0, "an allowed deletion needs a path");
|
|
assert.ok(
|
|
reason && reason.length > 10,
|
|
`${path} needs a reason, got ${JSON.stringify(reason)}`,
|
|
);
|
|
}
|
|
});
|
|
|
|
test("the allowlist does not silence an unrelated deletion", () => {
|
|
const { deleted } = classify("D\tpackages/cli/src/something-else.ts\n");
|
|
assert.deepEqual(deleted, ["packages/cli/src/something-else.ts"]);
|
|
assert.equal(ALLOWED_DELETIONS.has("packages/cli/src/something-else.ts"), false);
|
|
});
|
|
|
|
test("the Chrome beat analyzer removal is explicitly scoped", () => {
|
|
for (const path of [
|
|
"packages/cli/src/beats/headlessAnalyzer.ts",
|
|
"packages/cli/scripts/build-beat-analyzer.mjs",
|
|
])
|
|
assert.match(ALLOWED_DELETIONS.get(path) ?? "", /TypeScript beat tracker/);
|
|
assert.equal(ALLOWED_DELETIONS.has("packages/core/src/beats/beatDetection.ts"), false);
|
|
});
|
|
|
|
test("the Plan v1 cleanup allowlist is limited to samples and the rollout harness", () => {
|
|
for (const path of [
|
|
"examples/aws-lambda/sample-events/plan-v1.json",
|
|
"examples/gcp-cloud-run/sample-events/plan-v1.json",
|
|
])
|
|
assert.match(ALLOWED_DELETIONS.get(path) ?? "", /no longer a supported cloud transport/);
|
|
|
|
assert.match(
|
|
ALLOWED_DELETIONS.get("packages/producer/src/plan-parity-harness.ts") ?? "",
|
|
/completed Plan v1-to-v2 rollout harness/,
|
|
);
|
|
assert.match(
|
|
ALLOWED_DELETIONS.get("examples/aws-lambda/scripts/_semantic-compare.sh") ?? "",
|
|
/completed Plan v1-to-v2 rollout harness/,
|
|
);
|
|
assert.equal(ALLOWED_DELETIONS.has("packages/producer/src/services/distributed/plan.ts"), false);
|
|
});
|