Range check: build each package's own tagged version too, and bump cultnet-ts to 0.4.0
All checks were successful
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Successful in 21m29s

The declared-range check skipped a dependency's own version, so a package that gained an export while still carrying its latest tag's version passed. cultmesh-ts imported seven names cultnet-ts-v0.3.0 lacks. The check now builds that tag (through the package's own build, with repo contracts), a fixture test pins the failure, and cultnet-ts (Unreleased holds Breaking entries) is 0.4.0 with its dependents' ranges at ^0.4.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Libby 2026-11-12 19:51:59 +00:00
commit 584f144f39
7 changed files with 77 additions and 11 deletions

View file

@ -22,6 +22,7 @@ import { fileURLToPath } from "node:url";
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const rootRequire = createRequire(join(repoRoot, "package.json"));
const ts = rootRequire("typescript");
const npmCli = join(npmRoot(), "bin", "npm-cli.js");
const semver = createRequire(join(npmRoot(), "package.json"))("semver");
// npm ships semver, so the check needs no dependency of its own. npm's root is beside the node binary on Windows and under lib/ on Unix.
@ -84,16 +85,17 @@ function sourceFiles(directory) {
});
}
// Builds the package as the tag released it, in a scratch directory that borrows the workspace's node_modules.
// Builds the package as the tag released it (with the repo-level contracts its generator reads), in a scratch directory that borrows the workspace's node_modules.
function buildRelease(directory, tag, scratch) {
const archive = join(scratch, `${tag}.tar`);
git("archive", "--format=tar", "-o", archive, tag, `packages/${directory}`);
git("archive", "--format=tar", "-o", archive, tag, `packages/${directory}`, "contracts");
const extracted = join(scratch, tag);
mkdirSync(extracted);
execFileSync("tar", ["-xf", archive, "-C", extracted]);
symlinkSync(join(repoRoot, "node_modules"), join(extracted, "node_modules"), "junction");
const packageRoot = join(extracted, "packages", directory);
execFileSync(process.execPath, [rootRequire.resolve("typescript/bin/tsc"), "-p", "tsconfig.json"], { cwd: packageRoot, stdio: "inherit" });
// The package's own build, which is how a release was made: cultnet-ts generates its contracts module first.
execFileSync(process.execPath, [npmCli, "run", "build", "--silent"], { cwd: packageRoot, stdio: "inherit" });
return rootRequire(join(packageRoot, "dist", "index.js"));
}
@ -127,7 +129,7 @@ try {
const prefix = `${dependency.directory}-v`;
const admitted = tags.filter((tag) => {
const version = tag.startsWith(prefix) ? tag.slice(prefix.length) : undefined;
return version !== undefined && semver.valid(version) !== null && semver.satisfies(version, range) && version !== dependency.manifest.version;
return version !== undefined && semver.valid(version) !== null && semver.satisfies(version, range);
});
for (const tag of admitted) {
if (!built.has(tag)) {