Skip to content

Commit a6f9351

Browse files
Copilotdata-douser
andcommitted
Address code review: add advisory comment on existsSync, improve test assertions
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
1 parent 243cbf2 commit a6f9351

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

server/src/prompts/workflow-prompts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ export function resolvePromptFilePath(
9393
};
9494
}
9595

96-
// Check existence on disk.
96+
// Check existence on disk (advisory only — the resolved path is always
97+
// returned so that downstream tools can attempt the operation themselves
98+
// and surface their own errors).
9799
if (!existsSync(absolutePath)) {
98100
return {
99101
resolvedPath: absolutePath,

server/test/src/prompts/workflow-prompts.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,8 @@ describe('Workflow Prompts', () => {
15391539
});
15401540
const text = result.messages[0].content.text;
15411541
expect(text).toContain('does not exist');
1542+
// Verify the warning contains the resolved absolute path
1543+
expect(text).toContain('nonexistent/query.ql');
15421544
});
15431545

15441546
it('document_codeql_query handler should include warning for nonexistent queryPath', async () => {
@@ -1549,6 +1551,7 @@ describe('Workflow Prompts', () => {
15491551
});
15501552
const text = result.messages[0].content.text;
15511553
expect(text).toContain('does not exist');
1554+
expect(text).toContain('nonexistent/nowhere/query.ql');
15521555
});
15531556

15541557
it('workshop_creation_workflow handler should include warning for nonexistent queryPath', async () => {
@@ -1559,8 +1562,11 @@ describe('Workflow Prompts', () => {
15591562
});
15601563
const text = result.messages[0].content.text;
15611564
expect(text).toContain('does not exist');
1565+
expect(text).toContain('missing/Workshop.ql');
15621566
});
15631567

1568+
// Only the `database` parameter is a file path — sourceFiles, sourceFunction,
1569+
// and targetFunction are plain string identifiers (not paths on disk).
15641570
it('tools_query_workflow handler should include warning for nonexistent database path', async () => {
15651571
const handler = getRegisteredHandler(mockServer, 'tools_query_workflow');
15661572
const result: PromptResult = await handler({
@@ -1569,6 +1575,7 @@ describe('Workflow Prompts', () => {
15691575
});
15701576
const text = result.messages[0].content.text;
15711577
expect(text).toContain('does not exist');
1578+
expect(text).toContain('nonexistent/db');
15721579
});
15731580
});
15741581
});

0 commit comments

Comments
 (0)