feat(ibis_yaml): serialize TeeNode and its WriteThrough writer#2152
feat(ibis_yaml): serialize TeeNode and its WriteThrough writer#2152mesejo wants to merge 3 commits into
Conversation
roborev: FailReview findingsReview FindingsSeverity: Medium Severity: Low Severity: Low SummaryAdds YAML serialization/deserialization for Review type: default | Agent: claude-code | Job: 786 |
Add translate_to_yaml/from_yaml handlers for TeeNode, round-tripping parent, drain, and the writer. All four WriteThrough types are covered: ParquetWriteThrough (path/mode), Backend/ThreadedBackendWriteThrough (con as profile hash, table_name, mode), and WritePrimaryWriteThrough (recurses into inner). Identity-neutral transport tuning (kwargs/maxsize) is omitted so expr.yaml stays byte-stable across rebuilds. Backend-bound writers hold a live connection, so wire it into profile machinery: WriteThrough gains iter_cons()/replace_cons(), TeeNode joins find_all_sources (via _node_cons), and replace_sources rebuilds the writer during profile canonicalization. This lets a backend writer's con be discovered, dehydrated to profiles.yaml, and rehydrated on load. Also strip TeeNode via the existing _remove_tee_nodes before to_sql: a TeeNode is a transparent pass-through with no SQL compiler visitor and, unlike RemoteTable, was not elided, so build_expr crashed generating SQL metadata. This mirrors the .sql() view path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
349853a to
3592da8
Compare
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #2152 +/- ##
==========================================
+ Coverage 82.27% 82.42% +0.15%
==========================================
Files 157 157
Lines 19770 19834 +64
==========================================
+ Hits 16265 16349 +84
+ Misses 3505 3485 -20
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
roborev: FailReview findingsReview FindingsSeverity: Low Severity: Low Severity: Low SummaryAdds YAML serialization round-trip support for Review type: default | Agent: claude-code | Job: 823 |
Assert translate_writer raises NotImplementedError for an unregistered WriteThrough subclass and load_writer_from_yaml raises ValueError for an unknown kind, so a new writer added without a rule fails in CI rather than at runtime. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
roborev: FailReview findingsReview FindingsSeverity: Low Severity: Low Severity: Low SummaryAdds YAML serialization/deserialization of Review type: default | Agent: claude-code | Job: 826 |
A ParquetWriteThrough is local-filesystem-only (tempfile + os.link + flock) and its path converter strips any URL scheme, so a tee-to-parquet build can never be relocated -- unlike a Read (content-hashable) or a ParquetCache (profile-anchored root). Warn unconditionally at serialization rather than pretend to detect it. Also add test_backend_tee_write_side_effect: the pass-through assertions can succeed while a broken serialized writer persists nothing, so assert the reloaded writer actually populates the sink after a round-trip + execute. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
roborev: FailReview findingsAll relevant non-TeeNode types inherit from Review FindingsSeverity: Low Severity: Low SummaryAdds YAML serialization and deserialization support for Review type: default | Agent: claude-code | Job: 828 |
Summary
Adds ibis-yaml serialization for
TeeNode(the transparent pass-through behind.tee(), ADR-0014), which previously had notranslate_to_yaml/from_yamlrule.parent,drain, and thewriter. All fourWriteThroughtypes covered:ParquetWriteThrough→path,mode(filesystem, no connection)Backend/ThreadedBackendWriteThrough→ connection as profile hash,table_name,modeWritePrimaryWriteThrough→ recurses intoinnerkwargs/maxsize) is omitted soexpr.yamlstays byte-stable across rebuilds.WriteThroughgainsiter_cons()/replace_cons(),TeeNodejoinsfind_all_sources(via_node_cons), andreplace_sourcesrebuilds the writer during profile canonicalization. The writer's connection is now discovered, dehydrated toprofiles.yaml, and rehydrated on load.to_sqlnow stripsTeeNodevia the existing_remove_tee_nodesbefore compiling.TeeNodeis a bareops.Relationwith no SQL compiler visitor and, unlikeRemoteTable, was not elided — sobuild_exprcrashed while generating SQL metadata. This mirrors the.sql()view path.Testing
New
python/xorq/ibis_yaml/tests/test_tee.py(6 tests): parquet / backend / threaded / write-primary writers, mode+drain preservation, byte-stable round-trip, and fullbuild_expr/load_expr. All pass.Regression:
test_write_through,test_letsql_ops,test_transform_scope,test_compiler,test_basic,test_sqlall green (only pre-existing postgres tests fail locally — no DB / docker daemon down).🤖 Generated with Claude Code