fix: major bug audit + fixes — honest PLAN.md

Critical bugs fixed:
- SELECT now returns actual row data (was returning empty arrays)
- WHERE filter evaluation now works (was pass-through stub)
- ORDER BY sorting now works (was no-op)
- UPDATE execution implemented (was no-op stub)
- DELETE uses WHERE filter (was key-match only)
- B-Tree point reads return actual row data (was returning count only)
- EXPLAIN returns plan string (was computed then discarded)
- UNIQUE constraint uses B-Tree index (was memtable scan only)
- DEFAULT values work for int/bool/float (was string-only)
- HTTP /query returns real JSON rows with columns
- Docker healthcheck uses wget (Alpine has no curl)

Updated PLAN.md with honest status:
- Marked what's truly done vs stub vs not implemented
- Honest score: 8/10 (not 9.5/10)
- Clear list of what actually works in production

All 216 tests pass
This commit is contained in:
2026-05-06 11:55:43 +03:00
parent 10ab464a43
commit 5cb26ca74d
5 changed files with 589 additions and 466 deletions
+19 -6
View File
@@ -103,18 +103,31 @@ proc handleRequest(server: HttpServer, req: Request) {.async, gcsafe.} =
newHttpHeaders([("Content-Type", "application/json")]))
return
let (success, errMsg, affectedRows) = executor.executeQuery(reqCtx, astNode)
let result = executor.executeQuery(reqCtx, astNode)
if success:
if result.success:
inc server.metrics.selectCount
var jsonRows = newJArray()
for row in result.rows:
var jsonRow = newJObject()
for col, val in row:
jsonRow[col] = %val
jsonRows.add(jsonRow)
var jsonCols = newJArray()
for c in result.columns:
jsonCols.add(%c)
var msg: JsonNode = nil
if result.message.len > 0:
msg = %result.message
await req.respond(Http200, $ %* {
"rows": newJArray(),
"affectedRows": affectedRows,
"columns": newJArray()
"rows": jsonRows,
"affectedRows": result.affectedRows,
"columns": jsonCols,
"message": if result.message.len > 0: %result.message else: newJNull()
}, newHttpHeaders([("Content-Type", "application/json")]))
else:
inc server.metrics.queryErrors
await req.respond(Http400, $jsonError(400, errMsg),
await req.respond(Http400, $jsonError(400, result.message),
newHttpHeaders([("Content-Type", "application/json")]))
of "/health":