[core] Improve traversal context in inspect_serializability#63258
Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances the serialization inspection utility by replacing the single 'name' attribute with a full traversal 'path' in FailureTuple, allowing for better debugging of serialization failures. It includes updates to the inspection functions to propagate this path and adds corresponding test cases. Feedback highlights a critical issue in the path initialization logic that leads to name duplication and a potential TypeError when the object name is None.
- Track traversal ancestry during recursive serialization inspection - Preserve existing FailureTuple semantics and set deduplication - Add path context to failure output for better localization - Update docstring and add regression tests for path propagation This improves debugging ergonomics for nested serialization failures by showing complete traversal paths (e.g., train -> model -> lock) without changing serialization behavior or traversal algorithms. Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
6420425 to
5d6fb95
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 826ac2f81ce1d5d483c1063142486757b41aaab6. Configure here.
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
826ac2f to
15613dc
Compare
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
|
@edoakes |

Summary
Improve serialization debugging by propagating traversal ancestry/path context during recursive serialization inspection.
Problem
Current diagnostics only preserve immediate parent context, making localization difficult for nested object graphs and closures.
Solution
Track traversal paths during recursive inspection while preserving all existing behavior.
Example Improvement
Before:
FailTuple(lock [obj=<lock>, parent=<Pipeline>])After:
FailTuple(lock [path=train -> model -> pipeline -> executor -> lock, obj=<lock>, parent=<Pipeline>])Non-goals
Tests
Added regression coverage for nested objects, closures, and path propagation.