I’m stuck on Stage #HB5 .
I’ve used the implementation in this repository for the decoding process. However, it wasn’t enough to pass the tests. What I found strange is that my Redis server had the same outputs as the official Redis server (see the figure below). There seems to be nothing wrong with the decoding implementation. Are the test cases correct? Thanks for reading my post.
1 Like
I think I’m running into the same issue. Here is the output I get, you can find the code here: GitHub - andrea-berling/rediz: A Redis implementation in Zig, for learning and fun
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.
[tester::#HB5] Running tests for Stage #HB5 (Geospatial Commands - Decode coordinates)
[tester::#HB5] $ ./your_program.sh
[your_program] [2025-08-29T12:20:57.836Z] 688 [info] (init): Listening on 127.0.0.1:6379...
[your_program] [2025-08-29T12:20:57.837Z] 688 [info] (database): Initializing from RDB file dump.rdb...
[your_program] [2025-08-29T12:20:57.936Z] 688 [info] (event_loop): Accepted new connection
[tester::#HB5] [client] $ redis-cli ZADD raspberry 523825687738629 pineapple
[tester::#HB5] [client] ✔︎ Received 1
[tester::#HB5] [client] > ZADD raspberry 2389599034609350 blueberry
[tester::#HB5] [client] ✔︎ Received 1
[tester::#HB5] [client] > ZADD raspberry 3150290241551691 pear
[tester::#HB5] [client] ✔︎ Received 1
[tester::#HB5] [client] > GEOPOS raspberry pineapple blueberry pear
[tester::#HB5] Expected -120.97611923781052 (± 1e-06), got -120.97612112760544
[tester::#HB5] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)
[your_program] [2025-08-29T12:20:57.944Z] 688 [info] (event_loop): Gracefully shutting down...
I’m having this issue, too.
We’re looking into this – thanks for reporting everyone!
Our tests do pass against Redis so this’ll be an interesting one to nail down
3 Likes
Same issue
[tester::#HB5] Running tests for Stage #HB5 (Geospatial Commands - Decode coordinates)
[tester::#HB5] $ ./your_program.sh
[your_program] Config[ArgDirName]: (null)
[your_program] Config[ArgFileName]: (null)
[your_program] Logs from your program will appear here!
[your_program] Waiting for a client to connect...
[your_program] Client connected - port: 6379 - client_sock: 4
[tester::#HB5] [client] $ redis-cli ZADD orange 348470291820236 strawberry
[tester::#HB5] [client] Sent bytes: "*4\r\n$4\r\nZADD\r\n$6\r\norange\r\n$15\r\n348470291820236\r\n$10\r\nstrawberry\r\n"
[your_program] 6379 tokens[0]: ZADD | 6379 tokens[1]: orange | 6379 tokens[2]: 348470291820236 | 6379 tokens[3]: strawberry |
[tester::#HB5] [client] Received bytes: ":1\r\n"
[tester::#HB5] [client] Received RESP integer: 1
[tester::#HB5] [client] ✔︎ Received 1
[tester::#HB5] [client] > ZADD orange 2206260328425452 blueberry
[tester::#HB5] [client] Sent bytes: "*4\r\n$4\r\nZADD\r\n$6\r\norange\r\n$16\r\n2206260328425452\r\n$9\r\nblueberry\r\n"
[tester::#HB5] [client] Received bytes: ":1\r\n"
[tester::#HB5] [client] Received RESP integer: 1
[your_program] 6379 tokens[0]: ZADD | 6379 tokens[1]: orange | 6379 tokens[2]: 2206260328425452 | 6379 tokens[3]: blueberry |
[tester::#HB5] [client] ✔︎ Received 1
[tester::#HB5] [client] > GEOPOS orange blueberry strawberry
[tester::#HB5] [client] Sent bytes: "*4\r\n$6\r\nGEOPOS\r\n$6\r\norange\r\n$9\r\nblueberry\r\n$10\r\nstrawberry\r\n"
[your_program] 6379 tokens[0]: GEOPOS | 6379 tokens[1]: orange | 6379 tokens[2]: blueberry | 6379 tokens[3]: strawberry |
[tester::#HB5] [client] Received bytes: "*2\r\n*2\r\n$19\r\n-36.531780660152435\r\n$18\r\n80.909096575903931\r\n*2\r\n$20\r\n-140.717726647853851\r\n$19\r\n-24.876010731950139\r\n"
[tester::#HB5] [client] Received RESP array: [
[tester::#HB5] [client] [
[tester::#HB5] [client] "-36.531780660152435",
[tester::#HB5] [client] "80.909096575903931"
[tester::#HB5] [client] ],
[tester::#HB5] [client] [
[tester::#HB5] [client] "-140.717726647853851",
[tester::#HB5] [client] "-24.876010731950139"
[tester::#HB5] [client] ]
[tester::#HB5] [client] ]
[tester::#HB5] Expected -140.71772516972473 (± 1e-06), got -140.717726647853851
[tester::#HB5] Test failed
[tester::#HB5] Terminating program
[tester::#HB5] Program terminated successfully
Maybe it is connected with reducePrecisionForBulkString in remote tests?
1 Like
Maybe error tolerance of (± 1e-06) is too strict?
//internal/test_cases/geopos_test_case.go
// Assertions for existing locations
for _, location := range t.Locations {
tolerance := 1e-6
No, test are not passing against Redis.
ran on mac
[stage-806] Running tests for Stage #806: GEOPOS-2
[stage-806] $ ./your_program.sh
[your_program] 9179:C 30 Aug 2025 20:25:29.214 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
[your_program] 9179:C 30 Aug 2025 20:25:29.214 * Redis version=8.0.1, bits=64, commit=00000000, modified=1, pid=9179, just started
[your_program] 9179:C 30 Aug 2025 20:25:29.214 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * monotonic clock: POSIX clock_gettime
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * Running mode=standalone, port=6379.
[your_program] 9179:M 30 Aug 2025 20:25:29.214 # WARNING: The TCP backlog setting of 511 cannot be enforced because kern.ipc.somaxconn is set to the lower value of 128.
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * Server initialized
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * Loading RDB produced by version 8.0.1
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * RDB age 5 seconds
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * RDB memory usage when created 0.83 Mb
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * Done loading RDB, keys loaded: 4, keys expired: 0.
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * DB loaded from disk: 0.000 seconds
[your_program] 9179:M 30 Aug 2025 20:25:29.214 * Ready to accept connections tcp
[stage-806] [client] $ redis-cli ZADD strawberry 224085498881558 banana
[stage-806] [client] Sent bytes: "*4\r\n$4\r\nZADD\r\n$10\r\nstrawberry\r\n$15\r\n224085498881558\r\n$6\r\nbanana\r\n"
[stage-806] [client] Received bytes: ":1\r\n"
[stage-806] [client] Received RESP integer: 1
[stage-806] [client] ✔︎ Received 1
[stage-806] [client] > ZADD strawberry 2451251516498654 strawberry
[stage-806] [client] Sent bytes: "*4\r\n$4\r\nZADD\r\n$10\r\nstrawberry\r\n$16\r\n2451251516498654\r\n$10\r\nstrawberry\r\n"
[stage-806] [client] Received bytes: ":1\r\n"
[stage-806] [client] Received RESP integer: 1
[stage-806] [client] ✔︎ Received 1
[stage-806] [client] > GEOPOS strawberry strawberry banana
[stage-806] [client] Sent bytes: "*4\r\n$6\r\nGEOPOS\r\n$10\r\nstrawberry\r\n$10\r\nstrawberry\r\n$6\r\nbanana\r\n"
[stage-806] [client] Received bytes: "*2\r\n*2\r\n$17\r\n69.38464611768723\r\n$18\r\n-64.62180725981094\r\n*2\r\n$18\r\n-114.2862144112587\r\n$19\r\n-59.176273154394956\r\n"
[stage-806] [client] Received RESP array: [
[stage-806] [client] [
[stage-806] [client] "69.38464611768723",
[stage-806] [client] "-64.62180725981094"
[stage-806] [client] ],
[stage-806] [client] [
[stage-806] [client] "-114.2862144112587",
[stage-806] [client] "-59.176273154394956"
[stage-806] [client] ]
[stage-806] [client] ]
[stage-806] Expected 69.38464726698169 (± 1e-06), got 69.38464611768723
[stage-806] Test failed
[stage-806] Terminating program
[your_program] 9179:signal-handler (1756565729) Received SIGTERM scheduling shutdown...
[your_program] 9179:signal-handler (1756565729) Received SIGTERM scheduling shutdown...
[your_program] 9179:M 30 Aug 2025 20:25:29.316 * User requested shutdown...
[your_program] 9179:M 30 Aug 2025 20:25:29.316 * Saving the final RDB snapshot before exiting.
[your_program] 9179:M 30 Aug 2025 20:25:29.322 * DB saved on disk
[your_program] 9179:M 30 Aug 2025 20:25:29.322 # Redis is now ready to exit, bye bye...
[stage-806] Program terminated successfully
1 Like
Hi Everyone! We’ve upgraded our tester to include a fix for this test case here .
Please give it a re-try and let us know how it goes.
1 Like
system
Closed
September 6, 2025, 6:17am
13
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.