Implements the cross-modality discipline that ticket #000015 spelled out. Until now only text + claim_lattice + memory carriers existed in code; the multimodal story was theoretical. code-py-ast@v1 algorithm: 1. Parse UTF-8 bytes via stdlib ast.parse. 2. Walk the AST; emit deterministic S-expression "(NodeType field1=val1 ...)" with sorted fields, lists as "[elem0 elem1 ...]", primitives via repr(). 3. Source positions (lineno/col_offset) skipped naturally — not in ast._fields. Equivalence classes preserved (verified by tests): - Whitespace, indentation, blank lines - Comments - String quote style ('x' vs "x") - Operator spacing (1+2 vs 1 + 2) - Trailing semicolons (x=1;y=2 vs x=1\ny=2) Equivalence classes kept distinct: - Identifier names (def foo vs def bar) - Operator types (Add vs Sub) - Argument order in calls (f(x,y) vs f(y,x)) Projective, not invertible — canonical bytes are S-expression text, NOT valid Python. Re-canonicalizing the canonical output is undefined; idempotency tests run on the original raw input only. Surface: - arborist/pi_star/code.py — full implementation, replaces stub - bench/batteries/base.py — PHASE_1_CARRIERS adds "code" - bench/batteries/b_5s.py — runner accepts both pi_star_ref (cross-modality canonical) and pi_star (Phase 1a legacy) keys; backward-compat shim - bench/fixtures/5s/syntax-code-v1.jsonl — 10 Python parse-pass fixtures - bench/fixtures/5s/semantics-code-v1.jsonl — 12 equivalence-class fixtures (whitespace/comments/quote-style/operator collapse; identifier/operator/argument-order remain distinct) - Makefile: bench-5s-code target - tests/test_pi_star.py: stubs parametrize drops code-py-ast (graduated); 11 new tests for code-py-ast@v1 covering equivalence classes, distinguishing classes, syntax-error rejection, non-bytes rejection, determinism, empty-source handling, equivalence_class_id format Three remaining stubs (logic-kernel, time-series-quantized, tabular-pinned) keep their NotImplementedError contract. Full suite: 1221 passed, 36 skipped. Cross-modality discipline now has actual code-level proof, not just schema metadata.
11 lines
2.2 KiB
JSON
11 lines
2.2 KiB
JSON
{"_meta":{"battery":"5s","sub_battery":"syntax","version":"v1","task_count":10,"notes":"First code-carrier fixtures. Each input is Python source; pi_star is code-py-ast@v1 (the graduated stub). Tests the cross-modality discipline end-to-end through the bench harness."}}
|
|
{"id":"5s-syn-code-001","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"x = 1","expected":"pass"}
|
|
{"id":"5s-syn-code-002","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"def foo(): pass","expected":"pass"}
|
|
{"id":"5s-syn-code-003","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"class Foo:\n def bar(self):\n return 42","expected":"pass"}
|
|
{"id":"5s-syn-code-004","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"y = a + b * c","expected":"pass"}
|
|
{"id":"5s-syn-code-005","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"for i in range(10):\n print(i)","expected":"pass"}
|
|
{"id":"5s-syn-code-006","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"import sys\nimport os","expected":"pass"}
|
|
{"id":"5s-syn-code-007","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"if x > 0:\n y = 1\nelse:\n y = -1","expected":"pass"}
|
|
{"id":"5s-syn-code-008","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"data = [1, 2, 3, 4, 5]","expected":"pass"}
|
|
{"id":"5s-syn-code-009","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"d = {'a': 1, 'b': 2}","expected":"pass"}
|
|
{"id":"5s-syn-code-010","battery":"5s","sub_battery":"syntax","version":"v1","carrier":"code","domain":"python_ast","pi_star_ref":"code-py-ast@v1","input":"","expected":"pass"}
|