Fix deep workflow graph composition - #331
Conversation
|
Validated against the diff at Posting the detailed check since I raised the alternative that this PR correctly rejected. The stack-depth objection was right, and this PR avoids the trapMy earlier suggestion on #328 — Storing children as So the protection is not removed, it is upgraded from incidental to intentional. The 128 limit was never a designed guard — it was a serde artifact that silently corrupted instead of erroring.
Worst case is ~257 shallow frames against PostgreSQL's default 2 MB Worth keeping from #328: one thing
match serde_json::from_str::<Durofut>(s) {
Ok(d) if VALID_NODE_TYPES.contains(&d.node_type.as_str()) => d,
_ => Durofut {
node_type: "SQL".to_string(),
query: Some(s.to_string()),
..Default::default()
},
}This PR removes the trigger (serde recursion) but not the class (silent corruption on an unparseable envelope). It also slightly widens that class: the new Credit where due: this PR already removes one of the sibling fallbacks I flagged — the PL/pgSQL Two review points
Test coverageMaterially stronger than #328: 129 levels via One gap: no deep-chain regression for Full CI green at |
PR #331 fixed deep graph composition (#327) structurally but left two silent-corruption arms flagged in review: - Durofut::ensure() swallowed any unparseable JSON envelope into a raw SQL node, including the new deserialize_raw_object rejection of non-object children. Fail loudly instead, keying off the parse error plus a generic-JSON node_type probe (robust to serialized field order) rather than a prefix sniff. - collect_nodes() in df.explain() panicked via .expect() on an undeserializable child; align it to pgrx::error! like insert_nodes() so it raises a clean PostgreSQL error. Add regression tests: loud failure on a corrupt envelope, envelope detection independent of field order, and a deep JOIN chain locking in the shared opaque-child path.
PR #331 fixed deep graph composition (#327) structurally but left two silent-corruption arms flagged in review: - Durofut::ensure() swallowed any unparseable JSON envelope into a raw SQL node, including the new deserialize_raw_object rejection of non-object children. Fail loudly instead, keying off the parse error plus a generic-JSON node_type probe (robust to serialized field order) rather than a prefix sniff. - collect_nodes() in df.explain() panicked via .expect() on an undeserializable child; align it to pgrx::error! like insert_nodes() so it raises a clean PostgreSQL error. Add regression tests: loud failure on a corrupt envelope, envelope detection independent of field order, and a deep JOIN chain locking in the shared opaque-child path.
|
Thanks for the detailed follow-through. The remaining silent-corruption items you flagged are addressed in a narrow follow-up: #328. Carried over from your review:
Deliberately left as-is:
Tests: loud-failure on a corrupt envelope via |
PR #331 fixed deep graph composition (#327) structurally but left two silent-corruption arms flagged in review: - Durofut::ensure() swallowed any unparseable JSON envelope into a raw SQL node, including the new deserialize_raw_object rejection of non-object children. Fail loudly instead, keying off the parse error plus a generic-JSON node_type probe (robust to serialized field order) rather than a prefix sniff. - collect_nodes() in df.explain() panicked via .expect() on an undeserializable child; align it to pgrx::error! like insert_nodes() so it raises a clean PostgreSQL error. Add regression tests: loud failure on a corrupt envelope, envelope detection independent of field order, and a deep JOIN chain locking in the shared opaque-child path. Co-authored-by: Pino de Candia <pinod@microsoft.com>
Summary
Durofutchildren as opaqueRawValueJSON objects so each graph level deserializes independentlydf.explain()traversaldf.ensure_durofut()and update the 0.2.6 upgrade pathSupersedes #328.
Fixes #327.
Validation
cargo build --features pg17cargo clippy --features pg17 -- -D warningscargo fmt -p pg_durable -- --check./scripts/test-unit.sh(263 passed, 16 ignored)./scripts/test-e2e-local.sh 09_graph_and_validation./scripts/test-upgrade.sh(66 passed)