docling-studio/document-parser/tests
Pier-Jean Malandrino ef80e22342 feat(#256): add /api/documents/{id}/chunks routes + ChunkService
The frontend was wired against /api/documents/{id}/chunks/* (canonical
doc-centric chunkset) but the backend never exposed those routes — the
chunk tab in the doc workspace 404'd. The domain entities (Chunk,
ChunkEdit, ChunkPush) and persistence repos already existed since #205;
what was missing was the service + API layer that connects them.

ChunkService owns all canonical chunkset invariants (sequence ordering,
soft-delete + audit log atomicity) and shares the chunker port with
AnalysisService so chunking strategy stays a single implementation.

AnalysisService grew a duck-typed promoter hook that copies the chunks
of the first successful analysis into the canonical chunkset. The hook
is idempotent so subsequent ad-hoc analyses (Studio / OCR Debug) never
overwrite hand-edited state.

Routes added (all additive, /api/documents prefix):
  GET    /{id}/chunks
  POST   /{id}/chunks
  PATCH  /{id}/chunks/{chunkId}
  DELETE /{id}/chunks/{chunkId}
  POST   /{id}/chunks/{chunkId}/split
  POST   /{id}/chunks/merge
  POST   /{id}/rechunk
  GET    /{id}/tree
  GET    /{id}/diff?store=...
  POST   /{id}/chunks/push
2026-05-11 15:00:57 +02:00
..
neo4j fix(graph): collapse Docling InlineGroup and Picture children (#197) 2026-04-29 14:00:00 +02:00
__init__.py Add a stronger testing strategy 2026-03-18 14:46:37 +01:00
test_analysis_service.py feat(chunking): soft-delete chunk with confirmation dialog 2026-04-10 20:28:24 +02:00
test_api_endpoints.py feat(#210): feature-flag mode gating + deep-link redirect 2026-05-05 09:38:39 +02:00
test_api_stores.py feat(#251): /api/stores router + wiring + schemas Pydantic + tests API 2026-05-05 09:38:39 +02:00
test_architecture.py feat: add hexagonal architecture tests with pytestarch (#177) 2026-04-29 14:00:00 +02:00
test_bbox.py Move bbox.py from domain/ to infra/ and unify coordinate logic 2026-04-03 13:17:26 +02:00
test_chunk_editing.py feat(#205): promote chunks to first-class entities + audit trail 2026-05-05 09:38:39 +02:00
test_chunk_repos.py feat(#205): promote chunks to first-class entities + audit trail 2026-05-05 09:38:39 +02:00
test_chunk_service.py feat(#256): add /api/documents/{id}/chunks routes + ChunkService 2026-05-11 15:00:57 +02:00
test_chunking.py feat(#202): introduce Document lifecycle state machine 2026-05-05 09:38:39 +02:00
test_docling_agent_reasoning.py refactor(audit): remediate 0.5.0 audit findings — clean architecture, security, DRY, SOLID, perf 2026-04-29 14:00:00 +02:00
test_docling_graph.py fix(graph): collapse Docling InlineGroup and Picture children (#197) 2026-04-29 14:00:00 +02:00
test_document_chunks_api.py feat(#256): add /api/documents/{id}/chunks routes + ChunkService 2026-05-11 15:00:57 +02:00
test_document_service.py fix(arch): inject repositories and extract domain logic 2026-04-10 11:44:33 +02:00
test_embedding_client.py feat: add embedding microservice and EmbeddingService port 2026-04-10 20:53:24 +02:00
test_graph_api.py feat(reasoning): reasoning-trace viewer v1 with SQLite-backed graph 2026-04-29 14:00:00 +02:00
test_hashing.py feat(#204): deterministic chunkset hash for auto-stale detection 2026-05-05 09:38:39 +02:00
test_ingestion_api.py feat(#180): feature-flag ingestion pipeline and add brainless one-liner Quick Start 2026-04-13 11:18:56 +02:00
test_ingestion_service.py refactor(audit): remediate 0.5.0 audit findings — clean architecture, security, DRY, SOLID, perf 2026-04-29 14:00:00 +02:00
test_lifecycle.py feat(#202): introduce Document lifecycle state machine 2026-05-05 09:38:39 +02:00
test_lifecycle_aggregation.py feat(#203): per (document, store) ingestion state 2026-05-05 09:38:39 +02:00
test_migrate_06.py chore(#206): backfill 0.6.0 doc-centric data model 2026-05-05 09:38:39 +02:00
test_models.py refactor(audit): remediate 0.5.0 audit findings — clean architecture, security, DRY, SOLID, perf 2026-04-29 14:00:00 +02:00
test_ollama_provider.py refactor(audit): remediate 0.5.0 audit findings — clean architecture, security, DRY, SOLID, perf 2026-04-29 14:00:00 +02:00
test_opensearch_store.py feat(infra): add OpenSearch adapter implementing VectorStore port 2026-04-10 20:48:50 +02:00
test_pipeline_options.py refactor(audit): remediate 0.5.0 audit findings — clean architecture, security, DRY, SOLID, perf 2026-04-29 14:00:00 +02:00
test_rate_limiter.py Add in-memory rate limiting middleware 2026-04-03 13:56:05 +02:00
test_reasoning_api.py refactor(audit): remediate 0.5.0 audit findings — clean architecture, security, DRY, SOLID, perf 2026-04-29 14:00:00 +02:00
test_repos.py feat(#202): introduce Document lifecycle state machine 2026-05-05 09:38:39 +02:00
test_robustness.py fix(clean-code): English mode strings, SRP extraction, rename getter 2026-04-10 13:45:13 +02:00
test_schemas.py Format backend codebase with ruff 2026-04-02 12:33:07 +02:00
test_serve_converter.py refactor(audit): remediate 0.5.0 audit findings — clean architecture, security, DRY, SOLID, perf 2026-04-29 14:00:00 +02:00
test_settings.py feat(settings): paste-image size/type limits for #195 (#196) 2026-04-29 14:00:00 +02:00
test_store_repo.py feat(#251): SqliteStoreRepository — update/delete/find_by_name/clear_default_except 2026-05-05 09:38:39 +02:00
test_store_service.py feat(#251): add Neo4j as a StoreKind 2026-05-05 09:38:39 +02:00
test_vector_schema.py feat(domain): add VectorStore port and SearchResult value object 2026-04-10 20:40:17 +02:00
test_vector_store_port.py feat(domain): add VectorStore port and SearchResult value object 2026-04-10 20:40:17 +02:00