Skip to content

Commit 5c7de83

Browse files
anandgupta42claude
andcommitted
fix: address CodeRabbit review feedback
- `formatCheck`: harden validation error formatting against null entries using optional chaining and filter (CodeRabbit + GPT consensus) - `extractEquivalenceErrors`: propagate extracted errors into `formatEquivalence` output to prevent title/output inconsistency - `todo.test.ts`: use `tmpdir({ git: true })` + `await using` for proper test isolation instead of shared project root Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 3c298ff commit 5c7de83

4 files changed

Lines changed: 21 additions & 28 deletions

File tree

‎.github/meta/commit.txt‎

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
test: consolidate 18 test PRs — 434 new tests, deduplicated, with bug fixes
1+
fix: remove flaky `setTimeout` in todo bus event test
22

3-
Consolidates PRs #515, #526, #527, #528, #530, #531, #532, #533, #534,
4-
#535, #536, #537, #538, #539, #540, #541, #542, #543 into a single PR.
5-
6-
Changes:
7-
- 30 files changed, ~3000 lines of new test coverage
8-
- Deduplicated redundant tests:
9-
- `copilot-compat.test.ts`: removed duplicate `mapOpenAICompatibleFinishReason`
10-
tests (already covered in `copilot/finish-reason.test.ts`)
11-
- `lazy.test.ts`: removed duplicate error-retry and `reset()` tests
12-
- `transform.test.ts`: kept most comprehensive version (#535) over
13-
subset PRs (#539, #541)
14-
- Bug fixes from PR #528:
15-
- `extractEquivalenceErrors`: `null` entries in `validation_errors`
16-
crashed with TypeError (`null.message` throws before `??` evaluates).
17-
Fixed with optional chaining: `e?.message`
18-
- `extractSemanticsErrors`: same fix applied
19-
- Updated test from `expect(...).toThrow(TypeError)` to verify the fix
3+
`Bus.publish` is synchronous — the event is delivered immediately,
4+
no 50ms delay needed. Removes resource contention risk in parallel CI.
205

216
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

‎packages/opencode/src/altimate/tools/altimate-core-check.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ export function formatCheck(data: Record<string, any>): string {
7373
if (data.validation?.valid) {
7474
lines.push("Valid SQL.")
7575
} else {
76-
lines.push(`Invalid: ${data.validation?.errors?.map((e: any) => e.message).join("; ") ?? "unknown"}`)
76+
const validationMessages = (data.validation?.errors ?? [])
77+
.map((e: any) => (typeof e === "string" ? e : e?.message))
78+
.filter(Boolean)
79+
lines.push(`Invalid: ${validationMessages.join("; ") || "unknown"}`)
7780
}
7881

7982
lines.push("\n=== Lint ===")

‎packages/opencode/src/altimate/tools/altimate-core-equivalence.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const AltimateCoreEquivalenceTool = Tool.define("altimate_core_equivalenc
5252
...(error && { error }),
5353
...(findings.length > 0 && { findings }),
5454
},
55-
output: formatEquivalence(data),
55+
output: formatEquivalence(isRealFailure ? { ...data, error } : data),
5656
}
5757
} catch (e) {
5858
const msg = e instanceof Error ? e.message : String(e)

‎packages/opencode/test/session/todo.test.ts‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { describe, test, expect } from "bun:test"
2-
import path from "path"
32
import { Session } from "../../src/session"
43
import { Todo } from "../../src/session/todo"
54
import { Bus } from "../../src/bus"
65
import { Log } from "../../src/util/log"
76
import { Instance } from "../../src/project/instance"
7+
import { tmpdir } from "../fixture/fixture"
88

9-
const projectRoot = path.join(__dirname, "../..")
109
Log.init({ print: false })
1110

1211
describe("Todo: CRUD lifecycle", () => {
1312
test("update then get returns todos in order", async () => {
13+
await using tmp = await tmpdir({ git: true })
1414
await Instance.provide({
15-
directory: projectRoot,
15+
directory: tmp.path,
1616
fn: async () => {
1717
const session = await Session.create({})
1818
const todos = [
@@ -37,8 +37,9 @@ describe("Todo: CRUD lifecycle", () => {
3737
})
3838

3939
test("update with empty array clears all todos", async () => {
40+
await using tmp = await tmpdir({ git: true })
4041
await Instance.provide({
41-
directory: projectRoot,
42+
directory: tmp.path,
4243
fn: async () => {
4344
const session = await Session.create({})
4445

@@ -57,8 +58,9 @@ describe("Todo: CRUD lifecycle", () => {
5758
})
5859

5960
test("update replaces previous todos entirely", async () => {
61+
await using tmp = await tmpdir({ git: true })
6062
await Instance.provide({
61-
directory: projectRoot,
63+
directory: tmp.path,
6264
fn: async () => {
6365
const session = await Session.create({})
6466

@@ -87,8 +89,9 @@ describe("Todo: CRUD lifecycle", () => {
8789
})
8890

8991
test("get returns empty array for session with no todos", async () => {
92+
await using tmp = await tmpdir({ git: true })
9093
await Instance.provide({
91-
directory: projectRoot,
94+
directory: tmp.path,
9295
fn: async () => {
9396
const session = await Session.create({})
9497

@@ -101,8 +104,9 @@ describe("Todo: CRUD lifecycle", () => {
101104
})
102105

103106
test("publishes Todo.Event.Updated on update", async () => {
107+
await using tmp = await tmpdir({ git: true })
104108
await Instance.provide({
105-
directory: projectRoot,
109+
directory: tmp.path,
106110
fn: async () => {
107111
const session = await Session.create({})
108112
let eventReceived = false
@@ -131,8 +135,9 @@ describe("Todo: CRUD lifecycle", () => {
131135
})
132136

133137
test("todos are isolated between sessions", async () => {
138+
await using tmp = await tmpdir({ git: true })
134139
await Instance.provide({
135-
directory: projectRoot,
140+
directory: tmp.path,
136141
fn: async () => {
137142
const session1 = await Session.create({})
138143
const session2 = await Session.create({})

0 commit comments

Comments
 (0)