Skip to content

Commit adb60d0

Browse files
icecrasher321claude
andcommitted
test(provenance): pin the new reasons and the guard that latched in production
Cover what the reason set is for rather than only that it compiles: the non-enumerable tool-params branch now asserts it names `tool-input-not-enumerable`, which is the guard the production logs showed reporting `unspecified`, and every new literal asserts which stream it reports on — error for a guard that cannot trip on a healthy run, warn for one reachable without a fault, silent for the by-design log-less session. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent fde7c6b commit adb60d0

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

apps/sim/executor/utils/resolved-secret-trace-registry.test.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,52 @@ describe('incompleteness diagnostics', () => {
14431443
expect(reasons).not.toContain('value-provenance-filter-incomplete')
14441444
})
14451445

1446+
it.each([
1447+
'tool-input-not-enumerable',
1448+
'tool-params-transform-failed',
1449+
'structural-input-projection-incomplete',
1450+
'mothership-provenance-invalid',
1451+
'client-tool-seal-failed',
1452+
'knowledge-row-content-mismatch',
1453+
'backfill-scope-mismatch',
1454+
] as const)('reports %s at error, since it cannot trip on a healthy run', (reason) => {
1455+
new ResolvedSecretTraceRegistry([], scope).markIncomplete(reason)
1456+
1457+
expect(mockLogger.error).toHaveBeenCalledWith(
1458+
'Resolved secret registry marked incomplete',
1459+
expect.objectContaining({ reason })
1460+
)
1461+
expect(mockLogger.warn).not.toHaveBeenCalled()
1462+
})
1463+
1464+
it.each([
1465+
'mothership-provenance-missing',
1466+
'client-tool-completion-unavailable',
1467+
'client-tool-execution-untrusted',
1468+
'knowledge-result-provenance-unavailable',
1469+
'knowledge-response-capacity-exceeded',
1470+
'memory-crossing-capacity-exceeded',
1471+
'workspace-scope-missing',
1472+
'mounted-file-provenance-unavailable',
1473+
'table-snapshot-unsafe-for-mount',
1474+
'restored-provenance-untrusted',
1475+
] as const)('reports %s at warn, since it is reachable without a fault', (reason) => {
1476+
new ResolvedSecretTraceRegistry([], scope).markIncomplete(reason)
1477+
1478+
expect(mockLogger.warn).toHaveBeenCalledWith(
1479+
'Resolved secret registry marked incomplete',
1480+
expect.objectContaining({ reason })
1481+
)
1482+
expect(mockLogger.error).not.toHaveBeenCalled()
1483+
})
1484+
1485+
it('does not report a log-less session at all, since it fires on every such run', () => {
1486+
new ResolvedSecretTraceRegistry([], scope).markIncomplete('log-creation-skipped')
1487+
1488+
expect(mockLogger.error).not.toHaveBeenCalled()
1489+
expect(mockLogger.warn).not.toHaveBeenCalled()
1490+
})
1491+
14461492
it('reports an incoming incomplete bundle at warn, since no catalog was ever on offer', () => {
14471493
const registry = new ResolvedSecretTraceRegistry([], scope)
14481494

apps/sim/tools/index.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,22 @@ describe('executeTool Function', () => {
19381938
expect(fetchMock).toHaveBeenCalled()
19391939
})
19401940

1941+
/**
1942+
* The shape that latched in production with `reason: "unspecified"` — a getter or symbol key on
1943+
* the params record makes the input lineage unboundable, and the fork is marked before the tool
1944+
* runs. Pinned by name so a refusal downstream can be traced back to this guard.
1945+
*/
1946+
it('names the guard when tool params are not enumerable plain data', async () => {
1947+
const registry = new ResolvedSecretTraceRegistry()
1948+
const params: Record<string, unknown> = { code: 'return "unreachable"' }
1949+
Object.defineProperty(params, 'envVars', { enumerable: true, get: () => ({}) })
1950+
1951+
await executeTool('function_execute', params, { resolvedSecretTraceRegistry: registry })
1952+
1953+
expect(registry.isComplete()).toBe(false)
1954+
expect(registry.getIncompletenessDiagnostics()?.reasons).toContain('tool-input-not-enumerable')
1955+
})
1956+
19411957
it('runs a private-provenance call when its input lineage cannot be bounded', async () => {
19421958
const registry = new ResolvedSecretTraceRegistry()
19431959
const incompleteToolRegistry = registry.forkForToolCall()

0 commit comments

Comments
 (0)