Skip to content

Commit d6edfad

Browse files
committed
test: stabilize release CI fixtures
1 parent 2eec6c0 commit d6edfad

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ and this project uses [Calendar Versioning (CalVer)](https://calver.org/) with n
7373
- **Codex skill context budget** - Codex uses the canonical shared
7474
`.agents/skills/` projection and deployment conformance prevents duplicate
7575
skill surfaces from exhausting the context budget (#1884).
76+
- **Deterministic CI fixtures** - daemon HTTP tests now ask the operating
77+
system for an available port, and Git-history peak-day fixtures use a fixed
78+
timestamp so concurrent processes and UTC midnight cannot cause release-gate
79+
failures.
7680

7781
### Security
7882

test/unit/daemon/web-server.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ describe('WebServer', () => {
7676
let supervisor;
7777
let baseUrl;
7878

79-
// Use a random high port to avoid conflicts
80-
const getPort = () => 10000 + Math.floor(Math.random() * 50000);
81-
8279
beforeEach(async () => {
8380
supervisor = new StubSupervisor();
84-
const port = getPort();
8581
server = new WebServer({
86-
port,
82+
// Let the OS allocate an available ephemeral port. Choosing a random
83+
// port still races with other processes between selection and listen.
84+
port: 0,
8785
host: '127.0.0.1',
8886
daemonSupervisor: supervisor,
8987
});
@@ -200,9 +198,8 @@ describe('WebServer', () => {
200198
let authedUrl;
201199

202200
beforeEach(async () => {
203-
const port = getPort();
204201
authedServer = new WebServer({
205-
port,
202+
port: 0,
206203
host: '127.0.0.1',
207204
token: 'secret-token',
208205
daemonSupervisor: supervisor,
@@ -325,8 +322,7 @@ describe('WebServer', () => {
325322
let noSupServer;
326323

327324
beforeEach(async () => {
328-
const port = getPort();
329-
noSupServer = new WebServer({ port, host: '127.0.0.1' });
325+
noSupServer = new WebServer({ port: 0, host: '127.0.0.1' });
330326
await noSupServer.start();
331327
});
332328

test/unit/intake/git-history-analyzer.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ def456|Jane|jane@example.com|1700100000|Another commit`;
178178
});
179179

180180
it('should identify peak day', () => {
181-
const now = Math.floor(Date.now() / 1000);
181+
// Keep the fixture away from a UTC day boundary. Using the live clock
182+
// made the five one-minute-spaced commits straddle midnight in CI.
183+
const now = Math.floor(Date.UTC(2026, 6, 15, 12, 0, 0) / 1000);
182184
const dayInSeconds = 24 * 60 * 60;
183185
const peakDate = new Date((now - dayInSeconds) * 1000).toISOString().split('T')[0];
184186

0 commit comments

Comments
 (0)