تخطَّ إلى المحتوى
kazma.
EN نجمة 7 ابدأ الآن

Document Intelligence — Phase map (0–10)

Document Intelligence — Phase map (0–10)

Section titled “Document Intelligence — Phase map (0–10)”

This page is the source of truth for phase narrative. Product usage lives in Document Intelligence; security in Document security; ops in Document processing.

Start here if you only want to use the product: Document Intelligence (operator walkthrough + install). Use this phase map for engineering history and test ownership.

Phases were implemented primarily as code + tests; only phases 9–10 have dedicated CHANGELOG product entries. The map below reconstructs 0–8 from modules and phase-named tests so operators and contributors share one timeline.

Post-phase residuals (malware, Settings UI, Postgres metadata, soak): docs/plans/DOCUMENT_RESIDUALS_GOAL.md + CHANGELOG “Document residuals” entry.


PhaseNameOperator impactPrimary tests
0–2FoundationModels, config, CAS storage, repository, sandbox, job queuetest_documents_models, config, storage, repository, document_sandbox, document_jobs
3Sniff / intake policyHostile MIME/OOXML/PDF rejection before parseHostile corpus + processor security
4ParsersFormat parsers behind isolated workertest_document_parsers_phase4
4+PDF Arabic / multi-enginePyMuPDF primary + pypdfium2 bake-off + layout reading order + fuzzy RTL verifier (post-phase product hardening)test_document_parsers_phase4 (Arabic/layout/multi-engine), test_unified_document_layer (RTL verifier)
5OCRMultilingual quality-routed OCRtest_document_ocr_phase5
5+OCR Arabic scansara+eng language order; replace presentation-form/CID native layerstest_document_ocr_phase5, scanned PDF tests in parsers phase4
6KnowledgeStructural chunking → library indextest_document_knowledge_phase6
7Generate / convert / redactIsolated render + verified redactiontest_document_generation_phase7
8SurfacesIngestion coordinator, Web API, tools, gateway, TUItest_document_ingestion_phase8, *_api_phase8, *_actions_phase8, *_platform_tools_phase8
9Ops & scaleAudit, capacity, GC, metrics, backup, PG job claimstest_document_operations_phase9
10CertificationHostile corpus, cert CLI, a11y, crash matrixtest_document_certification_phase10

Full document suite (when run as the document test files): 217 passed, 2 skipped (optional engines) as of the Phase 10 recheck window — re-run to confirm on your tree.

Terminal window
& .venv\Scripts\python.exe -m pytest tests/test_document*.py tests/test_documents*.py -q

Modules: models.py (DocumentIR, DocumentJobState), config.py, storage.py (content-addressed blobs), repository.py, sandbox.py, jobs.py (SQLite durable queue).

What shipped: immutable document/version/blob model; live ConfigStore config; CAS paths; tenant-scoped repository; isolated subprocess runner; job CAS + leases.

Operator entry: none standalone — used by all later phases.


Modules: sniff.py (+ security policy flags on config).

What shipped: extension/content mismatch, OOXML XXE/macro/external-rel, compression bombs, PDF encrypt/active/polyglot policy, UTF-8 validity.

Operator entry: automatic on every ingest/parse; see hostile corpus.


Modules: parsers/*, parser_worker.py, registry.py, service.py.

What shipped: consolidated format parsers running only inside the isolated worker; capability readiness reporting.

Tests: tests/test_document_parsers_phase4.py.


Modules: ocr/* (Tesseract, raster, quality routing).

What shipped: per-page quality routing; language packs; similarity-based native/OCR merge; DPI raster fallback.

Tests: tests/test_document_ocr_phase5.py.


Modules: knowledge.py, indexer.py.

What shipped: structural chunking into Knowledge libraries; explicit index / unindex; fenced search.

Tests: tests/test_document_knowledge_phase6.py.
Bridge: Knowledge Library.


Phase 7 — Generation, conversion, redaction

Section titled “Phase 7 — Generation, conversion, redaction”

Modules: operations.py, mutation.py, mutation_worker.py, renderer_worker.py, renderers/*, artifacts.py.

What shipped: generate + re-ingest; convert; PDF split/merge/info/fill; verified redaction (optional engines may skip some tests).

Tests: tests/test_document_generation_phase7.py (some cases skip without engines).


Modules: ingestion.py (coordinator), kazma_ui/documents_api.py, documents.html / documents.js, gateway /documents, kazma_skills/.../document_platform, kazma_tui/documents.py.

What shipped: one durable public boundary for Web, API, tools, chat, TUI.

Tests:

  • test_document_ingestion_phase8.py
  • test_documents_api_phase8.py
  • test_document_actions_phase8.py
  • test_document_platform_tools_phase8.py

Operator entry: /documents UI · /api/documents/* · /documents slash · document_* tools · TUI Documents tab.


Modules: telemetry.py, audit.py, retention.py, capacity.py, backup.py, jobs_pg.py.

What shipped: Prometheus-safe metrics, append-only audit, mark/sweep GC, backpressure (429/503/507), document backup, Postgres job multi-replica claims, readiness honesty for SQLite metadata.

Tests: tests/test_document_operations_phase9.py (29 cases in file).
CHANGELOG: Unreleased Phase 9 entry.
Ops guide: Document processing.


Phase 10 — Certification, a11y, crash recovery

Section titled “Phase 10 — Certification, a11y, crash recovery”

Modules: certification.py, hostile_corpus.py, cert script scripts/certify_documents.py, UI a11y on Documents page.

What shipped: deterministic hostile corpus (19 cases), cert CLI JSON report, canary readiness, performance smoke, phase10 pytest groups (architecture, crash, a11y, rollout, backpressure).

Tests: tests/test_document_certification_phase10.py (29 cases).
Audit: docs/audits/AUDIT_DOCUMENT_CERTIFICATION.md (repo path, outside Docusaurus).
CHANGELOG: Unreleased Phase 10 entry + post-cert recheck notes.

CLI vs pytest: the CLI certifier runs hostile corpus, performance smoke, capabilities, rollout, plus explicit NOT RUN / CONDITIONAL gates. Architecture / a11y / full crash matrix are enforced in the pytest file.

Terminal window
python scripts/certify_documents.py
python scripts/certify_documents.py --soak

FilePhase focus
tests/test_documents_models.py0–2
tests/test_documents_config.py0–2
tests/test_documents_storage.py0–2
tests/test_documents_repository.py0–2
tests/test_document_sandbox.py0–2
tests/test_document_jobs.py0–2 / queue
tests/test_document_worker.pyworker
tests/test_document_processor_security.py3 / security
tests/test_document_parsers_phase4.py4
tests/test_document_ocr_phase5.py5
tests/test_document_knowledge_phase6.py6
tests/test_document_generation_phase7.py7
tests/test_document_ingestion_phase8.py8
tests/test_document_actions_phase8.py8
tests/test_documents_api_phase8.py8
tests/test_document_platform_tools_phase8.py8
tests/test_document_operations_phase9.py9
tests/test_document_certification_phase10.py10
tests/fixtures/documents/hostile_manifest.json10 corpus SoT