feat(connectors): add the file connector with fail-closed path boundary

TDD step 3: read_csv executes a file-source extraction — boundary-checked
path resolution via commonpath on canonical paths (rejects .. traversal,
absolute paths, symlink escapes, and prefix-collision siblings), utf-8-sig
decoding, streaming max_rows cap as a typed error (never silent
truncation), ragged-row rejection, and verbatim cells (escaping stays in
the §5 renderers). New SourceError in the typed hierarchy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QeqhJpYQyghASjiJo5EhGg
This commit is contained in:
Kjell Tore Guttormsen 2026-07-16 19:55:08 +02:00
commit af1849f0b3
3 changed files with 230 additions and 0 deletions

View file

@ -13,3 +13,12 @@ class ManifestError(IngestError):
class RenderError(IngestError):
"""A value cannot be rendered under the §5 body rules (never silent coercion)."""
class SourceError(IngestError):
"""An extraction failed against its source (ingest-spec §4, §8).
Covers fail-closed path-boundary violations, missing/malformed source
content, and max_rows cap violations always typed, never a leaked
OSError and never silent truncation.
"""