Fix Redis driver pipeline parsing and runtime/server test initialization#173
Fix Redis driver pipeline parsing and runtime/server test initialization#173
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Fixed bulkUpdate to handle Redis v4 client pipeline results (direct values, not tuples) - Fixed bulkDelete to parse Redis v4 pipeline results correctly - Added guard to prevent executing empty pipeline in bulkUpdate - Added explanatory comments about Redis v4 client behavior Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
|
@copilot fix test |
The Redis driver tests that were originally failing are now fixed (commit 0b8bc17). However, the CI is now showing failures in These server test failures appear to be pre-existing issues from the v4.0 merge (#172), not caused by my Redis driver changes. Would you like me to investigate and fix the runtime/server test failures as well? |
Added await app.init() to test setup in: - node.test.ts - rest.test.ts - graphql.test.ts - rest-advanced.test.ts These tests were failing because ObjectQL v4.0 requires initialization before use. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
There was a problem hiding this comment.
Pull request overview
This PR fixes Redis pipeline result parsing to align with the Redis v4 client API and ensures ObjectQL runtime/server tests correctly initialize the app before use so CI can pass.
Changes:
- Updated
RedisDriver.executeCommandbulk operations (bulkUpdate,bulkDelete) to treatmulti().exec()results as direct replies instead of[error, result]tuples, and added a safety guard to avoid executing empty pipelines. - Added missing
await app.init()calls in REST, REST advanced, GraphQL, and Node server tests so handlers are created only after the ObjectQL app is fully initialized.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/drivers/redis/src/index.ts | Adjusts Redis pipeline result handling for bulkUpdate and bulkDelete to match the v4 client API and guards setPipeline.exec() when no updates are enqueued. |
| packages/runtime/server/test/rest.test.ts | Ensures the REST adapter tests call await app.init() before creating the REST handler and HTTP server. |
| packages/runtime/server/test/rest-advanced.test.ts | Ensures advanced REST/error-handling tests initialize the ObjectQL app before building the handler and server. |
| packages/runtime/server/test/node.test.ts | Ensures Node adapter tests call await app.init() after schema registration so requests run against an initialized app. |
| packages/runtime/server/test/graphql.test.ts | Ensures GraphQL adapter tests initialize the ObjectQL app before creating the GraphQL handler and server. |
Comments suppressed due to low confidence (2)
packages/runtime/server/test/node.test.ts:13
- Unused import IObjectQL.
import { IObjectQL, Driver } from '@objectql/types';
packages/drivers/redis/src/index.ts:336
- This use of variable 'filters' always evaluates to true.
if (filters && !Array.isArray(filters) && filters.filters) {
Fixes two issues preventing CI from passing:
1. Redis Driver Pipeline Result Parsing
The Redis driver
bulkUpdateandbulkDeleteoperations were parsing pipeline results using the v3 client API format[error, result], but the project uses v4 which returns results directly.bulkUpdate:
getResults?.[i]vsresult?.[1]bulkDelete:
r > 0vsr && r[1] > 0Example
The v4 client returns
[1, 1, 0]for three DEL operations (two successful, one non-existent key), not[[null, 1], [null, 1], [null, 0]].2. Runtime/Server Test Initialization
Added missing
await app.init()calls to test setup in 4 test files that were failing because ObjectQL v4.0 requires initialization before use:node.test.tsrest.test.tsgraphql.test.tsrest-advanced.test.tsThese failures were previously hidden by pnpm's "stop on first failure" behavior until the Redis driver tests were fixed.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.