Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉
#1,571 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
重構
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
dart, flutter, redis

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.
主要語言
Dart
星號
23
分支
1
平均合併
31 分鐘
30 天內合併 PR
570

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

QueryaHub/Querya-Desktop 的其他 Issue

查看 QueryaHub/Querya-Desktop 的全部 Issue

相似的 Issue

更多 Dart Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。