ek9_query_purity_impact
Answers first: status, change, availableChanges, verdict (ready / would-fail / cascade-too-large / blocked-refuse-to-root), callerNames, calleeNames, then anchor, contract, afferent, efferent axes - the same closure ek9_fix_purity_contract applies.
When to use it
'Who breaks if this stops being pure, or what must become pure if it does' is one call with symbol:'Type.method' on a callable flagged E08130/E05150/E05160.
When not to use it
- applying the purity fix, not previewing it (use
ek9_fix_purity_contract) - previewing a signature change (add/remove/reorder params, return type), not a purity change (use
ek9_query_signature_impact) - raw caller/callee chains without the purity verdict overlay (use
ek9_query_call_graph) - the list of purity errors first, to find a callable to anchor on (use
ek9_query_diagnostics)
Details
Returns a BlastRadius (BlastRadiusJson): anchor callable + three axes — 'contract' (the override group; root is the ONLY legal edit anchor), 'afferent' (transitive pure-caller closure that breaks if pure is removed), 'efferent' (non-pure-callee closure that must become pure if pure is added) — each node with a verdict (root / fixable / breaks) and file:line. Overall verdict (ready / would-fail / cascade-too-large / blocked-refuse-to-root) is computed by the SAME rule ek9_fix_purity_contract applies, so picture and fix agree. change: 'remove-pure' = which CALLERS break if this stops being pure (the afferent axis); 'add-pure' = which CALLEES must become pure (the efferent axis); E08130 offers both, E05150 only add-pure, E05160 only remove-pure. Works under compile errors via an on-demand call graph; FULL_RESOLUTION (or default ek9_compile) suffices.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
change | string: add-pure | remove-pure | 'remove-pure' = which CALLERS break if this stops being pure; 'add-pure' = which CALLEES must become pure. Omit to take the natural direction for the diagnosed code (E08130 offers both - see availableChanges). | |
file | string | The EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site. | |
line | integer | 1-based line where the purity error (E08130 / E05150 / E05160) fires - OMIT it and pass symbol:'Type.method' to let the tool find the flagged line. | |
symbol | string | The flagged method or function - 'Type.method' or a function name - no file or line needed; the tool finds its first purity error. |
It also takes the arguments every tool takes.
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it. 3 of the 5 recorded are shown.
E05150 contract axis
Request
{
"file" : "a.ek9",
"line" : 10
}
Response
{
"afferent" : [ ],
"anchor" : {
"detail" : "E05150",
"file" : "a.ek9",
"fullyQualifiedName" : "purity.probe.a::Derived.calc()",
"label" : "Derived.calc()",
"line" : 10,
"verdict" : "fixable"
},
"availableChanges" : [ "add-pure" ],
"calleeNames" : [ ],
"callerNames" : [ ],
"change" : "add-pure",
"changeKind" : "purity",
"contract" : [ {
"detail" : "contract root",
"file" : "a.ek9",
"fullyQualifiedName" : "purity.probe.a::Base.calc()",
"label" : "Base.calc()",
"line" : 6,
"verdict" : "root"
}, {
"detail" : "override — aligns to root",
...
Cut short here: 20 more lines. The whole recorded call.
E05160 contract axis
Request
{
"file" : "b.ek9",
"line" : 10
}
Response
{
"afferent" : [ ],
"anchor" : {
"detail" : "E05160",
"file" : "b.ek9",
"fullyQualifiedName" : "purity.probe.b::Derived2.calc()",
"label" : "Derived2.calc()",
"line" : 10,
"verdict" : "fixable"
},
"availableChanges" : [ "remove-pure" ],
"calleeNames" : [ ],
"callerNames" : [ ],
"change" : "remove-pure",
"changeKind" : "purity",
"contract" : [ {
"detail" : "contract root",
"file" : "b.ek9",
"fullyQualifiedName" : "purity.probe.b::Base2.calc()",
"label" : "Base2.calc()",
"line" : 6,
"verdict" : "root"
}, {
"detail" : "override — aligns to root",
...
Cut short here: 20 more lines. The whole recorded call.
E08130 add direction
Request
{
"change" : "add-pure",
"file" : "c.ek9",
"line" : 11
}
Response
{
"afferent" : [ ],
"anchor" : {
"detail" : "E08130",
"file" : "c.ek9",
"fullyQualifiedName" : "purity.probe.c::pureCaller",
"label" : "pureCaller()",
"line" : 9,
"verdict" : "root"
},
"availableChanges" : [ "remove-pure", "add-pure" ],
"calleeNames" : [ "sideEffect()" ],
"callerNames" : [ ],
"change" : "add-pure",
"changeKind" : "purity",
"contract" : [ {
"detail" : "contract root",
"file" : "c.ek9",
"fullyQualifiedName" : "purity.probe.c::pureCaller",
"label" : "pureCaller()",
"line" : 9,
"verdict" : "root"
} ],
"efferent" : [ {
...
Cut short here: 20 more lines. The whole recorded call.
See also
- Show me in the IDE: Show Blast Radius