Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

refactor(redis): typed RedisReply instead of dynamic replies; move RedisConnectionTestFake out of lib

Đang mở
#1,571 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, flutter, redis
Lĩnh vực
backend, databases, testing

Hướng nghiên cứu

Start with lib/core/database/redis_connection.dart, especially sendCommand at line 391 and the reply parsing sites named in the issue. Then review #1569, which touches the same file and is a prerequisite. The refactor is done when replies and command arguments are typed at the boundary, the test fake is moved out of lib/, and existing behavior is preserved.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

backend connections enhancement P3

Problem

RedisConnection.sendCommand(List<dynamic> args) -> Future<dynamic> (lib/core/database/redis_connection.dart:391) passes raw redis package replies through. Every caller re-parses them by hand: 9 is List / length == 2 checks in redis_connection.dart alone (scan, getMaxDatabases, hash/zset/stream readers), plus redisReplyInt / RedisBulkValue.fromReply with fallbacks that hide a wrong reply shape (redisReplyInt(result, -1) turns an error into -1).

A Redis error reply and a wrong-type value look the same to callers, and arguments are List<dynamic>, so a non-string argument goes through unchecked.

RedisConnectionTestFake (:817, ~280 lines) lives in lib/ and ships in the release binary.

Fix

  • Parse once into a sealed RedisReply (RedisInt, RedisBulk(bytes), RedisSimple, RedisArray, RedisNil, RedisErrorReply) at the sendCommand boundary. Accessors like asInt() / asArray() throw a typed RedisProtocolException on a shape mismatch.
  • Typed arguments: List<Object> of String | int | Uint8List | RedisBulkValue, converted in one place (redisCommandArg).
  • Move RedisConnectionTestFake to test/ (or lib/testing/ excluded from the app).
  • Pure refactor, no behaviour change; do it after #1569 (Redis DB-switch fix), which touches the same file.
Ngôn ngữ chính
Dart
Star
23
Fork
1
Merge trung bình
31 phút
Pull request đã merge (30 ngày)
570

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QueryaHub/Querya-Desktop

Tất cả issue của QueryaHub/Querya-Desktop

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.