Skip to content

Commit 978cc36

Browse files
icecrasher321claude
andcommitted
fix(copilot): keep the withheld-result tests out of the secret scanners
The withheld-run fixture was shaped like a live provider key, which is exactly what a secret scanner is built to catch — it flagged the test file itself. The value only has to clear the eight-character substitution floor, so it says what it is instead. The id-shape guard likewise no longer needs a credential-looking string to prove it refuses one. Also routes the test's error-message mock through getErrorMessage rather than reimplementing it inline, which check:utils bans. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 353cc82 commit 978cc36

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

apps/sim/lib/copilot/request/tools/resolved-secret-result.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ describe('effect disclosure on a withheld result', () => {
484484
{
485485
success: false,
486486
error: 'why',
487-
effect: { phase: 'performed', ids: { executionId: 'sk-live-9Qv2XbTn4LmZa8Rd' } },
487+
effect: { phase: 'performed', ids: { executionId: 'not-a-server-minted-id' } },
488488
},
489489
undefined,
490490
'run_workflow'

apps/sim/lib/copilot/tools/handlers/workflow/withheld-run-result.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* on its arguments, a call that threw after dispatch, and a run that completed. All three
1212
* used to arrive as the same sentence.
1313
*/
14+
import { getErrorMessage } from '@sim/utils/errors'
1415
import { beforeEach, describe, expect, it, vi } from 'vitest'
1516
import { inspectToolResultForCopilot } from '@/lib/copilot/request/tools/resolved-secret-result'
1617
import type { ExecutionContext } from '@/lib/copilot/request/types'
@@ -26,7 +27,7 @@ vi.mock('@/lib/copilot/application/execute-workflow-use-case', () => ({
2627
executeCopilotWorkflowUseCase: mocks.executeWorkflowUseCase,
2728
/** Passthrough, so a masked message is visible as masking rather than as a fallback. */
2829
messageForCopilotWorkflowError: (error: unknown, fallback = 'Workflow operation failed') =>
29-
error instanceof Error ? error.message : fallback,
30+
getErrorMessage(error, fallback),
3031
}))
3132

3233
vi.mock('@/lib/workflows/sanitization/json-sanitizer', () => ({
@@ -40,7 +41,9 @@ vi.mock('@/lib/core/telemetry', () => ({
4041
import { executeRunWorkflow } from '@/lib/copilot/tools/handlers/workflow/mutations'
4142

4243
const EXECUTION_ID = '0f4d5a4c-6a1e-4c2f-9b7d-2c8f1a3e5d90'
43-
const SECRET = 'sk-live-9Qv2XbTn4LmZa8Rd'
44+
/** Above the 8-char substitution floor, and deliberately not shaped like any real
45+
* provider credential — a realistic-looking fixture makes secret scanners flag this file. */
46+
const SECRET = 'fake-secret-for-test-only'
4447

4548
const context = {
4649
userId: 'user-1',

0 commit comments

Comments
 (0)