Skip to content

Commit a2ef81b

Browse files
committed
test(cli): classify makeDirectorySync in the build/validate parity ledger; the credentials test mocks the bounded walk
Claude-Session: https://claude.ai/code/session_018t6a5rvqPRvEDMCVVW9kYT Co-authored-by: Claude <noreply@anthropic.com>
1 parent d188c03 commit a2ef81b

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎packages/cli/test/remote-api-utils.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ import { createApiClient, requireAuth } from '../src/utils/api-client';
33
import { readAuthConfig, writeAuthConfig, deleteAuthConfig, getCredentialsPath } from '../src/utils/auth-config';
44
import { formatOutput } from '../src/utils/output-formatter';
55
import * as fs from 'node:fs/promises';
6+
import { makeDirectorySync } from '../src/utils/make-directory';
67

78
// Mock fs module
89
vi.mock('node:fs/promises');
10+
// The credentials directory is made through the CLI's bounded walk (#23858),
11+
// which is synchronous `node:fs`: mocked too, so this file writes nothing real.
12+
vi.mock('../src/utils/make-directory');
913

1014
describe('API Client Utilities', () => {
1115
describe('createApiClient', () => {
@@ -75,7 +79,7 @@ describe('Auth Config Utilities', () => {
7579

7680
describe('writeAuthConfig', () => {
7781
it('should write credentials to file with correct permissions', async () => {
78-
const mockMkdir = vi.mocked(fs.mkdir);
82+
const mockMakeDirectory = vi.mocked(makeDirectorySync);
7983
const mockWriteFile = vi.mocked(fs.writeFile);
8084

8185
const config = {
@@ -87,10 +91,7 @@ describe('Auth Config Utilities', () => {
8791

8892
await writeAuthConfig(config);
8993

90-
expect(mockMkdir).toHaveBeenCalledWith(
91-
expect.stringContaining('.objectstack'),
92-
{ recursive: true }
93-
);
94+
expect(mockMakeDirectory).toHaveBeenCalledWith(expect.stringContaining('.objectstack'));
9495

9596
expect(mockWriteFile).toHaveBeenCalledWith(
9697
expect.stringContaining('credentials.json'),

‎packages/cli/test/validate-build-gate-parity.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,12 @@ const NOT_A_GATE: Readonly<Record<string, readonly string[]>> = {
347347
// build's warning count. It reads no stack and refuses nothing: every row
348348
// it selects is one `lowerCallables` produced.
349349
'isExtractionRefusal',
350+
// [#23858] Makes the `--output` directory `os build` writes the artifact
351+
// into — the bounded stand-in for the `fs.mkdirSync(…, { recursive: true })`
352+
// that stood there (`fs` is classified below). It reads no stack and
353+
// judges nothing; what it can refuse is a path the operating system
354+
// refuses, with that system's own code.
355+
'makeDirectorySync',
350356
],
351357
// [commit 8b4890343] Reads a fact about the TOOLCHAIN, not about the input. The
352358
// ADR-0087 D4 `release` section is computed at publish time from the two

0 commit comments

Comments
 (0)