feat(indexing): re-chunk tabular documents indexed by the old chunker (#16153) to release v4.8
Cherry-pick of #16153 to release v4.8 — the migration that re-chunks tabular documents already indexed by the old chunker.
Upstream commit: e6772d6f417e4289b3e5cd9f0c9c19abdd0a7ece
Conflict resolution — mostly neighbouring main-only entries this branch does not have:
app_base.py,constants.py,beat_schedule.py: kept this branch's entries and added only thetabular_rechunkones. Upstream'scc_pair_ids_backfilltask, KV key and lock are not on this branch and were not carried over.- env templates and
values.yaml: took theTABULAR_RECHUNK_ENABLEDentries, dropped theSKIP_SPREADSHEET_CONTENTones (not a setting on this branch). Chart.yaml: bumped this branch's version 0.8.28 → 0.8.29 and replaced the change list, per the convention on this branch.db/document.py: kept both sides of the import block (KGEntity/KGRelationshipplus the newFileRecord), and addedtrueto the SQLAlchemy imports —get_oversized_tabular_documentsjoins with it, and nothing on this branch imported it yet. The cherry-pick also pulled inPortedScopeandsample_ported_document_idsas context; those belong to #14463, which is not on this branch, so they were removed.
Adapted to this branch's document index, which still has both Vespa and OpenSearch:
run_tabular_rechunk.pyimportsDocumentSectionRequestfrominterfaces_new(upstream'sinterfacesis the post-#15336 name).- It resolves the index with
get_default_document_index(...)instead ofbuild_opensearch_document_index(...), typedDocumentIndex. Hardcoding OpenSearch would read chunk heads from an index a Vespa-serving deployment never populates, and every document would be skipped as "not re-chunkable".id_based_retrievalhas the same signature on both backends.test_run_tabular_rechunk.pypatches the new name. tabular_rechunk/tasks.py: dropped theSKIP_SPREADSHEET_CONTENTgate from_blocked_reason, since that setting does not exist here. The other gates (disabled vector DB, reindex in flight, port backfilling) are unchanged.
Verified: tests/unit/onyx/background and tests/unit/onyx/indexing pass (303 passed, 6 skipped); ruff check clean on every file this touches. test_oversized_tabular_scan.py came across unchanged and was not run here (it needs Postgres).
Stacked backport, merge last. Order: #16296 → #16298 → #16308 → #16309 → this PR.
Summary by cubic
Backports #16153, the one-time migration that re-chunks tabular documents indexed by the old chunker, to v4.8. With TABULAR_RECHUNK_ENABLED set, a beat task re-chunks oversized tabular documents in place from the stored workbook, without re-crawling the source; a KV record stores the cursor and completion state, so it resumes across ticks and never re-runs once finished.
Backport adaptations
- Left out upstream content not on this branch: the
cc_pair_ids_backfilltask, KV key, lock, and thePortedScopepieces from #14463. - The run imports
DocumentSectionRequestfrominterfaces_new(upstream'sinterfacesis the post-#15336 name), and resolves the index withget_default_document_index(...)typedDocumentIndexinstead ofbuild_opensearch_document_index(...): this branch serves both Vespa and OpenSearch, and hardcoding OpenSearch would skip every document under a Vespa-serving deployment. - The
SKIP_SPREADSHEET_CONTENTgate was dropped from_blocked_reasonbecause that setting does not exist here; the remaining gates (disabled vector DB, reindex in flight, port backfilling) are unchanged. db/document.pykeeps both import blocks and addstrueto the SQLAlchemy imports;miscellaneous_utils.pygainsexperts_from_stores_representationsfor the owner round-trip.
Verified: tests/unit/onyx/background and tests/unit/onyx/indexing pass (303 passed, 6 skipped), and ruff check is clean on every touched file. test_oversized_tabular_scan.py needs Postgres and was not run.
- [Optional] Override Linear Check