Skip to content

Commit cc37c4e

Browse files
authored
Merge branch 'main' into fix/localhost-ipv6
2 parents 786e5d0 + c8c3926 commit cc37c4e

11 files changed

Lines changed: 78 additions & 6 deletions

‎.coderabbit.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tone_instructions: >-
66
comments and unrelated refactors.
77
88
chat:
9-
allow_non_org_members: false
9+
allow_non_org_members: true
1010

1111
knowledge_base:
1212
web_search:
@@ -55,8 +55,8 @@ reviews:
5555
repository conventions, tests, and related implementations. When a potential finding depends on
5656
external behavior, use web search and prefer official documentation, specifications, or upstream
5757
repositories. Report only concrete, actionable conflicts or failure modes, citing the relevant
58-
repository location or external source. Prioritize correctness, security, data loss, lifecycle,
59-
and test gaps. Do not report generic best practices, unsupported concerns, speculative style
58+
repository location or external source. Prioritize correctness, security, data loss, lifecycle, and
59+
test gaps. Do not report generic best practices, unsupported concerns, speculative style
6060
comments, or unrelated refactors. When changed code introduces a local implementation of a
6161
cross-cutting concern, check whether it bypasses or duplicates an established repository
6262
abstraction or nearby convention. Report only a concrete inconsistency with behavioral or

‎.github/workflows/code-qa.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ jobs:
171171
- name: Run extension test lanes
172172
if: ${{ !matrix.collect-coverage }}
173173
run: pnpm turbo run test:api test:core test:services test:misc test:tree-sitter --filter="zoo-code" --concurrency=2 --log-order grouped --output-logs new-only
174+
# Runs outside Turbo so changes to .coderabbit.yaml and
175+
# .github/workflows/label-pr-review-state.yml always bust the
176+
# result — those files are outside the src/ package boundary and
177+
# cannot be declared as Turbo inputs.
178+
- name: Run workflow config tests
179+
run: pnpm --dir src run test:workflow
174180
- name: Verify extension coverage contract
175181
if: matrix.collect-coverage
176182
run: pnpm --dir src run verify:coverage-contract

‎src/eslint.config.mjs‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,34 @@ export default [
6060
{
6161
ignores: [".stryker-tmp", "webview-ui", "out"],
6262
},
63+
{
64+
// Tests inside __tests__/ directories must not traverse 3+ levels above
65+
// the test file. That escapes the src/ package root and makes Turbo
66+
// invisible to cache changes in those files.
67+
// pr-review-state-workflow.test.ts is the intentional exception: it reads
68+
// root-level config and runs in a dedicated non-Turbo CI step.
69+
files: ["**/__tests__/**/*.test.ts", "**/__tests__/**/*.spec.ts"],
70+
ignores: ["**/services/__tests__/pr-review-state-workflow.test.ts"],
71+
rules: {
72+
"no-restricted-syntax": [
73+
"error",
74+
{
75+
// Catches path.resolve(..., "../../..") — the three-level literal ends here.
76+
selector: "CallExpression > Literal[value=/\\.\\.\\W\\.\\.\\W\\.\\.$/]",
77+
message:
78+
"Do not read files 3+ levels above the test file. Tests reading root-level config must run in a dedicated non-Turbo-cached CI step.",
79+
},
80+
{
81+
// Catches readFile("../../../.coderabbit.yaml") — three-level traversal
82+
// embedded inside a longer path string. Scoped to FS-reading calls so
83+
// vi.mock("../../../module") (module paths, not file reads) is not flagged.
84+
// Matches both bare readFileSync(...) and fs.readFileSync(...).
85+
selector:
86+
":matches(CallExpression[callee.name=/^(readFile|readFileSync|open|openSync|stat|statSync|access|accessSync|watch|watchFile|readdir|readdirSync)/], CallExpression[callee.property.name=/^(readFile|readFileSync|open|openSync|stat|statSync|access|accessSync|watch|watchFile|readdir|readdirSync)/]) > Literal[value=/\\.\\.\\W\\.\\.\\W\\.\\./]",
87+
message:
88+
"Do not read files 3+ levels above the test file. Tests reading root-level config must run in a dedicated non-Turbo-cached CI step.",
89+
},
90+
],
91+
},
92+
},
6393
]

‎src/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@
459459
"test:coverage:services": "vitest run --config vitest.services.config.ts --coverage",
460460
"test:coverage:misc": "vitest run --config vitest.misc.config.ts --coverage",
461461
"test:coverage:tree-sitter": "vitest run --config vitest.tree-sitter.config.ts --coverage",
462+
"test:workflow": "vitest run --config vitest.workflow.config.ts",
463+
"test:coverage:workflow": "vitest run --config vitest.workflow.config.ts --coverage",
462464
"format": "prettier --write .",
463465
"bundle": "node esbuild.mjs",
464466
"vscode:prepublish": "pnpm bundle --production",

‎src/scripts/verify-coverage-cache-inputs.mjs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ test("coverage cache input contract", async (context) => {
244244
throw new Error(`${taskName} hashes foreign spec ${packagePath}`)
245245
}
246246
}
247+
// pr-review-state-workflow.test.ts reads root-level config outside
248+
// the src/ package. It must be excluded from every Turbo lane and
249+
// run in a dedicated non-Turbo CI step instead.
250+
const turboExcludedSpecs = ["services/__tests__/pr-review-state-workflow.test.ts"]
251+
for (const file of turboExcludedSpecs) {
252+
if (Object.hasOwn(inputs, file))
253+
throw new Error(`${taskName} hashes ${file}, which must run in a dedicated non-Turbo step`)
254+
}
247255
}
248256
}
249257
})

‎src/scripts/verify-coverage-contract.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ collectTests(root)
103103

104104
const laneForTest = (file) => {
105105
if (file === "__tests__/dist_assets.spec.ts") return "dist"
106+
// Reads root-level config; runs outside Turbo in a dedicated CI step.
107+
if (file === "services/__tests__/pr-review-state-workflow.test.ts") return "workflow"
106108
if (file.startsWith("services/tree-sitter/")) return "tree-sitter"
107109
for (const lane of ["api", "core", "services"]) if (file.startsWith(`${lane}/`)) return lane
108110
if (

‎src/services/__tests__/pr-review-state-workflow.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ function latestGateStatus(result: Awaited<ReturnType<typeof runWorkflow>>) {
443443

444444
describe("PR review-state workflow", () => {
445445
it("uses supported CodeRabbit access and review controls", () => {
446-
expect(codeRabbitConfig.chat.allow_non_org_members).toBe(false)
446+
expect(codeRabbitConfig.chat.allow_non_org_members).toBe(true)
447447
expect(codeRabbitConfig.reviews.pre_merge_checks.override_requested_reviewers_only).toBe(true)
448448
expect(codeRabbitConfig.reviews.auto_review.auto_pause_after_reviewed_commits).toBe(0)
449449
expect(codeRabbitConfig.reviews.auto_review.labels).toEqual(["coderabbit-review-active"])

‎src/turbo.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"!api/**/__tests__/**",
7979
"!core/**/__tests__/**",
8080
"!services/tree-sitter/**/__tests__/**",
81+
"!services/__tests__/pr-review-state-workflow.test.ts",
8182
"!__tests__/**",
8283
"!activate/**/__tests__/**",
8384
"!extension/**/__tests__/**",
@@ -182,6 +183,7 @@
182183
"!api/**/__tests__/**",
183184
"!core/**/__tests__/**",
184185
"!services/tree-sitter/**/__tests__/**",
186+
"!services/__tests__/pr-review-state-workflow.test.ts",
185187
"!__tests__/**",
186188
"!activate/**/__tests__/**",
187189
"!extension/**/__tests__/**",

‎src/vitest.services.config.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ export default mergeConfig(
77
defineConfig({
88
test: {
99
include: ["services/**/*.{test,spec}.{ts,tsx}"],
10-
exclude: ["services/tree-sitter/**/*.{test,spec}.{ts,tsx}"],
10+
exclude: [
11+
"services/tree-sitter/**/*.{test,spec}.{ts,tsx}",
12+
"services/__tests__/pr-review-state-workflow.test.ts",
13+
],
1114
coverage: {
1215
reportsDirectory: "coverage/services",
1316
},

‎src/vitest.unit.config.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ export default mergeConfig(
66
baseConfig,
77
defineConfig({
88
test: {
9-
exclude: [...configDefaults.exclude, "__tests__/dist_assets.spec.ts"],
9+
exclude: [
10+
...configDefaults.exclude,
11+
"__tests__/dist_assets.spec.ts",
12+
"services/__tests__/pr-review-state-workflow.test.ts",
13+
],
1014
coverage: {
1115
reportsDirectory: "coverage/unit",
1216
},

0 commit comments

Comments
 (0)