Conversation
|
Caution Review failedThe pull request is closed. 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
WalkthroughPins Bun to 1.3.9 in CI workflows, adds a "Generate protobuf types" step, removes console.error mocking from test setup, converts several tests and lifecycle hooks to async/await, and replaces Bun-specific fs/path usage with Node ESM reads for policy.json. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/integration.test.ts (1)
7-18: Correct ESM path resolution pattern.Using
new URL("../policy/policy.json", import.meta.url)is the standard approach for resolving relative paths in ES modules.Consider extracting the path constant to reduce duplication:
♻️ Optional: Extract shared path constant
describe("Integration Tests", () => { + const policyPath = new URL("../policy/policy.json", import.meta.url); + describe("Policy Integration", () => { test("should load and validate policy correctly", () => { - const policyPath = new URL("../policy/policy.json", import.meta.url); - expect(() => { const policyData = readFileSync(policyPath, "utf8");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/integration.test.ts` around lines 7 - 18, The tests duplicate the ESM path resolution for the policy file using new URL("../policy/policy.json", import.meta.url); extract that into a single shared constant (e.g., const policyPath = new URL("../policy/policy.json", import.meta.url)) at the top of the test file and replace the inline occurrences inside the tests ("should load policy file" and "should have correct policy structure") with the shared policyPath variable so both readFileSync and JSON.parse use the same resolved URL.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
.github/workflows/ci.yml.github/workflows/publish.ymltest-setup.tstest/cex-broker.test.tstest/integration.test.tstest/otel.test.ts
💤 Files with no reviewable changes (1)
- test-setup.ts
🧰 Additional context used
🧬 Code graph analysis (1)
test/cex-broker.test.ts (1)
src/index.ts (1)
CEXBroker(25-270)
🔇 Additional comments (7)
.github/workflows/ci.yml (1)
22-22: Good practice: Pinning the Bun version for CI reproducibility.Using
^1.3.9ensures consistent behavior across CI runs while still allowing patch updates for bug fixes. This aligns with the PR objective of deterministic tests.test/cex-broker.test.ts (2)
45-49: Correct fix for test isolation.The
broker.stop()method is async (performsforceShutdown()andclose()calls). Awaiting it inafterEachensures resources are fully released before the next test runs, eliminating potential race conditions and flaky tests in CI.
212-216: Async handling is correct.Awaiting the async
stop()method ensures the test properly waits for shutdown completion before assertions..github/workflows/publish.yml (1)
25-25: Consistent version pinning across workflows.Aligning the Bun version with
ci.ymlensures the publish workflow tests run under the same conditions as CI tests.test/otel.test.ts (2)
30-57: Proper async teardown for enabled OtelMetrics instances.Adding
await metrics.close()in tests that enable OTLP ensures the SDK's internal resources (exporters, readers) are properly shut down. This prevents resource leaks and cross-test interference that could cause flaky CI results.
61-96: Consistent cleanup pattern for env-based metrics.Each test that creates an enabled
OtelMetricsinstance via environment variables now properly closes it, ensuring no lingering SDK state affects subsequent tests.test/integration.test.ts (1)
1-1: Good migration to standard Node.js APIs.Using
node:fsinstead of Bun-specific file system APIs improves test portability and aligns with standard ES module patterns.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/integration.test.ts`:
- Around line 7-18: The tests duplicate the ESM path resolution for the policy
file using new URL("../policy/policy.json", import.meta.url); extract that into
a single shared constant (e.g., const policyPath = new
URL("../policy/policy.json", import.meta.url)) at the top of the test file and
replace the inline occurrences inside the tests ("should load policy file" and
"should have correct policy structure") with the shared policyPath variable so
both readFileSync and JSON.parse use the same resolved URL.
Summary by CodeRabbit
Chores
Tests