Skip to content

Commit 88503d9

Browse files
committed
test(dogfood): one item name per refused auth kind, so each case reads only its own write
Claude-Session: https://claude.ai/code/session_017xRBcVy4VXmkQjn2MGeaWk Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9d6f31d commit 88503d9

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎packages/qa/dogfood/test/connector-meta-door-credential-hardening.dogfood.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ const ALL_PLACEHOLDERS = Object.values(PLACEHOLDERS);
4343
const CONTROL_REF = 'CCH_CONTROL_CREDENTIAL_REF';
4444
const CONTROL = 'cch_control';
4545
const STORED = 'cch_stored';
46-
const REFUSED = 'cch_refused';
46+
/** One name per refused kind, so each case's "nothing is stored" reads only its own write. */
47+
const refusedName = (kind: string) => `cch_refused_${kind.replace(/-/g, '_')}`;
4748

4849
const rowsOf = (r: any): any[] => (Array.isArray(r) ? r : Array.isArray(r?.records) ? r.records : Array.isArray(r?.value) ? r.value : []);
4950
const bodyOf = (row: any): Record<string, any> =>
@@ -146,8 +147,9 @@ describe('connector metadata doors: inline credentials are refused on write and
146147
['api-key', { type: 'api-key', credentialRef: CONTROL_REF, key: PLACEHOLDERS.inlineKey }, 'key'],
147148
['basic', { type: 'basic', username: 'svc', credentialRef: CONTROL_REF, password: PLACEHOLDERS.inlinePassword }, 'password'],
148149
['none', { type: 'none', token: PLACEHOLDERS.inlineToken }, 'token'],
149-
] as const)('%s: 422 INVALID_METADATA located at `auth`, naming the key, and nothing is stored', async (_kind, auth, key) => {
150-
const res = await stack.apiAs(admin, 'PUT', `/meta/connector/${REFUSED}`, instance(REFUSED, { auth }));
150+
] as const)('%s: 422 INVALID_METADATA located at `auth`, naming the key, and nothing is stored', async (kind, auth, key) => {
151+
const name = refusedName(kind);
152+
const res = await stack.apiAs(admin, 'PUT', `/meta/connector/${name}`, instance(name, { auth }));
151153
const json = (await res.json()) as any;
152154
expect(res.status, JSON.stringify(json).slice(0, 400)).toBe(422);
153155
expect(json.code, JSON.stringify(json).slice(0, 400)).toBe('INVALID_METADATA');
@@ -156,7 +158,7 @@ describe('connector metadata doors: inline credentials are refused on write and
156158
expect(located, JSON.stringify(issues).slice(0, 400)).toBeDefined();
157159
expect(located!.message).toContain(`\`${key}\``);
158160
expect(holdsAPlaceholder(json), 'the refusal never echoes the value').toBe(false);
159-
expect(await stored(REFUSED)).toHaveLength(0);
161+
expect(await stored(name)).toHaveLength(0);
160162
});
161163
});
162164

0 commit comments

Comments
 (0)