Fix SynapticIndexing when index_var=="0" #1870
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 200 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.317
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1870"
general
weight: 0.35
mstimberg
Why
Reading a synaptic variable linked to a variable from a length-1 source group raises an
IndexError:Differential equations can't be declared
(shared)directly, so a length-1 source group is the only way to get a broadcast value out of one.linked_var()picks up on this (thanks #1584) and sets the linked variable's index to"0"(Group._linked_var_automatic_index), butSynapticIndexing.__call__didn't handle that case and fell through to indexing the length-1 value array with the full array of synaptic indices.test_linked_variable_scalar(test_neurongroup.py) already provesGrouphandles this correctly, including direct indexing (G2.x[:]). The equivalentSynapsestest,test_linked_to_shared_variables, covers the same setup but only reads the linked variable back through aStateMonitor.Fix
SynapticIndexing.__call__now special-casesindex_var == "0", returning zeros to index the length-1 source array with, consistent with how"0"is already handled elsewhere (e.g.group.py).Testing
Added a single direct-indexing assertion on
test_linked_to_shared_variables, which fails with the originalIndexErroron master and passes with the fix. It now also asserts thatlinked_var()'s guess actually resolves toindex_var == "0".