Skip to content

Commit 5d1dcb3

Browse files
committed
fix(codegen-ts): named package separator in the requirement walk, and hermetic strict-switch tests
The qualified address was built with a literal separator where PACKAGE_SEPARATOR exists. The verify end-to-end tests read the ambient META_REQUIRE_IMPLEMENTERS and failed with it exported; each test now starts with it unset and restores it after. Refs docs/superpowers/plans/2026-10-05-requirements-slice-1-checks-and-test-generators.md and ADR-0057.
1 parent 6df1fac commit 5d1dcb3

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎server/typescript/packages/cli/test/verify-requirements-e2e.test.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Each case drives the real command dispatcher, so a regression in the wiring —
1111
// requirements silently unhooked from the exit-code max, say — fails here.
1212

13-
import { test, expect, describe, spyOn } from "bun:test";
13+
import { test, expect, describe, spyOn, beforeEach, afterEach } from "bun:test";
1414
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
1515
import { tmpdir } from "node:os";
1616
import { join } from "node:path";
@@ -93,6 +93,19 @@ const L4 = {
9393
};
9494

9595
describe("meta verify — requirements exit-code contract", () => {
96+
// The strict switch is also an environment variable, and these tests assert the DEFAULT
97+
// severity. Whatever the shell that runs them has exported must not decide the outcome:
98+
// each test starts with the variable unset, and the shell's value is put back after.
99+
let ambientRequireImplementers: string | undefined;
100+
beforeEach(() => {
101+
ambientRequireImplementers = process.env.META_REQUIRE_IMPLEMENTERS;
102+
delete process.env.META_REQUIRE_IMPLEMENTERS;
103+
});
104+
afterEach(() => {
105+
if (ambientRequireImplementers === undefined) delete process.env.META_REQUIRE_IMPLEMENTERS;
106+
else process.env.META_REQUIRE_IMPLEMENTERS = ambientRequireImplementers;
107+
});
108+
96109
test("a clean requirement tree exits 0", async () => {
97110
const dir = project(req({ ...L4, "@implementedBy": ["Order"] }));
98111
expect(await run(["verify", "--cwd", dir])).toBe(0);

‎server/typescript/packages/codegen-ts/src/requirement-walk.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import { createHash } from "node:crypto";
1616
import {
17+
PACKAGE_SEPARATOR,
1718
TYPE_REQUIREMENT,
1819
REQUIREMENT_SUBTYPE_FUNCTIONAL,
1920
REQUIREMENT_LINK_FLOOR_LEVEL,
@@ -292,7 +293,7 @@ export function requirementTestIdentity(
292293
): RequirementTestIdentity {
293294
const { path, status } = w.view;
294295
const pkg = w.view.package;
295-
const address = pkg === "" ? path : `${pkg}::${path}`;
296+
const address = pkg === "" ? path : `${pkg}${PACKAGE_SEPARATOR}${path}`;
296297
// Derived from the loader's status list rather than naming the two skipped statuses:
297298
// a status that does not claim the capability works right now is skipped by
298299
// construction, so a status added later cannot be left failing by omission.

0 commit comments

Comments
 (0)