fix(core): DSRunner memory_efficient output/monitors; eager check bound validation#851
Conversation
….is_float/is_integer bounds - DSRunner(memory_efficient=True) returned None instead of model outputs (list.append inside tree_map); now accumulates and stacks per-step outputs along a leading time axis (Critical) - memory_efficient monitors came out time-major vs the standard path's batch-major for BatchingMode; moveaxis to match (High) - check.is_float/is_integer min_bound/max_bound never raised eagerly (pure_callback swallowed the raise for concrete predicates); add a concrete-predicate fast path that raises directly, keeping the deferred cond/callback path under tracing (High) Findings recorded in docs/issues-found-20260619-toplevel-glue.md
Reviewer's GuideFixes DSRunner’s memory_efficient output stacking and monitor axis layout, and restores eager bound-checking semantics in check utilities while adding regression tests and documenting audit findings. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="docs/issues-found-20260619-toplevel-glue.md" line_range="9-10" />
<code_context>
+
+Branch: fix/audit-20260619-toplevel-glue
+
+Counts: Critical 1, High 2, Medium 1, Low 4. Fixed 4 (C1, H1, H2 + the M2 test-fragility);
+recorded-only 4 (M2 source-level, L1, L2, L3, L4).
+
+| ID | Severity | File | Status |
</code_context>
<issue_to_address>
**issue (typo):** Recorded-only count does not match the listed items.
The text says "recorded-only 4" but lists five items: "M2 source-level, L1, L2, L3, L4." Please update either the count or the list so they match.
```suggestion
Counts: Critical 1, High 2, Medium 1, Low 4. Fixed 4 (C1, H1, H2 + the M2 test-fragility);
recorded-only 5 (M2 source-level, L1, L2, L3, L4).
```
</issue_to_address>
### Comment 2
<location path="docs/issues-found-20260619-toplevel-glue.md" line_range="117-119" />
<code_context>
+ *concrete* (eager) predicate, `jax.pure_callback` only raises when the staged computation is
+ executed — under an eager `cond` the callback's exception is never surfaced synchronously, so
+ the function returns normally. (`true_err_fun(arg, transforms)` also had the wrong arity for a
+ no-operand callback.) Result: every eager out-of-bound check is a no-op.
+- Why it's a bug: parameter validation across the codebase silently accepts invalid values, e.g.
+ `bp.dnn.Dropout(prob=2.0)` / `prob=-1`, negative frequencies, non-positive integer sizes,
</code_context>
<issue_to_address>
**nitpick (typo):** Consider changing 'out-of-bound' to 'out-of-bounds' for standard phrasing.
In the final sentence of this bullet, update the phrase so it uses the standard 'out-of-bounds' wording.
```suggestion
executed — under an eager `cond` the callback's exception is never surfaced synchronously, so
the function returns normally. (`true_err_fun(arg, transforms)` also had the wrong arity for a
no-operand callback.) Result: every eager out-of-bounds check is a no-op.
```
</issue_to_address>
### Comment 3
<location path="docs/issues-found-20260619-toplevel-glue.md" line_range="239" />
<code_context>
+ `math/object_transform/variables.py` (out of scope); **already fixed** there
+ (`size_without_batch` now returns `(10,)` for a `(4,10)` batched Variable). Verified.
+
+left_unfixed_chm: none in scope. H-45's fix lives outside this scope (variables.py) and is
+already applied upstream.
</code_context>
<issue_to_address>
**suggestion (typo):** Possible typo in 'left_unfixed_chm'.
The name 'left_unfixed_chm' is unclear and looks like a typo or unclear abbreviation. Please rename it to something more descriptive and correctly spelled (e.g., `left_unfixed_issues`).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| Counts: Critical 1, High 2, Medium 1, Low 4. Fixed 4 (C1, H1, H2 + the M2 test-fragility); | ||
| recorded-only 4 (M2 source-level, L1, L2, L3, L4). |
There was a problem hiding this comment.
issue (typo): Recorded-only count does not match the listed items.
The text says "recorded-only 4" but lists five items: "M2 source-level, L1, L2, L3, L4." Please update either the count or the list so they match.
| Counts: Critical 1, High 2, Medium 1, Low 4. Fixed 4 (C1, H1, H2 + the M2 test-fragility); | |
| recorded-only 4 (M2 source-level, L1, L2, L3, L4). | |
| Counts: Critical 1, High 2, Medium 1, Low 4. Fixed 4 (C1, H1, H2 + the M2 test-fragility); | |
| recorded-only 5 (M2 source-level, L1, L2, L3, L4). |
| executed — under an eager `cond` the callback's exception is never surfaced synchronously, so | ||
| the function returns normally. (`true_err_fun(arg, transforms)` also had the wrong arity for a | ||
| no-operand callback.) Result: every eager out-of-bound check is a no-op. |
There was a problem hiding this comment.
nitpick (typo): Consider changing 'out-of-bound' to 'out-of-bounds' for standard phrasing.
In the final sentence of this bullet, update the phrase so it uses the standard 'out-of-bounds' wording.
| executed — under an eager `cond` the callback's exception is never surfaced synchronously, so | |
| the function returns normally. (`true_err_fun(arg, transforms)` also had the wrong arity for a | |
| no-operand callback.) Result: every eager out-of-bound check is a no-op. | |
| executed — under an eager `cond` the callback's exception is never surfaced synchronously, so | |
| the function returns normally. (`true_err_fun(arg, transforms)` also had the wrong arity for a | |
| no-operand callback.) Result: every eager out-of-bounds check is a no-op. |
| `math/object_transform/variables.py` (out of scope); **already fixed** there | ||
| (`size_without_batch` now returns `(10,)` for a `(4,10)` batched Variable). Verified. | ||
|
|
||
| left_unfixed_chm: none in scope. H-45's fix lives outside this scope (variables.py) and is |
There was a problem hiding this comment.
suggestion (typo): Possible typo in 'left_unfixed_chm'.
The name 'left_unfixed_chm' is unclear and looks like a typo or unclear abbreviation. Please rename it to something more descriptive and correctly spelled (e.g., left_unfixed_issues).
Fresh review of top-level glue (
dynsys,runners,delay,mixin,transform,check, shims).DSRunner(memory_efficient=True)returnedNoneinstead of model outputs (list.appendinsidetree_map); now accumulates and stacks per-step outputs on a leading time axis.memory_efficientmonitors came out time-major vs the standard path's batch-major inBatchingMode; now axis-matched.check.is_float/is_integerbound checks never raised eagerly (apure_callbackswallowed the raise for concrete predicates); added a concrete fast-path that raises directly, preserving the deferred path under tracing.check.is_float/is_integerwith bounds now actually reject invalid input across all call sites (valid defaults verified to still construct). In-scope: 441 passed. Findings:docs/issues-found-20260619-toplevel-glue.md.Summary by Sourcery
Fix DSRunner memory-efficient output and monitor layout while tightening eager bound-checking behavior.
Bug Fixes:
Documentation:
Tests: