You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: restructure source tree by concern, declarative request validation
CPU recognizer reaches GPU accuracy parity (FUNSD-50 F1 82.28% -> 85.52%,
GPU 85.33%): single-warp crop straight to recognizer input with the shared
32px width floor (was a 320px stretch + double resample), det preprocess in
BGR per model spec. Correctness fixes: logger OOB write, batch-det aspect
distortion, GPU vertical-text rec bucketing, gRPC lifecycle/shutdown,
PPM mid-flush delivery, table/markdown HTML escaping.
Split oversized modules into single-concern TUs and regroup directories
(table/{slanext,vlm}, formula/{ppformulanet,vlm,routing}, pdf/{render,text},
pipeline/{ocr,pdf}, engine/trt, backend_routing, markdown). Join duplicated
logic into shared helpers (pipeline result moves, reading-order assignment,
image-size guards, curl/base64/trim utilities, single slanext host decoder).
Request validation runs on a declarative per-endpoint spec: routing
overrides, text=0 and embed=0 that cannot be honored fail loud; other
unsupported params are tolerated with X-Ignored-Params/X-Deprecation
response headers (removal planned for v4) or rejected under
TURBO_OCR_STRICT_QUERY_PARAMS=1. Parameter classification reads the URL
query string only (POST bodies are no longer parsed as parameters).
Tests grow to 294 cases; docs updated.
|`TURBO_OCR_STRICT_QUERY_PARAMS`|`0`| Opt-in: set `1` to reject with 400 any unknown parameter AND any known parameter the endpoint does not support. Default tolerates both (v3.4-compatible) — DEPRECATED: tolerated requests get an `X-Ignored-Params` + `X-Deprecation` response header and v4 rejects them with 400. Routing overrides, `text=0`, and `embed=0` on endpoints that cannot honor them are ALWAYS a 400 — ignoring those would falsify the response. |
258
+
|`TURBO_OCR_DISABLE_MALLOC_REAPER`|`0`| Disable the periodic malloc_trim reaper thread. |
The hook (`scripts/git-hooks/pre-commit`) runs static checks on **staged
10
+
files only** and is hard-capped at **20 seconds** — cheap greps first, then a
11
+
time-boxed cppcheck with whatever budget remains.
12
+
13
+
Each check maps to a defect class that has actually shipped in this repo:
14
+
15
+
| Check | Why it exists |
16
+
|---|---|
17
+
| No `std::cout` / `std::cerr` in `src/`| Diagnostics bypassed the structured logger's level control and per-site rate limiting — request-path prints were a log-flood surface. |
18
+
| No raw `getenv` in `src/`, `include/`| Config knobs were parsed by hand-pasted `to_int` copies with drifting semantics; `turbo_ocr::env` (common/env_utils.h) is the one parser. |
19
+
| No `std::stoi` family | An unguarded `std::stoi` on a daemon reply threw `std::invalid_argument` past the error taxonomy. Use `std::from_chars` with explicit handling. |
20
+
| No `file(GLOB)` in CMake | Explicit source lists only. |
21
+
| No orphaned `CMakeLists.txt`| Four dead ones misled contributors about the build layout. |
0 commit comments