Skip to content

Commit 4e4bba0

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 95f3e06 commit 4e4bba0

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

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
@@ -1559,6 +1559,8 @@ describe('Workflow Prompts', () => {
15591559
});
15601560
const text = result.messages[0].content.text;
15611561
expect(text).toContain('does not exist');
1562+
// Verify the warning contains the resolved absolute path
1563+
expect(text).toContain('nonexistent/query.ql');
15621564
});
15631565

15641566
it('document_codeql_query handler should include warning for nonexistent queryPath', async () => {
@@ -1569,6 +1571,7 @@ describe('Workflow Prompts', () => {
15691571
});
15701572
const text = result.messages[0].content.text;
15711573
expect(text).toContain('does not exist');
1574+
expect(text).toContain('nonexistent/nowhere/query.ql');
15721575
});
15731576

15741577
it('workshop_creation_workflow handler should include warning for nonexistent queryPath', async () => {
@@ -1579,8 +1582,11 @@ describe('Workflow Prompts', () => {
15791582
});
15801583
const text = result.messages[0].content.text;
15811584
expect(text).toContain('does not exist');
1585+
expect(text).toContain('missing/Workshop.ql');
15821586
});
15831587

1588+
// Only the `database` parameter is a file path — sourceFiles, sourceFunction,
1589+
// and targetFunction are plain string identifiers (not paths on disk).
15841590
it('tools_query_workflow handler should include warning for nonexistent database path', async () => {
15851591
const handler = getRegisteredHandler(mockServer, 'tools_query_workflow');
15861592
const result: PromptResult = await handler({
@@ -1589,6 +1595,7 @@ describe('Workflow Prompts', () => {
15891595
});
15901596
const text = result.messages[0].content.text;
15911597
expect(text).toContain('does not exist');
1598+
expect(text).toContain('nonexistent/db');
15921599
});
15931600
});
15941601
});

0 commit comments

Comments
 (0)