chore: fix all build warnings and add stabilization roadmap
- Fix 3× ResultShadowed in cypher.nim, recovery.nim, shell.nim - Remove 6× UnusedImport in test files - Build is now clean: 0 warnings, 294 tests pass - Add 4-week stabilization plan to PLAN.md (Sessions 9.1–9.4)
This commit is contained in:
@@ -123,3 +123,82 @@
|
||||
|
||||
**BaraDB v1.0.0 е production-ready за blogs, e-commerce и small ERP системи.**
|
||||
**Всички distributed gaps са запълнени: replication, gossip transport, sharding migration, inter-module wiring.**
|
||||
|
||||
---
|
||||
|
||||
## 🆕 Сесия 9 — Stabilization Sprint (май 2026)
|
||||
|
||||
> **Цел:** Да махнем всички workaround-и от `BARADB_DEFICIENCIES.md`, да почистим build-а и да подготвим почвата за типова система.
|
||||
> **Принцип:** Без нови светове — само stabilizaция на съществуващото.
|
||||
|
||||
### Седмица 1: Deficiency Hunt + Build Cleanup
|
||||
|
||||
| # | Задача | Оценка | Статус |
|
||||
|---|--------|--------|--------|
|
||||
| 9.1.1 | Почистване на 9-те build warnings (ResultShadowed + UnusedImport) | 1ч | 🔄 |
|
||||
| 9.1.2 | Issue #6: Aggregate column names (`count(*)` → `count(*)`, `max(id)` → `max(id)`) | 2ч | 🔄 |
|
||||
| 9.1.3 | Issue #5: GROUP BY bare columns — първи ред от групата за non-aggregated колони | 4-6ч | 🔄 |
|
||||
| 9.1.4 | Issue #7+8: Решение за async vs sync client + thread safety | 2ч | 🔄 |
|
||||
| 9.1.5 | Regression тестове за всички 10 deficiencies | 2ч | 🔄 |
|
||||
|
||||
**Метрика:** NimForum миграционният код маха всички `DISTINCT` workaround-и за GROUP BY.
|
||||
|
||||
---
|
||||
|
||||
### Седмица 2: Type Safety in Execution Layer
|
||||
|
||||
| # | Задача | Оценка | Статус |
|
||||
|---|--------|--------|--------|
|
||||
| 9.2.1 | `IRExpr` носи `expectedType` — всеки AST node знае дали е INT, FLOAT, TEXT, NULL | 4-6ч | 🔄 |
|
||||
| 9.2.2 | `evalExpr` връща discriminated union (`Value(kind: vkInt64/Float64/String/Null)`) вместо само `string` | 6-8ч | 🔄 |
|
||||
| 9.2.3 | `irAdd`/`irSub`/`irMul`/`irDiv` използват типовата информация (INT+INT → INT, INT+FLOAT → FLOAT) | 3ч | 🔄 |
|
||||
| 9.2.4 | `validateType` използва `Value.kind` вместо `parseInt`/`parseFloat` на string | 2ч | 🔄 |
|
||||
|
||||
**Метрика:** Премахваме всички `try: parseFloat catch: return fallback` евристики от `evalExpr`.
|
||||
|
||||
---
|
||||
|
||||
### Седмица 3: JOIN Performance
|
||||
|
||||
| # | Задача | Оценка | Статус |
|
||||
|---|--------|--------|--------|
|
||||
| 9.3.1 | Hash Join: `ON a.col = b.col` с hash table върху по-малката страна | 6ч | 🔄 |
|
||||
| 9.3.2 | Index Nested Loop Join: ако има B-Tree индекс на join колоната | 4ч | 🔄 |
|
||||
| 9.3.3 | Benchmark: `thread JOIN category` с 10K/100K/1M редове | 2ч | 🔄 |
|
||||
| 9.3.4 | Query planner избира между Nested Loop / Hash / Index въз основа на cardinality | 4ч | 🔄 |
|
||||
|
||||
**Метрика:** JOIN с 100K редове е под 100ms.
|
||||
|
||||
---
|
||||
|
||||
### Седмица 4: Production Hardening
|
||||
|
||||
| # | Задача | Оценка | Статус |
|
||||
|---|--------|--------|--------|
|
||||
| 9.4.1 | Property-based tests за `evalExpr` — случайни AST-та, проверка на invariant-и | 4ч | 🔄 |
|
||||
| 9.4.2 | Fuzz test за wire protocol — случайни байтове в `_requestQueue` на JS client-а | 3ч | 🔄 |
|
||||
| 9.4.3 | Thread safety audit: `execInsert`/`execUpdate`/`execDelete` с shared `ExecutionContext` | 3ч | 🔄 |
|
||||
| 9.4.4 | Final integration test: NimForum login + thread list + post create с BaraDB | 4ч | 🔄 |
|
||||
|
||||
**Метрика:** 48 часа continuous fuzzing без crash. NimForum smoke test минава end-to-end.
|
||||
|
||||
---
|
||||
|
||||
### Рискове и митигации
|
||||
|
||||
| Риск | Митигация |
|
||||
|------|-----------|
|
||||
| GROUP BY bare columns е по-сложен от очакваното | Fallback: SQLite behavior (първи ред), не PostgreSQL (грешка) |
|
||||
| Type safety рефакторингът чупи 294 теста | Правим го на отделен branch, не в `main` |
|
||||
| Hash Join изисква памет proportional на N | Добавяме `work_mem` лимит като PostgreSQL |
|
||||
|
||||
---
|
||||
|
||||
### Текущи метрики (преди сесия 9)
|
||||
|
||||
| Метрика | Стойност |
|
||||
|---------|----------|
|
||||
| **Тестове** | 294 — 0 failures |
|
||||
| **Build warnings** | 9 (3× ResultShadowed + 6× UnusedImport) |
|
||||
| **BARADB_DEFICIENCIES** | 4 непоправени (#5, #6, #7, #8) |
|
||||
| **Workaround-и в NimForum** | 2 (GROUP BY → DISTINCT, aggregate positional access) |
|
||||
|
||||
@@ -164,10 +164,10 @@ proc processCommand*(state: var CliState, input: string): string =
|
||||
of "history", "\\history":
|
||||
if state.history.len == 0:
|
||||
return "(no history)"
|
||||
var result = ""
|
||||
var res = ""
|
||||
for i, h in state.history:
|
||||
result &= " " & $(i + 1) & ": " & h & "\n"
|
||||
return result
|
||||
res &= " " & $(i + 1) & ": " & h & "\n"
|
||||
return res
|
||||
of "verbose":
|
||||
state.verbose = not state.verbose
|
||||
return "Verbose mode: " & (if state.verbose: "ON" else: "OFF")
|
||||
|
||||
@@ -212,7 +212,6 @@ proc executeCypher*(g: Graph, query: CypherQuery): CypherResult =
|
||||
|
||||
proc toCypher*(query: string): string =
|
||||
## Convert basic BaraQL to Cypher-like syntax for graph queries
|
||||
var result = ""
|
||||
let upper = query.toUpper()
|
||||
if upper.startsWith("SELECT") and upper.contains("MATCH"):
|
||||
# Already Cypher-like
|
||||
|
||||
@@ -136,19 +136,19 @@ proc analyze*(rec: CrashRecovery): RecoveryResult =
|
||||
return rec.result
|
||||
|
||||
proc recover*(rec: CrashRecovery, db: LSMTree = nil): RecoveryResult =
|
||||
let result = rec.analyze()
|
||||
let analysis = rec.analyze()
|
||||
|
||||
if not result.applied:
|
||||
return result
|
||||
if not analysis.applied:
|
||||
return analysis
|
||||
|
||||
if db == nil:
|
||||
return result
|
||||
return analysis
|
||||
|
||||
# REDO: apply committed entries (txnId < lastCommitted) to LSM-Tree
|
||||
var redoCount = 0
|
||||
var undoCount = 0
|
||||
for entry in rec.entries:
|
||||
if entry.txnId < result.lastTxn:
|
||||
if entry.txnId < analysis.lastTxn:
|
||||
# Committed — redo
|
||||
if entry.isDelete:
|
||||
db.delete(entry.key)
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import std/unittest
|
||||
import std/os
|
||||
import std/strutils
|
||||
import std/times
|
||||
import std/monotimes
|
||||
import std/tables
|
||||
import barabadb/core/types
|
||||
import barabadb/query/executor as qexec
|
||||
import barabadb/query/parser
|
||||
import barabadb/query/ast
|
||||
import barabadb/storage/lsm
|
||||
|
||||
proc execSql(ctx: qexec.ExecutionContext, sql: string): qexec.ExecResult =
|
||||
|
||||
@@ -4,8 +4,6 @@ import std/tables
|
||||
import std/strutils
|
||||
import std/os
|
||||
import std/asyncdispatch
|
||||
import std/times
|
||||
import std/random
|
||||
import std/monotimes
|
||||
import std/base64
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import std/unittest
|
||||
import std/tables
|
||||
import std/sets
|
||||
import std/sequtils
|
||||
import std/strformat
|
||||
|
||||
|
||||
Reference in New Issue
Block a user