Fix all 9 spec test failures: Env scope chain, IO detection, offline mutation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 4m11s

- env.py: Add MergedEnv with dual-parent lookup (primary for set!,
  secondary for reads), add dict-compat methods to Env
- platform_py.py: make_lambda stores env reference (no copy), env_merge
  uses MergedEnv for proper set! propagation, ancestor detection prevents
  unbounded chains in TCO recursion, sf_set_bang walks scope chain
- types.py: Component/Island io_refs defaults to None (not computed)
  instead of empty set, so component-pure? falls through to scan
- run.py: Test env uses Env class, mock execute-action calls SX lambdas
  via _call_sx instead of direct Python call

Spec tests: 320/320 (was 311/320)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 09:42:04 +00:00
parent d8cddbd971
commit 4c4806c8dd
5 changed files with 180 additions and 27 deletions

View File

@@ -281,7 +281,9 @@ def eval_file(filename, env):
# --- Build env ---
env = {
from shared.sx.env import Env as _Env
env = _Env({
"try-call": try_call,
"report-pass": report_pass,
"report-fail": report_fail,
@@ -330,7 +332,7 @@ env = {
"component-body": lambda c: getattr(c, 'body', NIL),
"component-closure": lambda c: dict(getattr(c, 'closure', {})),
"component-has-children?": lambda c: getattr(c, 'has_children', False),
}
})
def _call_sx(fn, args, caller_env):
@@ -496,7 +498,7 @@ def _load_orchestration(env):
def _mock_execute_action(action, payload, on_success, on_error):
"""Mock: immediately calls on_success with payload as 'server truth'."""
on_success(payload)
_call_sx(on_success, [payload], env)
return NIL
def _dict_delete(d, k):