rag_server: read_publication finds the shipped originals, falls back to honest chunk reassembly; get_dataset_code resolves notebooks under the published layout (WP3)
Fixes from running this server against the published dataset copy, cleared with Dmitrii
in July, then hardened by an adversarial review round (codex + an independent reviewer):
get_dataset_code: md_path in the registry names notebook_harvest/parsed/... and
eqc_qa/notebooks_code/..., neither of which ships; both families are published under
originals_md/notebooks/. With the fallback, 186 of 186 listed notebook ids resolve.
The family md_path implies is searched first, so a basename repeated across families
would resolve to its own copy.read_publication: papers.jsonl records absolute paths from the build machine, so on
any other deployment 0 of 12,411 md_paths resolve — while publications_md.tar.gz in
this same dataset ships the verbatim originals for 11,209 of them. The same
registry-vs-published-layout mismatch, the same fix: resolve
/originals_md/publications_md/parsed_md//vlm/.md (or
$PUBS_MD_ROOT) before anything else.Only when no original exists anywhere (1,210 of 12,411) is the text reassembled from
the publications collection's chunks — and the reply is honest about what that is:
full_text=false, text_fidelity="reconstructed-lossy", every 2500-char loader cap
marked in-line in the text (measured: 12.8% of corpus characters fall past that cap),
registry metadata (authors/abstract/linked_products) merged back in, and a store
failure reported as an error instead of masquerading as "not parsed yet". Ordering
prefers an explicit chunk_index payload field (the newer content-hash chunkers) over
the numeric chunk_id tail (the currently served corpus); chunks with neither sort
last and are counted inorder_uncertain. The chunk cap truncates a sorted TAIL,
never holes in the middle; per-paper scroll results are cached so pagination does not
re-move the paper once per page.