feat(python-harness): auto-track dict/set and nested JSON args#130
Open
mkayander wants to merge 6 commits into
Open
feat(python-harness): auto-track dict/set and nested JSON args#130mkayander wants to merge 6 commits into
mkayander wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add TrackedDict and TrackedSet with callstack frames (map/set arg types)
- Extend AST transformer for {}, set literals, dict/set comprehensions
- Deep-wrap array/matrix/map/object/set arguments from JSON for nested tracking
- Register collection_tracker in Pyodide harness; add unit tests
Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
…te args - TrackedSet.add: use super().__contains__ for membership so no readArrayItem frame when rejecting duplicates - _convert_arg_to_python: require each arg to be a dict (explicit TypeError) - Remove unused os import from exec.py - Add regression tests for duplicate add and malformed args list Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
…PIs, docs - Add TrackedFrozenSet and AST rewrite for frozenset(...) calls - Deep-wrap graph args like arrays; TypeError if value is not a JSON list - TrackedDict: setdefault, pop, popitem, clear, update with frame semantics - TrackedSet: pop, clear; discard/remove avoid spurious read via super - Document harness contracts in docs/PYTHON_PYODIDE.md - Extend test_exec for frozenset, graph, dict.clear Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
…exec args - Restore TrackedDict class boundary broken during rebase; unify frames on self._add_frame; add _emit_collection_frame for TrackedFrozenSet.__new__ - exec: null array/matrix -> TrackedList; set/map require list/dict; remove silent wrong-type pass-through for map/object Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
1f059d2 to
a9fa558
Compare
Wire safe_exec output through compose_run_output so the UI shows level-order trees and linked-list chains instead of default object reprs. Add __repr__/ __str__ on instrumented and plain tree/list nodes; dedupe display logic via tree_utils helpers. Register solution_display.py for Pyodide and add tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tree_utils.build_tree, which had been merged accidentally into theTreeNodeclass (syntax/import was fragile).solution_display.pywithcompose_run_outputandformat_python_return_valuesosafe_execoutput includes a formatted return value (trees, lists, tracked collections, primitives) instead of only capturedprinttext.compose_run_output: when the solution returnsNone, only stdout is shown (no trailingNone), so print-only runs stay unchanged.tree_utils:binary_tree_to_display_string/linked_list_to_display_stringstay the single source of truth;TreeNode,InstrumentedTreeNode,ListNode, andInstrumentedListNodeimplement__repr__/__str__using those helpers (reads go through__dict__where needed to avoid extra blink frames).val/nextnodes withoutleftwhen the next pointer is not aListNodesubclass.solution_display.pyinHARNESS_FILES.test_execcovers returned tracked tree/list output;test_tree_utilscovers instrumented tree repr/str.Verification
pnpm test(Vitest + Python harness unittest)pnpm lint(warnings only, no new errors)