Skip to content

feat: ingest CSV and TSV as bounded documents#2125

Open
skilfoy wants to merge 1 commit into
Graphify-Labs:v8from
skilfoy:feat/csv-tsv-support
Open

feat: ingest CSV and TSV as bounded documents#2125
skilfoy wants to merge 1 commit into
Graphify-Labs:v8from
skilfoy:feat/csv-tsv-support

Conversation

@skilfoy

@skilfoy skilfoy commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • add built-in CSV/TSV document ingestion with no new runtime dependency
  • parse untrusted delimited data with strict, pre-validated resource bounds
  • render contextualized Markdown sidecars with shape and truncation metadata
  • make sidecar freshness content/version-aware and add CSV/TSV watch support

Closes #2119

Why

Research corpora commonly include experiment exports, survey tables, benchmark results, inventories, and market datasets in CSV/TSV form. Graphify previously left those files unclassified, so they never reached semantic extraction.

This implementation converts them into the same Markdown document path used by the existing extraction pipeline while preserving table context and keeping formulas inert.

Safety and behavior

The converter:

  • supports UTF-8 and UTF-8-BOM;
  • uses the standard-library csv parser with strict malformed-quote handling;
  • validates every logical record before csv.reader materializes it;
  • rejects logical records above 2 MiB or 1,000 parser columns;
  • caps accepted input at 50 MiB, output at 1.1 million characters, rendered data at 1,000 rows × 100 columns, and fields at 10,000 characters;
  • reports row/column/field/output truncation in sidecar metadata;
  • escapes active Markdown/HTML constructs while preserving formulas and values as text;
  • hashes source content plus a converter version in the sidecar marker, so same/older-mtime changes refresh correctly and unchanged inputs do not churn;
  • keeps the Office converter unchanged to avoid coupling this feature to optional dependencies or ongoing Office-format work.

Tests

  • pytest tests/test_delimited.py tests/test_detect.py tests/test_office_incremental.py tests/test_office_limits.py tests/test_watch.py -q
    • 312 passed
  • pytest -q --ignore=tests/test_falkordb_integration.py
    • 3,628 passed, 1 skipped
  • full pytest -q
    • all non-FalkorDB tests passed; the two live FalkorDB tests failed because a regular Redis instance occupied localhost:6379 and returned unknown command GRAPH.QUERY
  • Python 3.10 focused matrix
    • 20 passed
  • pyright graphify/delimited.py
    • 0 errors, 0 warnings
  • Ruff and git diff --check
    • passed
  • python -m build
    • sdist and wheel built successfully; graphify/delimited.py is packaged

An end-to-end temporary-corpus probe also verified detection, Markdown sidecar creation, untrusted-source prompt wrapping, formula preservation, quoted multiline values, unchanged-sidecar reuse, and content refresh with a preserved source mtime.

Copilot AI review requested due to automatic review settings July 23, 2026 04:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support bounded CSV/TSV document ingestion

2 participants