feat(python-harness): auto-track dict/set and nested JSON args#130
Draft
mkayander wants to merge 4 commits into
Draft
feat(python-harness): auto-track dict/set and nested JSON args#130mkayander wants to merge 4 commits into
mkayander wants to merge 4 commits into
Conversation
- 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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resolve test_exec conflict (keep list iteration test + collection tests). Review: validate array/matrix/set/map JSON shapes with TypeError; empty array arg uses TrackedList; map/object reject non-dict; DRY collection frame helper; add regression tests for bad arg types and null array. 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>
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
Python Pyodide harness: tracked collections (list/dict/set/frozenset call), deep-wrapped JSON case args including graph, stricter type errors, expanded dict/set APIs, and docs/PYTHON_PYODIDE.md contract.
Highlights
TrackedList,TrackedDict,TrackedSet, comprehensions;frozenset(expr)→TrackedFrozenSet(single positional, no keywords).array/matrix/set/map/objectvalidation + deep wrap;graphnow deep-wrapped as nested lists (edge-list JSON);nullarray → emptyTrackedList.TrackedDict—setdefault,pop,popitem,clear,update;TrackedSet—pop,clear;discard/removeusesuper().__contains__where needed;TrackedFrozenSetfor immutable membership reads.docs/PYTHON_PYODIDE.md— new “Collection and graph tracking” section + file table row forcollection_tracker.py.Tests
src/packages/dstruct-runner/python/test_exec.py— includes frozenset, graph wrap, graph type error, dict.clear, merged main list-iteration test, etc.Still not auto-tracked
defaultdict/Counter/ arbitrary dict subclasses without literal rewrite (documented).