Skip to content

RepoDNA v0.8.0 — Performance Engine

Choose a tag to compare

@Cihanak1 Cihanak1 released this 29 Nov 00:57
· 187 commits to main since this release
e14c0b7

RepoDNA v0.8.0 — Performance Engine

RepoDNA v0.8.0 introduces a persistent, security-hardened Performance Engine featuring a multi-layer SQLite WAL content-addressable cache, incremental dependency-closure analysis, bounded parallelism, and large-graph UI optimizations — preserving 100% deterministic semantic equivalence with clean full scans.


Highlights

1. Persistent SQLite WAL Content-Addressable Cache (repodna.performance.cache)

  • Schema v2 & Zero Repo Pollution: Stored strictly outside analyzed repositories (configurable via REPODNA_CACHE_DIR), using pure JSON + bounded streaming zlib decompression + SHA-256 payload verification (zero pickle).
  • Three Cache Layers:
    • Layer-1A (file_artifacts): Per-file AST parse and import-extraction cache.
    • Layer-1B (brain_artifacts): Deep SymbolIndexer symbol & cross-reference extraction cache with Pydantic v2 Rust TypeAdapter hydration.
    • Layer-2 (repo_snapshots): Full repository snapshot cache for sub-second warm scans.
  • Cross-Process RW Lock & Active WAL Reader Safety:
    • Coordinated shared/exclusive cross-process advisory locking (fcntl.flock on POSIX, Win32 kernel32.LockFileEx on Windows). All normal cache operations hold a shared lock (LOCK_SH); recovery requires a non-blocking exclusive lock (LOCK_EX | LOCK_NB) held continuously across probe → unlink → schema re-init to eliminate TOCTOU races.
    • Strict SQLite error classification distinguishes genuine corruption (SQLITE_CORRUPT, SQLITE_NOTADB) from transient lock contention / operational errors (SQLITE_BUSY, SQLITE_LOCKED, SQLITE_FULL, SQLITE_READONLY, SQLITE_IOERR, SQLITE_CANTOPEN).
    • Before any destructive recovery, an exclusive WAL probe (PRAGMA wal_checkpoint(TRUNCATE) + PRAGMA locking_mode = EXCLUSIVE + BEGIN EXCLUSIVE + PRAGMA quick_check(1)) verifies no active external uncoordinated WAL readers exist — degrading safely to non-destructive fallback when busy.
  • Physical + Logical 512 MB Quota: Enforces LRU eviction against both physical SQLite DB + WAL + SHM disk usage and logical compressed payload bytes, with bounded WAL checkpointing and controlled compaction.

2. Incremental Analysis Engine & Freshness Binding (repodna.performance.incremental, identity)

  • Content SHA-256 manifest hashing paired with order-preserving resolver alias fingerprinting and hidden/workspace config hashing (.repodna/architecture.yml, .gitignore, .repodnaignore, .mailmap, tsconfig.json, jsconfig.json, go.mod, pyproject.toml, package.json).
  • Single-call git status --porcelain=v2 --branch freshness binding guarantees dirty working trees, untracked files, and branch/HEAD switches never return stale snapshots.
  • Transitive reverse-dependency closure recomputes only affected modules, falling back conservatively to full analysis with explicit machine-readable FallbackReason telemetry when global invariants change.

3. Algorithmic Speedups & Bounded Parallelism

  • Eliminated $O(R \times F)$ linear Path.stem scans in repodna.brain via pre-built $O(1)$ stem indexes and memoized specifier resolution.
  • Integer-indexed GraphIndex adjacency structures in repodna.graph.engine for Tarjan SCC, weakly connected components, and Johnson cycle enumeration.
  • Empirically calibrated ThreadPoolExecutor I/O + hashing and threshold-gated ProcessPoolExecutor coarse batching (--workers auto).

4. API, CLI, MCP & Workstation UI Integration

  • FastAPI: GET /api/cache/stats, POST /api/cache/clear, GET /api/analyses/{analysis_id}/performance, plus in-flight duplicate scan coalescing and live ScanProgress cache/reused/reparsed telemetry.
  • CLI: repodna analyze --mode {auto,incremental,full} --no-cache --workers N, repodna cache stats|clear, and repodna performance report.
  • MCP: Exposes snapshot_freshness and persistent_cache_hit while preserving all 23 MCP tools and strict stdout cleanliness.
  • Workstation UI: Simple-mode latency/mode pill, Advanced-mode Performance Engine diagnostics card, Guardrails & Performance Cache controls modal (TR/EN localized), separated React Flow base layout vs selection styling, honest compact-mode edge truncation disclosure, and CSS content-visibility: auto containment.

Verified 7-Repository Benchmark Results (Post-Hardening)

Measured unmocked on Windows 11 (10.0.26300), Python 3.12.10, 16 logical CPUs, 32 GB RAM with exact commit SHA parity against v0.7.0 baseline (benchmarks/run_v08_benchmarks.py, 49/49 incremental & recovery semantic equivalence checks passed):

Repository Language Files / LOC v0.7.0 E2E v0.8.0 Cold E2E (--no-cache) Cold Speedup v0.8.0 Warm E2E (Cached) Warm Speedup Warm Core Snapshot
colinhacks/zod TypeScript 641 / 124,857 42,798.0 ms 3,186.3 ms 13.43× 1,177.8 ms 36.34× 377.9 ms
expressjs/express JavaScript 194 / 20,640 3,357.2 ms 797.1 ms 4.21× 327.5 ms 10.25× 153.3 ms
BurntSushi/ripgrep Rust 221 / 59,537 2,948.3 ms 1,156.7 ms 2.55× 323.8 ms 9.11× 189.4 ms
RepoDNA@v0.7.0 Python/TS 197 / 43,354 3,049.0 ms 1,477.9 ms 2.06× 451.2 ms 6.76× 228.4 ms
go-chi/chi Go 110 / 10,977 1,339.7 ms 445.6 ms 3.01× 193.1 ms 6.94× 119.6 ms
psf/requests Python 123 / 14,660 1,012.1 ms 561.0 ms 1.80× 248.2 ms 4.08× 140.6 ms
pallets/flask Python 225 / 25,359 1,518.9 ms 766.8 ms 1.98× 371.2 ms 4.09× 172.3 ms

Verification & Release Gates

  • Merge Commit (main): e14c0b703d90d46cd1ae8ecb0d47375da3f96920 (PR #7 merged via standard merge commit)
  • Post-Merge CI (main): GitHub Actions Run #46208270533 — 6 / 6 jobs passed:
    • Backend (Python 3.12 — Ruff, Mypy, Pytest) — PASS
    • Frontend (TypeScript, Vitest, Vite Build) — PASS
    • Performance Engine Cross-Platform (ubuntu-latest) — PASS
    • Performance Engine Cross-Platform (macos-latest) — PASS
    • Performance Engine Cross-Platform (windows-latest) — PASS
    • Playwright E2E (Chromium — Live Intelligence & Workstation) — PASS
  • Clean Virtualenv Verification: Both repodna-0.8.0-py3-none-any.whl and repodna-0.8.0.tar.gz verified in isolated Python 3.12 virtual environments (repodna --version == 0.8.0, repodna cache stats schema v2, repodna analyze, and RepoDNAMCPServer registering 23 tools).

Distribution Artifacts & SHA-256 Checksums

File Size SHA-256
repodna-0.8.0-py3-none-any.whl 390,979 bytes d4ede0b447fa4efa04a2f651adf1494a9f5253ce7df679e11f8d6607784f11f7
repodna-0.8.0.tar.gz 369,716 bytes f1f1e51ab24e60323d4bcea956bfbe558262959b323206e822fca3d6fbb3f991
d4ede0b447fa4efa04a2f651adf1494a9f5253ce7df679e11f8d6607784f11f7  repodna-0.8.0-py3-none-any.whl
f1f1e51ab24e60323d4bcea956bfbe558262959b323206e822fca3d6fbb3f991  repodna-0.8.0.tar.gz