Skip to content

Commit ded3168

Browse files
committed
docs: Correct the empty-let purity test to a dependency-boundary claim
The section comment and docstring said reaching apply_let_bindings with an empty let list was "the session path for every script, EXPR or not" and a "production-reachable purity claim". Neither holds: every call site guards on truthiness first (_session.py, _runner_base._materialize_files, and both callers of _apply_let_bindings_or_fail), so let_bindings=[] is a test-only shape. The docstring's clause about the binding-length guard was also vacuous, since that loop body never runs on an empty list. Reword to what the test does pin: openjd-model's evaluate_let_bindings staying pure on an empty list, as a dependency-boundary control. Point at the two tests that already cover production purity for a non-EXPR script. Text only, no behaviour change. Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
1 parent b93b338 commit ded3168

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

‎test/openjd/test_import_purity.py‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ def test_path_mapping_rules_do_load_the_extension(self, tmp_path: Path) -> None:
410410

411411

412412
# ---------------------------------------------------------------------------
413-
# `apply_let_bindings` is on the session path for every script, EXPR or
414-
# not, so reaching it must not by itself load the native extension. Actually
415-
# *evaluating* a binding must, because the expression engine is the extension --
416-
# the two cases are split below so each says which it is.
413+
# `apply_let_bindings` delegates to openjd-model's `evaluate_let_bindings`.
414+
# The two probes below pin that boundary from both sides: an empty list must
415+
# not load the native extension, and a real binding must, because the
416+
# expression engine *is* the extension.
417417
# ---------------------------------------------------------------------------
418418

419419

@@ -440,12 +440,20 @@ def test_path_mapping_rules_do_load_the_extension(self, tmp_path: Path) -> None:
440440

441441

442442
def test_applying_an_empty_let_list_stays_pure(tmp_path: Path) -> None:
443-
"""The no-``let`` script, which is every non-EXPR script: reaching
444-
``apply_let_bindings`` must not load the native extension.
445-
446-
This is the production-reachable purity claim on this path. Nothing here
447-
should import openjd.expr -- not the module-level imports in
448-
``_runner_base``, and not the binding-length guard ahead of the evaluator.
443+
"""Dependency-boundary control: openjd-model's ``evaluate_let_bindings``
444+
must stay pure when handed an empty list.
445+
446+
``let_bindings=[]`` is a test-only shape rather than a production path --
447+
every call site guards on truthiness first (``_session.py``,
448+
``_runner_base._materialize_files``, and both callers of
449+
``_apply_let_bindings_or_fail``) -- so what this pins is the boundary, not
450+
session behaviour. Production purity for a non-EXPR script is covered by
451+
``test_running_a_non_expr_task_stays_pure_end_to_end`` and
452+
``test_importing_sessions_does_not_load_native_extension``.
453+
454+
Nothing on this call path should import openjd.expr: not the module-level
455+
imports in ``_runner_base``, and not openjd-model's evaluator entry point
456+
ahead of any actual evaluation.
449457
"""
450458
# WHEN
451459
loaded = _run_probe(tmp_path, _NO_BINDINGS_PROBE)

0 commit comments

Comments
 (0)