Skip to content

Commit 628f998

Browse files
committed
refactor: coderabbit review for edge cases
1 parent bfdc152 commit 628f998

4 files changed

Lines changed: 47 additions & 43 deletions

File tree

.github/workflows/code-qa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
uses: actions/cache@v4
6363
with:
6464
path: .turbo/cache
65-
key: ${{ runner.os }}-turbo-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
65+
key: ${{ runner.os }}-turbo-${{ hashFiles('**/pnpm-lock.yaml') }}
6666
restore-keys: |
6767
${{ runner.os }}-turbo-${{ hashFiles('**/pnpm-lock.yaml') }}-
6868
${{ runner.os }}-turbo-

.github/workflows/e2e.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- "webview-ui/**"
1111
- "apps/vscode-e2e/**"
1212
- "packages/core/**"
13+
- "package.json"
14+
- "pnpm-lock.yaml"
15+
- "turbo.json"
16+
- ".github/actions/setup-node-pnpm/**"
1317

1418
jobs:
1519
e2e-mock:

apps/vscode-e2e/src/runTest.ts

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,6 @@ async function main() {
1818

1919
let mock: InstanceType<typeof LLMock> | undefined
2020

21-
if (useMock) {
22-
const fixturesDir = path.resolve(__dirname, "../fixtures")
23-
24-
mock = new LLMock({
25-
port: 0, // random free port
26-
...(isRecord && {
27-
record: {
28-
// OpenRouter is OpenAI-compatible; aimock proxies using the openai provider key.
29-
// Use /api (not /api/v1) — aimock appends the request path (/v1/chat/completions)
30-
// so including /v1 here would produce a doubled /v1/v1 upstream URL.
31-
providers: { openai: "https://openrouter.ai/api" },
32-
fixturePath: fixturesDir,
33-
},
34-
}),
35-
})
36-
37-
mock.loadFixtureDir(fixturesDir)
38-
39-
if (!isRecord) {
40-
// The modes test (switch_mode → ask) triggers a second API call whose last
41-
// user message starts with <environment_details> directly — no <user_message>
42-
// wrapper. JSON fixtures use substring matching so a bare "<environment_details>"
43-
// match would collide with all other requests. A regex anchored to the start
44-
// uniquely identifies this post-switch turn.
45-
mock.addFixture({
46-
match: { userMessage: /^<environment_details>/ },
47-
response: {
48-
toolCalls: [
49-
{
50-
name: "attempt_completion",
51-
arguments: JSON.stringify({ result: "Switched to ❓ Ask mode as requested." }),
52-
id: "call_modes_post_switch_001",
53-
},
54-
],
55-
},
56-
})
57-
}
58-
59-
await mock.start()
60-
}
61-
6221
// The folder containing the Extension Manifest package.json
6322
// Passed to `--extensionDevelopmentPath`
6423
const extensionDevelopmentPath = path.resolve(__dirname, "../../../src")
@@ -70,6 +29,47 @@ async function main() {
7029
let testWorkspace: string | undefined
7130

7231
try {
32+
if (useMock) {
33+
const fixturesDir = path.resolve(__dirname, "../fixtures")
34+
35+
mock = new LLMock({
36+
port: 0, // random free port
37+
...(isRecord && {
38+
record: {
39+
// OpenRouter is OpenAI-compatible; aimock proxies using the openai provider key.
40+
// Use /api (not /api/v1) — aimock appends the request path (/v1/chat/completions)
41+
// so including /v1 here would produce a doubled /v1/v1 upstream URL.
42+
providers: { openai: "https://openrouter.ai/api" },
43+
fixturePath: fixturesDir,
44+
},
45+
}),
46+
})
47+
48+
mock.loadFixtureDir(fixturesDir)
49+
50+
if (!isRecord) {
51+
// The modes test (switch_mode → ask) triggers a second API call whose last
52+
// user message starts with <environment_details> directly — no <user_message>
53+
// wrapper. JSON fixtures use substring matching so a bare "<environment_details>"
54+
// match would collide with all other requests. A regex anchored to the start
55+
// uniquely identifies this post-switch turn.
56+
mock.addFixture({
57+
match: { userMessage: /^<environment_details>/ },
58+
response: {
59+
toolCalls: [
60+
{
61+
name: "attempt_completion",
62+
arguments: JSON.stringify({ result: "Switched to ❓ Ask mode as requested." }),
63+
id: "call_modes_post_switch_001",
64+
},
65+
],
66+
},
67+
})
68+
}
69+
70+
await mock.start()
71+
}
72+
7373
// Create a temporary workspace folder for tests
7474
testWorkspace = await fs.mkdtemp(path.join(os.tmpdir(), "roo-test-workspace-"))
7575
// Get test filter from command line arguments or environment variable

codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ coverage:
99
patch:
1010
default:
1111
target: 80% # new lines must be 80% covered
12-
threshold: 5%
12+
threshold: 0%
1313

1414
comment:
1515
layout: "diff, flags"

0 commit comments

Comments
 (0)