Skip to content

Commit b51adeb

Browse files
committed
test(release): Keep current version checks from going stale
The repo is already on 2.3.0, but the release truth test and manual publish fallback were still pinned to 2.2.0. Derive the assertions from package metadata and normalize macOS temp paths so the full suite checks the real contract instead of local path spelling.
1 parent 55b97b9 commit b51adeb

3 files changed

Lines changed: 30 additions & 13 deletions

File tree

‎.github/workflows/publish-npm-on-release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ on:
88
workflow_dispatch:
99
inputs:
1010
tag:
11-
description: 'Tag to publish (e.g. v2.2.0)'
11+
description: 'Tag to publish (e.g. v2.3.0)'
1212
required: true
13-
default: 'v2.2.0'
13+
default: 'v2.3.0'
1414

1515
permissions:
1616
contents: read

‎tests/contextbench-baseline-schema-gate.test.ts‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { execFileSync } from 'node:child_process';
2-
import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2+
import {
3+
chmodSync,
4+
mkdtempSync,
5+
readFileSync,
6+
realpathSync,
7+
rmSync,
8+
writeFileSync
9+
} from 'node:fs';
310
import { tmpdir } from 'node:os';
411
import path from 'node:path';
512
import { describe, expect, it, vi } from 'vitest';
@@ -55,6 +62,10 @@ function cleanupSessionRoot(sessionRoot: string): void {
5562
}
5663
}
5764

65+
function normalizeFilesystemPath(filePath: string): string {
66+
return realpathSync(filePath);
67+
}
68+
5869
function tempSessionRoot(phase: 'phase40' | 'phase41' = 'phase40'): string {
5970
return path.join(
6071
mkdtempSync(path.join(tmpdir(), `contextbench-${phase}-schema-gate-`)),
@@ -398,7 +409,9 @@ describe('ContextBench Phase 40 schema gate', () => {
398409
repoCheckoutPath: repoPath,
399410
verificationStrict: false
400411
});
401-
expect(readFileSync(cwdCapturePath, 'utf8')).toBe(repoPath);
412+
expect(normalizeFilesystemPath(readFileSync(cwdCapturePath, 'utf8'))).toBe(
413+
normalizeFilesystemPath(repoPath)
414+
);
402415
const stdin = readFileSync(stdinCapturePath, 'utf8');
403416
expect(stdin).toContain('Problem statement:');
404417
expect(stdin).toContain('Fix the failing ContextBench task');
@@ -584,7 +597,9 @@ describe('ContextBench Phase 40 schema gate', () => {
584597
],
585598
{ encoding: 'utf8', env }
586599
);
587-
expect(readFileSync(cwdPath, 'utf8')).toBe(repoPath);
600+
expect(normalizeFilesystemPath(readFileSync(cwdPath, 'utf8'))).toBe(
601+
normalizeFilesystemPath(repoPath)
602+
);
588603
}
589604
execFileSync(
590605
'node',
@@ -681,7 +696,9 @@ describe('ContextBench Phase 40 schema gate', () => {
681696
(candidate) => candidate.scoring && 'baselineArmId' in candidate.scoring
682697
);
683698
expect(row).toMatchObject({ status: 'completed' });
684-
expect(readFileSync(cwdCapturePath, 'utf8')).toBe(repoPath);
699+
expect(normalizeFilesystemPath(readFileSync(cwdCapturePath, 'utf8'))).toBe(
700+
normalizeFilesystemPath(repoPath)
701+
);
685702
const stdin = readFileSync(stdinCapturePath, 'utf8');
686703
expect(stdin).toContain('Problem statement:');
687704
expect(stdin).toContain('Run the diagnostic arm with materialized task text.');

‎tests/release-truth-surfaces.test.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ function extractMarkdownLinks(markdown: string): string[] {
7373
describe('release truth surfaces', () => {
7474
const packageJson = readJson<PackageJson>('package.json');
7575
const releaseManifest = readJson<ReleaseManifest>('.release-please-manifest.json');
76+
const expectedVersion = packageJson.version;
7677
const changelog = readText('CHANGELOG.md');
7778
const readme = readText('README.md');
7879
const workflow = readText('.github/workflows/publish-npm-on-release.yml');
7980
const todoDoc = readOptionalText('docs/TODO.md');
8081
const visualsDoc = readOptionalText('docs/visuals.md');
8182
const packagedPaths = ['README.md', 'LICENSE', ...(packageJson.files ?? [])];
8283

83-
it('keeps package metadata, release manifest, and changelog on 2.2.0', () => {
84-
expect(packageJson.version).toBe('2.2.0');
85-
expect(releaseManifest['.']).toBe('2.2.0');
86-
expect(changelog).toContain('## [2.2.0]');
84+
it('keeps package metadata, release manifest, and changelog aligned', () => {
85+
expect(releaseManifest['.']).toBe(expectedVersion);
86+
expect(changelog).toContain(`## [${expectedVersion}]`);
8787
expect(changelog).not.toContain('## Unreleased');
8888
});
8989

@@ -114,8 +114,8 @@ describe('release truth surfaces', () => {
114114
expect(visualsDoc).toContain('Historical snapshot');
115115
});
116116

117-
it('keeps the manual publish fallback aligned to v2.2.0', () => {
118-
expect(workflow).toContain("description: 'Tag to publish (e.g. v2.2.0)'");
119-
expect(workflow).toContain("default: 'v2.2.0'");
117+
it('keeps the manual publish fallback aligned to the package version', () => {
118+
expect(workflow).toContain(`description: 'Tag to publish (e.g. v${expectedVersion})'`);
119+
expect(workflow).toContain(`default: 'v${expectedVersion}'`);
120120
});
121121
});

0 commit comments

Comments
 (0)