text stringlengths 3 8.33k | repo stringclasses 52
values | path stringlengths 6 141 | language stringclasses 35
values | sha stringlengths 64 64 | chunk_index int32 0 273 | n_tokens int32 1 896 |
|---|---|---|---|---|---|---|
.py,
src/jku_kb/scrapers/huggingface.py,
src/jku_kb/scrapers/wikidata.py,
src/jku_kb/scrapers/wayback.py,
src/jku_kb/scrapers/web_crawl.py,
src/jku_kb/scrapers/pdf_fetch.py
</read_first>
<action>
Extend `tests/integration/test_live_apis.py` with 7 new test classes for web/media scrapers. Keep AL... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-02-PLAN.md | Markdown | 2935b6a151ac2dc9019c1a663d55fcc44f27a3f3f13f121e60030cef68e8aa60 | 7 | 896 |
text contains `/publications/download/risc_` (PDF links present).
Each live test class must be decorated with `@pytest.mark.live`. Each test method with `@pytest.mark.asyncio`.
</action>
<verify>
<automated>cd /c/Development/Private/jku-encyclopedia && uv run pytest tests/integration/test_live_apis.py -m live ... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-02-PLAN.md | Markdown | 9c2c58c64cc71be39946ab4ee07a1acc01c9ea56fddf045825d92fe92f7d6fa4 | 8 | 724 |
---
phase: 03-remaining-scrapers
plan: 02
subsystem: scrapers
tags: [scrapers, youtube, podcast, huggingface, wikidata, wayback, web-crawl, pdf-fetch, unit-tests, live-tests]
dependency_graph:
requires: [03-01]
provides: [youtube-scraper, podcast-scraper, huggingface-scraper, wikidata-scraper, wayback-scraper, web-... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-02-SUMMARY.md | Markdown | b958bc302bcdea099897a8adfd0ffef7ddd38cd93fb829258f04164c182b9565 | 0 | 896 |
Added `discovering_page` and `discovery_complete` logging
**huggingface.py:**
- Wrapped both model and dataset API calls in try/except with structured logging
- Fixed unused variable in `fetch()` (`item.metadata.get("type", "model")` result now unused after removing the unused assignment)
- Added `content_hash=self.co... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-02-SUMMARY.md | Markdown | 12222b486abe25121850bd0b311f8f942a8e4dc28d40ed3ed253e471a7676cbb | 1 | 896 |
: Checks JKU channel accessible via Data API v3; skips if `YOUTUBE_API_KEY` env var absent
- **TestWikidataLive**: SPARQL returns JKU-affiliated entities with `item` + `itemLabel` fields
- **TestWaybackLive**: CDX returns at least 2 rows (header + data) for jku.at fileadmin PDFs
- **TestHuggingFaceLive**: ml-jku has mo... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-02-SUMMARY.md | Markdown | 73c27b80cf5a15ccf837b57c78b723787da74c518dea2f998147583d2f36bebf | 2 | 454 |
# Phase 3: Remaining Scrapers - Context
**Gathered:** 2026-03-19
**Status:** Ready for planning
<domain>
## Phase Boundary
Implement and harden all remaining 11 source scrapers (5 academic API scrapers + 6 web/media scrapers), achieving full coverage of the ~42 JKU data sources. All 11 scrapers already exist as draf... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-CONTEXT.md | Markdown | 03c6747acc03afe74339d627cf19c31d64458a505e4b797e8916342bf78b07e3 | 0 | 896 |
tracking, dedup integration
- `src/jku_kb/scrapers/opencast.py` — Reference implementation: Phase 2 quality standard for discover + fetch
- `src/jku_kb/scrapers/github.py` — Reference implementation: Phase 2 quality standard
### Existing scraper code (all 11 to review + refactor)
- `src/jku_kb/scrapers/openalex.py` — ... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-CONTEXT.md | Markdown | 157a745acd3e94d62cd4a366e31e2933ec4c62d0619df5639ab04b226008f40d | 1 | 786 |
# Phase 3: Remaining Scrapers - Research
**Researched:** 2026-03-19
**Domain:** Multi-source web scraping — academic APIs, RSS, SPARQL, CDX, YouTube, HuggingFace, web crawl
**Confidence:** HIGH
---
<user_constraints>
## User Constraints (from CONTEXT.md)
### Locked Decisions
- **Wave 1 (academic APIs):** OpenAlex, ... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | 8621c7919e2c68612f2e53edab0bfcd5fee987fd0c6e1eb22316129bb72579bc | 0 | 896 |
to add; domain boundary enforcement needed |
| WEB-03 | PDF fetch scraper downloads fileadmin/gruppen PDFs | Draft impl exists; two-phase coordination (crawler discovery + gruppen_mapping.json) to implement |
| WEB-04 | YouTube scraper lists all videos with metadata from JKU channel | MISSING — no youtube.py exists; mu... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | 27c46731678145f267a1610c28ad1743a7975f033f084626b8988a06e6968b9c | 1 | 896 |
dependencies already installed. No new packages needed for any of the 11 scrapers.
---
## Architecture Patterns
### Established Pattern (Phase 2 quality bar)
Every scraper MUST match this structure from `opencast.py`:
```python
# Source: src/jku_kb/scrapers/opencast.py
async def discover(self) -> list[RawItem]:
... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | b925203a7297df296e4557e9529996fac8d160db2766ac85898f171646d7c107 | 2 | 896 |
. Cache check in `fetch()` uses manual `dest.exists()` instead of `_is_already_fetched()` — should use base method for consistency. Otherwise good.
**Semantic Scholar (semantic_scholar.py):** CRITICAL bug — `/paper/search` offset+limit <= 1000 cap means max ~1000 results. Must use `/paper/search/bulk` endpoint with to... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | f36f3f67c88a688fcb6761200c47575e84854c6a927f5e0967a77aa905055a39 | 3 | 896 |
discover() level
- **Not using `_is_already_fetched()`:** manual `dest.exists()` checks miss the manifest tracking layer
- **Mutable default arguments:** `pdf_urls: list[str] | None = None` pattern is correct — do not use `pdf_urls: list[str] = []`
---
## Don't Hand-Roll
| Problem | Don't Build | Use Instead | Why |... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | 14a1b7981926871024aacc15b5692c6cf97c158e6b17aaca5c1072c7a38555d4 | 4 | 896 |
.mock` as context manager or decorator before any request.
**How to avoid:** Use `mock_http_client` fixture from conftest.py — it uses `respx.mock(assert_all_called=False)` as context manager, which patches globally.
**Warning signs:** Test hits real network or raises `respx.RouteMismatch`.
### Pitfall 5: feedparser b... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | ba9a70db022a8bc8dbff401f51d970721400aa8fce659b1187b25c57325dc4b3 | 5 | 896 |
=params)
except Exception as exc:
self.log.error("api_error", error=str(exc))
break
if response.status_code != 200:
self.log.error("api_error", status=response.status_code)
break
data = response.json()
for video_item in data.get("items", ... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | 1af550a9e8e39f9bf22655f1783a1f752a170cee28b2b1cf9ce85ec6f844a4c0 | 6 | 896 |
", total_items=len(items))
return items
```
### respx mock pattern for paginated discover() (established in Phase 2)
```python
# Source: tests/unit/test_scrapers/test_openalex.py pattern
import respx
import pytest
from jku_kb.scrapers.arxiv import ArxivScraper
@pytest.mark.asyncio
async def test_discover_single_... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | b51e0ea957ef5a0e7dce83681443a9826887114784b6840e9469083ff5b376dc | 7 | 896 |
checking the `title` field returns "JKU" or "Johannes Kepler Universität Linz"
2. **HuggingFace author list completeness**
- What we know: Only `ml-jku` is in `JKU_HF_AUTHORS`
- What's unclear: Whether other JKU groups have HF presence (CPJKU, etc.)
- Recommendation: Claude's discretion to expand — `ml-jku` i... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | 379857c412f77bd6808dea5131931ce202aa204b1d19a673678230ff9527cede | 8 | 896 |
audio download | unit | `uv run pytest tests/unit/test_scrapers/test_podcast.py -x` | ❌ Wave 0 |
| WEB-06 | HuggingFace models+datasets for author, README fetch | unit | `uv run pytest tests/unit/test_scrapers/test_huggingface.py -x` | ❌ Wave 0 |
| WEB-07 | Wikidata SPARQL response parse, entity extraction | unit | `uv... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | 58ca5b3055971f57602ed6e28a7b5ea22832efbba7a48499da917f9697237297 | 9 | 896 |
; LIMIT 1000 behavior may vary by query complexity
- HuggingFace API pagination completeness — `/api/models?author=ml-jku` may be paginated via Link header for large orgs; ml-jku is small enough this is not a concern
---
## Metadata
**Confidence breakdown:**
- Standard stack: HIGH — all dependencies verified in pypr... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-RESEARCH.md | Markdown | d1ff3b01edc94e354b78ef294a542cbb1e150d156d8bd934c8b62c4c7745167c | 10 | 174 |
---
phase: 3
slug: remaining-scrapers
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-19
---
# Phase 3 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | ... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-VALIDATION.md | Markdown | a171d6b1ec450b4e4e7696263699bbe2bb235016bd87182181e02c004829ad50 | 0 | 896 |
| 03-02-07 | 02 | 2 | WEB-01,WEB-03 | unit | `uv run pytest tests/unit/test_scrapers/test_pdf_fetch.py -x` | ❌ W0 | ⬜ pending |
| 03-ALL | 01,02 | 1,2 | All | live | `uv run pytest tests/integration/test_live_apis.py -m live -x` | ❌ W0 | ⬜ pending |
*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
---
## Wave 0 Requ... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-VALIDATION.md | Markdown | 62e5c74a5e297c9952ae3fb9494f7d05e7b7b135e8374a2a9f037e5aebf1afac | 1 | 556 |
---
phase: 03-remaining-scrapers
verified: 2026-03-19T00:00:00Z
status: gaps_found
score: 10/12 must-haves verified
re_verification: null
gaps:
- truth: "All 7 scrapers (6 existing + 1 new) wrap _rate_limited_get in try/except with structured logging — specifically no file contains import hashlib or import urljoin in... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-VERIFICATION.md | Markdown | 55717088a7475001a8b1fa7b77536faceccbf171a17913964c3e08f19a9c699c | 0 | 896 |
Podigee URLs and downloads audio files | VERIFIED | podcast.py: JKU_PODCAST_FEEDS constant with podigee.io URLs, feedparser.parse(response.text) (not URL) |
| 11 | Wikidata scraper queries SPARQL with ORDER BY for stable results | VERIFIED | wikidata.py line 12: comment + `ORDER BY ?item` in query |
| 12 | Wayback scra... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-VERIFICATION.md | Markdown | c5af9b90172be6340ce2a84de0d948afe095f618d6b7b7a502d44519e2578222 | 1 | 896 |
----|--------|---------|
| `src/jku_kb/scrapers/semantic_scholar.py` | `api.semanticscholar.org/graph/v1/paper/search/bulk` | `_rate_limited_get call in discover()` | WIRED | API_BASE constant = https://api.semanticscholar.org/graph/v1/paper/search/bulk, called in discover() loop |
| `tests/unit/test_scrapers/test_arxi... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-VERIFICATION.md | Markdown | ba1b85f6f2f55024ddb69ffb3e8b76eeae3e3077ba2f6266848536d5c35a3d0e | 2 | 896 |
: ORDER BY, P108+P1416 UNION, module-level SPARQL constant |
| WEB-08 | 03-02 | Wayback Machine scraper discovers archived JKU content via CDX API | SATISFIED | wayback.py: HTTPS CDX, showResumeKey, from=2010, correct wayback URL construction |
All 13 requirement IDs from plan frontmatter accounted for. No orphaned re... | jku-encyclopedia | .planning/milestones/v1.0-phases/03-remaining-scrapers/03-VERIFICATION.md | Markdown | d07b4efc3566f09ca06f4399b12a1495762dabfe1febd40e43628eb8286c98c7 | 3 | 664 |
---
phase: 04-content-processing
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- src/jku_kb/chunkers/video_chunker.py
- src/jku_kb/chunkers/audio_chunker.py
- tests/unit/test_chunkers.py
- tests/conftest.py
autonomous: true
requirements: [CHUNK-01, CHUNK-03, CHUNK-04, CHUNK-06, CHUNK-08]
must_h... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-01-PLAN.md | Markdown | 86e96dc421ae624ca62b1f5c1433a06b958a31cb9ffe4fec129cdfd7ced9baf8 | 0 | 896 |
]
s = suffix or ""
return f"{item.source_id}_{item.item_id}_{mod_char}_chunk_{index:04d}{s}"
```
From src/jku_kb/models.py:
```python
class Modality(StrEnum):
TEXT = "text"
DOCUMENT = "document"
IMAGE = "image"
VIDEO = "video"
AUDIO = "audio"
CODE = "code"
class ChunkStatus(Str... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-01-PLAN.md | Markdown | 727548c9bcb3955a5dbc7482530ee8d6f5ba2a4d246331ff4cef7ec14c689fd3 | 1 | 896 |
`ffmpeg -f lavfi -i sine=frequency=440:duration=5 -c:a aac {tmp_path}/test_audio.m4a`. Return the Path.
Add to `tests/unit/test_chunkers.py`:
```python
from unittest.mock import AsyncMock, patch, MagicMock
from jku_kb.chunkers.video_chunker import VideoChunker, _compute_segments
from jku_kb.chunke... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-01-PLAN.md | Markdown | 9bb0cecc819b04abd82fc29efb566844b873445af3f68a99749f9578c8fd1681 | 2 | 896 |
)
segments = _compute_segments(duration, self.segment_seconds, self.overlap_seconds)
suffix = local_path.suffix or ".mp4"
chunks: list[Chunk] = []
for idx, (start, end) in enumerate(segments):
chunk_id = self._make_chunk_id(item, idx)
chun... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-01-PLAN.md | Markdown | d986ba6daf809a08ce70cfb1feaaec1e4f71e6893ea93ab0aeaf73a7c1a1cc15 | 3 | 896 |
.
</done>
</task>
</tasks>
<verification>
1. `uv run pytest tests/unit/test_chunkers.py -x -q` — all chunker tests pass including new video/audio
2. `uv run pytest tests/ -q -m 'not live'` — full unit suite still green
3. `uv run python -c "from jku_kb.chunkers.video_chunker import VideoChunker; print('ok')"` — imp... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-01-PLAN.md | Markdown | 89835c0d655774c7dd066a675870b651a99c7b30fcf09d8d19e25773b3b82728 | 4 | 235 |
---
phase: 04-content-processing
plan: "01"
subsystem: chunkers
tags: [video, audio, ffmpeg, chunking, tdd, asyncio]
dependency_graph:
requires:
- src/jku_kb/chunkers/base.py
- src/jku_kb/models.py
- ffmpeg-python==0.2.0
- ffmpeg binary (8.0.1)
provides:
- VideoChunker (CHUNK-03)
- AudioChun... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-01-SUMMARY.md | Markdown | 9ad9d62eb0d5333e9fb3776620cfe3c2df687b5ce8fad74dcb4c1c84674ba0fc | 0 | 896 |
py -x -q` — 17 passed
- `uv run pytest tests/ -q -m 'not live'` — 231 passed, 1 pre-existing failure (unrelated)
- `from jku_kb.chunkers.video_chunker import VideoChunker` — ok
- `from jku_kb.chunkers.audio_chunker import AudioChunker` — ok
## Self-Check: PASSED
Files exist:
- src/jku_kb/chunkers/video_chunker.py — F... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-01-SUMMARY.md | Markdown | 5a65645f10cc61c3260dce39726944b2570fbd1245ed15253afe89281808fc3f | 1 | 121 |
---
phase: 04-content-processing
plan: 02
type: execute
wave: 2
depends_on: ["04-01"]
files_modified:
- src/jku_kb/chunkers/caption_chunker.py
- src/jku_kb/chunkers/__init__.py
- src/jku_kb/chunkers/text_chunker.py
- tests/unit/test_chunkers.py
autonomous: true
requirements: [CHUNK-02, CHUNK-05, CHUNK-07]
must... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-02-PLAN.md | Markdown | ae5b5d01e013c230280b84ff1599288b51a3357cff79ba67b696dde629f0ae06 | 0 | 896 |
..
async def chunk(self, item: RawItem, local_path: Path, output_dir: Path) -> list[Chunk]: ...
```
From src/jku_kb/chunkers/base.py:
```python
class BaseChunker(ABC):
modality: Modality
def __init__(self) -> None: ...
@abstractmethod
async def chunk(self, item: RawItem, local_path: Path, output_di... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-02-PLAN.md | Markdown | d510f5ea08b069fc77e3184fa5202cd82179e09eab08fb0c98c97bc9b6340ee2 | 1 | 896 |
DOCUMENT) returns PdfChunker instance
- Test: get_chunker(Modality.TEXT) returns TextChunker instance
- Test: get_chunker(Modality.VIDEO) returns VideoChunker instance
- Test: get_chunker(Modality.AUDIO) returns AudioChunker instance
- Test: get_chunker(Modality.IMAGE) returns ImageChunker instance
... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-02-PLAN.md | Markdown | 3ddc0910f020000911a06d6e104c4ea831f242631382b3013418a10a55bf52c9 | 2 | 896 |
m, s = parts
return int(h) * 3600 + int(m) * 60 + float(s)
m, s = parts
return int(m) * 60 + float(s)
def _fmt_ts(seconds: float) -> str:
"""Format seconds as HH:MM:SS."""
h = int(seconds // 3600)
m = int((seconds % 3600) // 60)
s = int(seconds % 60)
... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-02-PLAN.md | Markdown | 3b4d52bd47f489188fc759d51eec4b8775294963d2ffd617fc414772841a9810 | 3 | 896 |
(),
Modality.IMAGE: ImageChunker(),
Modality.VIDEO: VideoChunker(),
Modality.AUDIO: AudioChunker(),
}
def get_chunker(modality: Modality) -> BaseChunker:
"""Return the chunker for the given modality.
Note: CaptionChunker is not in this registry because captions
... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-02-PLAN.md | Markdown | be0fdf3cca13e0d5b76dbad2cefdcde1428034ff8f1d4ee375b0795f6a759ac5 | 4 | 735 |
---
phase: 04-content-processing
plan: 02
subsystem: chunking
tags: [python, vtt, srt, caption, chunker, tiktoken, dispatcher, registry]
requires:
- phase: 04-01
provides: VideoChunker and AudioChunker (wired into dispatcher)
- phase: 01
provides: BaseChunker ABC, Chunk/RawItem/Modality models
provides:
... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-02-SUMMARY.md | Markdown | dedf82b944be3f3675aa227a07ac23cef4449299ef3469747f10dceba4568608 | 0 | 896 |
`tests/unit/test_chunkers.py` - TestCaptionChunker and TestGetChunker classes added
- `tests/conftest.py` - sample_vtt_file and sample_srt_file fixtures added
## Decisions Made
- CaptionChunker is not registered in `_CHUNKERS` because it maps captions to `Modality.TEXT` — the same modality TextChunker already handles... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-02-SUMMARY.md | Markdown | ce6c8d81f7796886ec41be00b54718cf984d57fd9d21e05585c03cf877408086 | 1 | 266 |
# Phase 4: Content Processing - Research
**Researched:** 2026-03-19
**Domain:** Multimodal chunking — PDF, text, video, audio, code, image, VTT/SRT caption, slide thumbnail
**Confidence:** HIGH
---
## Summary
Phase 4 builds the missing video, audio, and caption chunkers, then wires all chunkers into the pipeline. F... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | 171ffef4f58d7683e2bfbd1b37d712bf3529a7b185c3c413e24d88d4220c5ad9 | 0 | 896 |
tiktoken` | 0.12.0 | Token counting for text and code chunkers | Yes |
| `ffmpeg-python` | 0.2.0 | Python bindings for ffmpeg CLI (probe, input, trim, output, run) | Yes |
| `ffmpeg` (binary) | 8.0.1 | System binary called by ffmpeg-python | Yes — in PATH |
| `pydantic` | 2.12.5 | All Chunk/RawItem models | Yes |
| `as... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | f4e570020df66aa39804741cf06bae43320823de65482743b79d47d5079aace3 | 1 | 896 |
nearest keyframe before decoding. This avoids reading from byte 0, meeting the "no full file in memory" requirement.
**Why `c='copy'`:** Stream copy passes encoded packets through without decoding/re-encoding. This is ~100x faster than re-encoding and keeps the chunker stateless.
### Pattern 2: Getting Video/Audio Du... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | 6f40d644c43d16705705ea3589afea678919c1b281fa5a2b8932cc05f3055df0 | 2 | 896 |
ts = ts.replace(",", ".")
parts = ts.split(":")
if len(parts) == 3:
h, m, s = parts
return int(h) * 3600 + int(m) * 60 + float(s)
else:
m, s = parts
return int(m) * 60 + float(s)
```
After parsing cues, group them into text windows using the same approach as `TextChunker` (t... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | 5a24b503354d0ee092df1eb6ebfaf4d2f75893bda3d63c4359b17a67cd7c3175 | 3 | 896 |
arrow characters | Regex with `_TIMESTAMP_RE` | VTT allows optional cue identifiers, metadata headers, and NOTE blocks; regex on blocks handles edge cases |
| Async ffmpeg execution | Custom subprocess management | `asyncio.to_thread(ffmpeg.run, stream)` | `ffmpeg.run_async()` returns a `Popen` object but does not inte... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | b0571f50a7deb60a9fce8e3b7005f49bcfee09a0e5353d71cbf3f3c5828fee34 | 4 | 896 |
py` has `self.max_tokens - self.overlap_tokens` as a standalone expression with no assignment — this is dead code. mypy strict and ruff will flag it.
**Why it happens:** Refactoring artifact.
**How to avoid:** Remove that line when touching `text_chunker.py`.
---
## Code Examples
### Video Chunker — Complete Skeleto... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | 68267b4c266f358eb714a2779e5fa53828d39ce02f2e40e45f18adfd8d3085f9 | 5 | 896 |
fast seek + `-c copy` stream pass-through | ~100x faster, O(1) memory |
| webvtt-py or pycaption library | stdlib `re` block parsing | No extra dependency, handles VTT + SRT |
| Synchronous ffmpeg calls in async code | `asyncio.to_thread(ffmpeg.run, ...)` | Non-blocking event loop |
**Deprecated/outdated:**
- `pdfmine... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | b103b75b24b6e777e14568ccd940b225c2ee4cd2d8b8a3b571530097dad9bf5b | 6 | 896 |
py::TestAudioChunker -x` | No — Wave 0 |
| CHUNK-05 | Code: small file → 1 chunk; large file → split by function | unit | `uv run pytest tests/unit/test_chunkers.py::TestCodeChunker -x` | Yes (1 test exists) |
| CHUNK-06 | Image: existing file → 1 chunk; missing → 0 chunks | unit | `uv run pytest tests/unit/test_chunke... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-RESEARCH.md | Markdown | 65358edb0fbeaa0e4bd1e35287edb56a64277affc3cca3bd0e405a5dacd5d0a1 | 7 | 880 |
---
phase: 4
slug: content-processing
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-19
---
# Phase 4 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | ... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-VALIDATION.md | Markdown | 79e6cddd42ffc4380c3b6f3beab2ff82ff21122c9e6766563bf457d0217456b0 | 0 | 896 |
Off
- [ ] All tasks have `<automated>` verify or Wave 0 dependencies
- [ ] Sampling continuity: no 3 consecutive tasks without automated verify
- [ ] Wave 0 covers all MISSING references
- [ ] No watch-mode flags
- [ ] Feedback latency < 5s
- [ ] `nyquist_compliant: true` set in frontmatter
**Approval:** pending
| jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-VALIDATION.md | Markdown | 08ed204e386b706552bc47ca57058083f9ea798f83eac08d499d8455fb036be5 | 1 | 73 |
---
phase: 04-content-processing
verified: 2026-03-19T22:30:00Z
status: passed
score: 11/11 must-haves verified
re_verification: false
---
# Phase 4: Content Processing Verification Report
**Phase Goal:** Build all modality-specific chunkers and OpenCast-specific extras (caption parsing, slide extraction).
**Verified... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-VERIFICATION.md | Markdown | ddd143c50e7723bf50ceb4079bf914215b9ec626e32d6ce43ffc5079def7f9ca | 0 | 896 |
-----------|-------|--------|
| `src/jku_kb/chunkers/video_chunker.py` | VideoChunker class, _compute_segments, _get_duration | YES | 101 lines, full implementation | Imported by audio_chunker, __init__, test_chunkers | VERIFIED |
| `src/jku_kb/chunkers/audio_chunker.py` | AudioChunker class | YES | 70 lines, full impl... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-VERIFICATION.md | Markdown | a95c73aeb8fc52e7cb3e3a68686fef5a69afa38ab6164cd0c200e9c7278d1c97 | 1 | 896 |
, 500-token overlap) | SATISFIED | `TextChunker` existed pre-phase; `TestTextChunker` 3 tests pass; dead code removed in this phase |
| CHUNK-03 | 04-01 | Video chunker (90s segments, 15s overlap via ffmpeg) | SATISFIED | `VideoChunker` implemented; 6 tests pass |
| CHUNK-04 | 04-01 | Audio chunker (90s segments, 15s o... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/04-VERIFICATION.md | Markdown | b55db2a9bbf021c50e1b9c68842e2b422cda44dcb015a384f951e464fcaff907 | 2 | 783 |
# Deferred Items — Phase 04 Content Processing
## Pre-existing Issues (out of scope)
### tests/e2e/test_pipeline_smoke.py::TestPipelineSmoke::test_dedup_across_sources
**Status:** Pre-existing failure (confirmed before phase 04 changes)
**Issue:** `engine.is_duplicate()` returns a tuple `('oa_123', 'doi')` but the t... | jku-encyclopedia | .planning/milestones/v1.0-phases/04-content-processing/deferred-items.md | Markdown | 2c2a7b97557577fde582e80ad5b6537826216d6bb818147cf076afa8774979f1 | 0 | 200 |
---
phase: 05-embedding-storage
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- src/jku_kb/embedders/gemini.py
- tests/unit/test_embedders/__init__.py
- tests/unit/test_embedders/test_gemini.py
autonomous: true
requirements: [EMBED-01, EMBED-04]
must_haves:
truths:
- "Pipeline startup verifi... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-PLAN.md | Markdown | e11e300333b0d92bb439bcbd4a2220096ff1c545edf5ab123f57b9cb30809372 | 0 | 896 |
.py (for test pattern reference)
</read_first>
<behavior>
- test_embed_text_uses_to_thread: embed_text() calls asyncio.to_thread with self._client.models.embed_content — verify to_thread was called (not direct SDK call)
- test_embed_text_returns_correct_dimension: embed_text("hello") returns EmbeddingResult... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-PLAN.md | Markdown | ee1c5ac47c487a4860843d606a53b397a8a43ec0560974c94bef0392a48f2de2 | 1 | 896 |
-encyclopedia && uv run pytest tests/unit/test_embedders/test_gemini.py -x -q 2>&1 | tail -5</automated>
</verify>
<acceptance_criteria>
- tests/unit/test_embedders/__init__.py exists (can be empty)
- tests/unit/test_embedders/test_gemini.py contains `def test_embed_text_uses_to_thread`
- tests/unit/tes... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-PLAN.md | Markdown | 7c970b8cf85257cfa14d118acd80c8a3f079284774e007f5803166d97adb3dbb | 2 | 896 |
: Any) -> Any:
return await asyncio.to_thread(
self._client.models.embed_content,
model=self.model,
contents=contents,
)
```
Replace all `asyncio.to_thread(self._client.models.embed_content, ...)` calls with `await self._call_embed_content... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-PLAN.md | Markdown | ae59dd2610c9d78d83bfb37a31cf6f35bd37696aeb81a9edd1ff32c4801ec6d7 | 3 | 896 |
) if d != expected}
if mismatches:
raise ValueError(
f"Dimension mismatch across modalities. expected={expected}, actual={mismatches}"
)
self._dimensions = dims
self.log.info("dimensions_probed", dimensions={m.value: d for m, d in dims.i... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-PLAN.md | Markdown | 440d125ab5b0bd0951c7a0c9dd5efba9b80cda02b24afb0e5dee3af5628a61d4 | 4 | 896 |
. Orphan sweep deletes files older than threshold
4. Startup probe executes real per-modality checks (text/document/image/video/audio) via `probe_all_dimensions()` before batch work and fails fast on mismatches
5. Video/audio poll has timeout guard (max 30 polls)
6. All unit tests pass, full suite passes
</success_crit... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-PLAN.md | Markdown | ced137102365b16652e4523bd9321467366e6dcd80000b5949ad5d1c0cadb076 | 5 | 102 |
---
phase: 05-embedding-storage
plan: 01
subsystem: embedding
tags: [gemini, asyncio, tenacity, to_thread, retry, orphan-sweep, dimension-probe]
requires:
- phase: 04-content-processing
provides: Chunk model with modality field used by embed_chunk dispatch
provides:
- GeminiEmbedder with asyncio.to_thread wra... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-SUMMARY.md | Markdown | 2ced4f243c403ccf7dbe332f525ad9aec0f7ce910df5e2c694efa8d96b250c55 | 0 | 896 |
tests/unit/test_embedders/__init__.py` - Package init (empty)
- `tests/unit/test_embedders/test_gemini.py` - 11 unit tests covering all hardening behaviors
## Decisions Made
- `_call_embed_content` is a separate private method so the tenacity `@retry` decorator can be applied cleanly without touching the public `embe... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-01-SUMMARY.md | Markdown | 6b1f976b601ae9ea9266f92adb6dc9ddc09704d22697fb8f5d1e4aa5bb7b846b | 1 | 503 |
---
phase: 05-embedding-storage
plan: 02
type: execute
wave: 1
depends_on: []
files_modified:
- src/jku_kb/storage/qdrant.py
- tests/unit/test_storage/__init__.py
- tests/unit/test_storage/test_qdrant.py
autonomous: true
requirements: [QDRT-01, QDRT-02, QDRT-03, QDRT-04]
must_haves:
truths:
- "A vector coll... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-02-PLAN.md | Markdown | 56f9ba9856f96d762bb6ec0e5cb4fe0ccbd16dd2a86648b20d690e065bbc4141 | 0 | 896 |
test_upsert_batch_chunking_500: upsert_batch with 1200 points calls client.upsert 3 times (500, 500, 200)
- test_upsert_batch_partial_failure_retries_individually: when a 500-batch fails, each point is retried individually
- test_upsert_batch_dead_letter_on_individual_failure: when individual retry also fails, ... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-02-PLAN.md | Markdown | ccc25c189cf90108ff58d7200e0037683c3018358ad68d8119b837f222c494c4 | 1 | 896 |
done>Test file created with 10+ tests covering collection creation, payload indexes, batch chunking, partial failure retry, dead letter, and search filtering</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Harden QdrantStore — topic_tags index, batch chunking, retry</name>
<files>src/jku_kb/storage/qdra... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-02-PLAN.md | Markdown | 85aa4a9f6ca34961d4ed0216a9666945054a0a9f33b4a4f94a8e3a7ee935495d | 2 | 896 |
>
<acceptance_criteria>
- src/jku_kb/storage/qdrant.py contains `"topic_tags", models.PayloadSchemaType.KEYWORD`
- src/jku_kb/storage/qdrant.py contains `QDRANT_BATCH_SIZE = 500`
- src/jku_kb/storage/qdrant.py contains `dead_letter: list[str] = []`
- src/jku_kb/storage/qdrant.py contains `for i in ran... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-02-PLAN.md | Markdown | 87ec1e57e05cd2f9f8cad5fd6d23eaeabb27e5153a801d6a62331361b0cd4964 | 3 | 387 |
---
phase: 05-embedding-storage
plan: 02
subsystem: database
tags: [qdrant, vector-store, async, batch-upsert, dead-letter, payload-index]
# Dependency graph
requires:
- phase: 05-embedding-storage
provides: QdrantStore base implementation with connect/upsert/search
provides:
- QdrantStore with 7 payload inde... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-02-SUMMARY.md | Markdown | 00ace155bfc530bd73fde90633ce30cc56f1b2f465e83230a6598146152ac237 | 0 | 896 |
constant makes batch sizing tunable without touching business logic
- `topic_tags` uses `PayloadSchemaType.KEYWORD` consistent with Qdrant's multi-value array index convention
## Deviations from Plan
None - plan executed exactly as written.
## Issues Encountered
Pre-existing test failures in `tests/unit/test_embedd... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-02-SUMMARY.md | Markdown | 60876275637e4a4c3d60c6fe5e236ea2680e71749ba8becd4acb2a923a46d024 | 1 | 170 |
---
phase: 05-embedding-storage
plan: 03
type: execute
wave: 1
depends_on: []
files_modified:
- src/jku_kb/storage/neo4j.py
- tests/unit/test_storage/test_neo4j.py
autonomous: true
requirements: [NEO-01, NEO-02, NEO-03, NEO-04, NEO-05]
must_haves:
truths:
- "Neo4j schema setup succeeds and can be rerun withou... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-03-PLAN.md | Markdown | a6cfcfac811eb123c0fb08fe06da10ebb7a6a50a5c6fd3925b8e30c963cfcfc9 | 0 | 896 |
creation for modality, year, language
- test_node_types_chunk: upsert_chunk_node creates Chunk node with all fields
- test_node_types_source: create_source_node creates Source node
- test_node_types_institute: create_institute_node creates Institute node
- test_node_types_topic_domain: create_topic_node... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-03-PLAN.md | Markdown | 16db33acb993ae98a5f552ff76152b901341f2fd6bf20ee32e14b21b1ec57455 | 1 | 896 |
,"Jones")]), assert UNWIND query with AUTHORED_BY
Tests should FAIL for: explicit transaction tests (current code uses session.run), batch author links (method doesn't exist yet).
</action>
<verify>
<automated>cd C:/Development/Private/jku-encyclopedia && uv run pytest tests/unit/test_storage/test_neo4j.py... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-03-PLAN.md | Markdown | b9b9ddfabb9489d1c96caf8a82135d420fe68ef05dcd6b2d6d84f0cd02b6392c | 2 | 896 |
assert self._driver is not None
if not pairs:
return
query = """
UNWIND $items AS item
MERGE (a:Author {name: item.author_name})
WITH a, item
MATCH (c:Chunk {chunk_id: item.chunk_id})
MERGE (c)-[:AUTHORED_BY]->(a)
"""... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-03-PLAN.md | Markdown | 4101ec81f0770059edeedbfee7ec0c25912795e1c7bdc6415089cd5b25157846 | 3 | 652 |
---
phase: 05-embedding-storage
plan: "03"
subsystem: storage
tags: [neo4j, transactions, batch, graph, tdd]
dependency_graph:
requires: [src/jku_kb/storage/neo4j.py, src/jku_kb/models.py, src/jku_kb/config.py]
provides: [hardened Neo4jStore with explicit transactions and batch author links]
affects: [tests/unit/... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-03-SUMMARY.md | Markdown | 374578090929f1b813d717bf70c736f2ad7f5426375ca2d6df6a9773a684f2d2 | 0 | 896 |
MERGE+MATCH | MERGE on Author (idempotent), then MATCH existing Chunk — avoids duplicate Author nodes across batches |
| MagicMock for driver (not AsyncMock) | driver.session() is used in `async with` — AsyncMock makes it return a coroutine instead of the session object |
## Deviations from Plan
### Auto-fixed Issues... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-03-SUMMARY.md | Markdown | 5aa0ca9ab3b30c7ecd6ee239ce862a0268229fa8d1877836babdd3f79bd350bb | 1 | 540 |
---
phase: 05-embedding-storage
plan: 04
type: execute
wave: 2
depends_on: [05-01, 05-02, 05-03]
files_modified:
- src/jku_kb/embedders/batch.py
- tests/unit/test_embedders/test_batch.py
autonomous: true
requirements: [EMBED-02, EMBED-03]
must_haves:
truths:
- "Each successful embedding is persisted immediate... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-PLAN.md | Markdown | 7926d5397381e766d2b5ce35853a47fc8235f76bbd7a70deacf77952abcfc415 | 0 | 896 |
src/jku_kb/storage/qdrant.py (after Plan 02 hardening):
```python
class QdrantStore:
async def connect(self) -> None: ...
async def ensure_collection(self, dimension: int) -> None: ...
async def upsert(self, chunk: Chunk, embedding: EmbeddingResult) -> None: ...
async def upsert_batch(self, chunks: list... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-PLAN.md | Markdown | d2884db6403a960f73dcc6ee4267109ae0a263df5341acbdbcaaec44c979f71f | 1 | 896 |
.asyncio`):
- `test_embed_chunks_calls_embed_chunk_per_item`: call embed_chunks(sample_chunks), assert mock_embedder.embed_chunk.call_count == 3
- `test_embed_chunks_respects_semaphore`: set concurrency=2, embed 5 chunks, verify not more than 2 concurrent (use timing or mock side_effect)
- `test_on... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-PLAN.md | Markdown | 832c32b7ccc30ab645a74154e6afc20cb2fb657d1551c02b3671eca1d6c38fd1 | 2 | 896 |
.logging import get_logger
from jku_kb.models import Chunk, EmbeddingResult, EmbedStatus
```
2. **Add `_dead_letter_lock`** module-level:
```python
_dead_letter_lock = asyncio.Lock()
```
3. **Add `_dead_letter_path_for_source()` helper:**
```python
def _dead_le... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-PLAN.md | Markdown | b7619b1982f69fadd24f8e2a8cf36ae8ff428772019b14c60ae19765c1979df2 | 3 | 896 |
: Exception = failed_stores[label]
recovered = False
for _attempt in range(max_retries):
try:
await write_fn()
recovered = True
break
except Exception as r... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-PLAN.md | Markdown | e664e468744c3941b046f2b891388be7ab4e9535b84bcea7039acee998d2fc5a | 4 | 896 |
are written to per-source dead-letter JSONL files and skipped on rerun
5. Dead-letter file writes are serialized via asyncio.Lock
6. All unit tests pass, full suite passes
</success_criteria>
<output>
After completion, create `.planning/phases/05-embedding-storage/05-04-SUMMARY.md`
</output>
| jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-PLAN.md | Markdown | 3d6ead78eb9abcba47b73e8fa969146fd475b7ac54a9227b99bf4d3cfca5d274 | 5 | 73 |
---
phase: 05-embedding-storage
plan: "04"
subsystem: embedder
tags: [embedding, batch, dual-store, qdrant, neo4j, dead-letter, retry, asyncio]
dependency_graph:
requires: [05-01, 05-02, 05-03]
provides: [make_dual_store_callback, per-source-dead-letter, rerun-skip]
affects: [orchestrator, phase-06-graph-linking]... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-SUMMARY.md | Markdown | 88c450147668919ca517eccb0c6c513577432c50a63109db1064023d65459c78 | 0 | 896 |
test_dual_store_callback_dead_letter_on_total_failure` | chunk_id in dead_letter + JSONL exists |
| `test_dead_letter_write_is_serialized` | concurrent writes produce parseable JSONL |
| `test_dead_letter_path_is_per_source` | path resolves to `<root>/<source_id>/dead_letter.jsonl` |
| `test_callback_skips_chunks_liste... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-04-SUMMARY.md | Markdown | 8df0fbb7c9d410d10f79cd63a29399ffc1104725c7502be9b28a466bb0459e39 | 1 | 349 |
# Phase 5: Embedding & Storage - Context
**Gathered:** 2026-03-19
**Status:** Ready for planning
<domain>
## Phase Boundary
Connect the Gemini embedding API to chunk output from Phase 4, build hardened Qdrant and Neo4j storage clients with batch operations, and verify embedding dimension consistency across all modal... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-CONTEXT.md | Markdown | 859e7b49c938e2737233442df177b5f09cb8e36eb14f8bb4554653f2fc4e9253 | 0 | 896 |
# Infrastructure
- `docker-compose.yml` — Qdrant v1.13.2 (port 6333) and Neo4j 5.26 Community (port 7474)
</canonical_refs>
<code_context>
## Existing Code Insights
### Reusable Assets
- **GeminiEmbedder**: Full modality dispatch already implemented — needs hardening (to_thread wrapping, retries, startup sweep) not ... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-CONTEXT.md | Markdown | 927d30c47f066ad8930f063c3bf92b6bb94e760ac6fe4247e8c4a89f520d30b4 | 1 | 469 |
# Phase 5: Embedding & Storage - Research
**Researched:** 2026-03-19
**Domain:** Gemini multimodal embeddings, Qdrant vector store, Neo4j graph store, async Python batch orchestration
**Confidence:** HIGH
---
<user_constraints>
## User Constraints (from CONTEXT.md)
### Locked Decisions
**Gemini API strategy**
- Wr... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | c670088bd23bc9eb5c8a1455261f8f4e43fd5a95b57a86eff75ffe868a46b3a5 | 0 | 896 |
created for source_id, modality, language, institute_id, topic_tags, year, author | `ensure_collection()` creates 6 indexes — `topic_tags` KEYWORD index is MISSING from current implementation |
| QDRT-03 | Batch upsert operations (500 points per batch) with metadata payloads | `upsert_batch()` exists but lacks 500-poin... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | 9db8e45b13b0201c12ab81bf82f8113a91b0fb49c23d6e94b04606a6d1f18dd5 | 1 | 896 |
| >=1.1 | Async rate limiting | AsyncLimiter already in BatchEmbedder — avoid exceeding Gemini 20 RPS |
| asyncio (stdlib) | Python 3.12 | Concurrency control | Semaphore + TaskGroup + gather + to_thread all used |
| structlog | >=24.4 | Structured logging | get_logger() used consistently — context binding for chunk_id... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | ec71593de3b6e50c88cdd62ba86fed1ebc727361c5288f0dd6bac81869243611 | 2 | 896 |
(_is_retryable),
reraise=True,
)
async def _call_embed_with_retry(self, ...) -> EmbeddingResult:
...
```
### Pattern 3: Per-Modality Dimension Probe at Startup
**What:** Probe text, document, image, video, audio separately and store in a `_dimensions: dict[Modality, int]` map.
**When to use:** Called once at ... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | e2400bfe8ed057488f5b7b9a3a0e162ec534b8fce3625ce8b112fe25046262da | 3 | 896 |
24) -> int:
"""Delete orphaned uploaded files from previous crashed runs."""
assert self._client is not None
deleted = 0
files = await asyncio.to_thread(self._client.files.list)
for f in files:
age = (datetime.now(UTC) - f.create_time).total_seconds() / 3600
if age > max_age_hours:
... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | e72ad023891af2cc53d1f9f432039dbf23692c04f93cbeb25f9bb76ab8f3b917 | 4 | 896 |
` is a silent mistake — no error, just no concurrency.
**How to avoid:** Wrap every `self._client.*` call in `asyncio.to_thread()`.
**Warning signs:** Batch embedding 10 chunks takes 10x a single embedding time (serial), not ~1x (parallel).
### Pitfall 2: Missing topic_tags Payload Index
**What goes wrong:** QDRT-02 ... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | 9e22077f78a1ab69fe7a5c8ee7e84a2138d8e7737759d3b100c48906ab0eb980 | 5 | 896 |
some platforms, concurrent appends without locking produce interleaved/corrupted JSONL lines.
**Why it happens:** `asyncio.TaskGroup` runs tasks concurrently; dead-letter writes are not serialized.
**How to avoid:** Use an `asyncio.Lock` to serialize dead-letter writes, or collect failures and write them in the post-ba... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | 5c61f9dfb6b365539b6926ae7ac548bee420e5addcc4c8eb4df88c1353e4a562 | 6 | 896 |
mock_genai_client():
client = MagicMock()
embed_response = MagicMock()
embed_response.embeddings = [MagicMock(values=[0.1] * 3072)]
client.models.embed_content.return_value = embed_response
return client
@pytest.fixture
def embedder(settings, mock_genai_client):
emb = GeminiEmbedder(settings)
... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | 18f93398f3ce1a83098587e78824b1049df11246107d105e7923a97781650499 | 7 | 896 |
| Property | Value |
|----------|-------|
| Framework | pytest 8.3 + pytest-asyncio 0.25 |
| Config file | `pyproject.toml` (`[tool.pytest.ini_options]`) |
| Quick run command | `uv run pytest tests/unit/test_embedders/ tests/unit/test_storage/ -x -q` |
| Full suite command | `uv run pytest tests/ -q` |
### Phase Requ... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | 512fbfb9af534d21ff20d68316c78e29248676398289365a1267acb0a0d8c174 | 8 | 896 |
/gsd:verify-work`
### Wave 0 Gaps
- [ ] `tests/unit/test_embedders/__init__.py` — package init
- [ ] `tests/unit/test_embedders/test_gemini.py` — covers EMBED-01, EMBED-04
- [ ] `tests/unit/test_embedders/test_batch.py` — covers EMBED-02, EMBED-03
- [ ] `tests/unit/test_storage/__init__.py` — package init
- [ ] `test... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-RESEARCH.md | Markdown | afa4b71ad171cb7a47d62a1cd2cd26af3f3a1da2ddc8b4ce4c6a99ef60afc2d8 | 9 | 766 |
---
phase: 5
slug: embedding-storage
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-19
---
# Phase 5 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | p... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-VALIDATION.md | Markdown | 062fc0f8c78f866dda43fac647c044165eefc73914a1a91501c02366ee534a5c | 0 | 896 |
NEO-03 | unit | `uv run pytest tests/unit/test_storage/test_neo4j.py::test_node_types -x` | ❌ W0 | ⬜ pending |
| 05-03-04 | 03 | 1 | NEO-04 | unit | `uv run pytest tests/unit/test_storage/test_neo4j.py::test_edge_types -x` | ❌ W0 | ⬜ pending |
| 05-03-05 | 03 | 1 | NEO-05 | unit | `uv run pytest tests/unit/test_storage... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-VALIDATION.md | Markdown | b3ebced7d697a7712346b7433ab6ed445b4d1f481128877dc8905dac73033159 | 1 | 556 |
---
phase: 05-embedding-storage
verified: 2026-03-20T00:00:00Z
status: passed
score: 19/19 must-haves verified
re_verification: false
---
# Phase 5: Embedding Storage Verification Report
**Phase Goal:** Connect Gemini embedding API, build Qdrant and Neo4j storage clients with batch operations, and verify dimension co... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-VERIFICATION.md | Markdown | f21d8849ff0edba056e5dde7437000c32554862f34c392a0eb765328d6de7973 | 0 | 896 |
58-167) |
| 13 | All required graph relationships are created | VERIFIED | FROM_SOURCE, FROM_INSTITUTE, TAGGED_WITH, IN_DOMAIN, SIMILAR_TO, STRUCTURALLY_LINKED, AUTHORED_BY, NEXT_CHUNK — all implemented (neo4j.py:169-279) |
| 14 | Batch author-link creation supports high-volume AUTHORED_BY ingestion | VERIFIED | `creat... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-VERIFICATION.md | Markdown | fcd2c403299758105507f451351038ad900183b9a49fedcab8c8e64ce4568f57 | 1 | 896 |
write, rerun skip |
---
### Key Link Verification
| From | To | Via | Status | Details |
|------|----|-----|--------|---------|
| `gemini.py` | `google.genai` | `asyncio.to_thread` wrapping all sync SDK calls | WIRED | `asyncio.to_thread` found at lines 57, 81, 157, 176, 188, 207, 218, 230, 235, 250, 262, 279, 292, ... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-VERIFICATION.md | Markdown | d8a675d0787296874164b05547e6b2059de38706ef2c39899a6dc3841dd2d4f2 | 2 | 896 |
FieldCondition` filter construction at qdrant.py:157-191 |
| NEO-01 | 05-03 | Schema created with uniqueness constraints on chunk_id, source_id, institute_id, topic name | SATISFIED | 4 `CREATE CONSTRAINT ... IF NOT EXISTS` in `SCHEMA_QUERIES` (neo4j.py:17-22) |
| NEO-02 | 05-03 | Indexes created on modality, year, lan... | jku-encyclopedia | .planning/milestones/v1.0-phases/05-embedding-storage/05-VERIFICATION.md | Markdown | 0d88a77e95bbc6c15fc831cb92a9a8e71b7be956ab358d78fb79c0024aefcb5b | 3 | 770 |
---
phase: 06-graph-linking-orchestrator
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- src/jku_kb/graph/similarity.py
- src/jku_kb/storage/qdrant.py
- tests/unit/test_graph/__init__.py
- tests/unit/test_graph/test_similarity.py
autonomous: true
requirements: [LINK-01, LINK-02]
must_haves:
t... | jku-encyclopedia | .planning/milestones/v1.0-phases/06-graph-linking-orchestrator/06-01-PLAN.md | Markdown | d2bab1deb9188ec0dc2bee8254296fcb20d5ca01e02cd4092c48d2c6af1ce8a8 | 0 | 896 |
/jku_kb/storage/qdrant.py, tests/unit/test_graph/__init__.py, tests/unit/test_graph/test_similarity.py</files>
<read_first>
- src/jku_kb/storage/qdrant.py
- src/jku_kb/models.py
- tests/unit/test_models.py (for test pattern reference)
</read_first>
<behavior>
- Test 1: search_similar_with_modality... | jku-encyclopedia | .planning/milestones/v1.0-phases/06-graph-linking-orchestrator/06-01-PLAN.md | Markdown | 27e20bc0972b45bff53d479e7d67aecaf20d706874096f5d9955f8df610ab9ad | 1 | 896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.