1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//! The 42I25 write-classification family: the per-clause answer
//! ([`clause_is_write_by`]), its unbatched refinement
//! ([`clause_is_unbatched_write`]), and the walk-owned facts the
//! composition rule threads — [`WriteHistory`] (the chain's accumulated
//! fact) and [`ClausePosition`] (one clause's position and the history
//! reaching it). Split from the clause-validation walk so the family has
//! one home beside the classification it refines.
use ;
/// Whether `clause` writes — the write-classification family's per-clause
/// answer, as ONE fold under both policies (conservative and composition). `is_write_procedure` classifies `CALL` targets: the canonical
/// registry-backed predicate, injected by the facade — the procedure
/// registry lives in the executor, which the planner cannot depend on.
/// Every write gate (the `IN TRANSACTIONS` composition rule, the
/// subquery-expression rejection, the §4 namespace gate in
/// `namespaces.rs`) classifies procedures through this one predicate, so
/// no literal procedure name is hardcoded here.
///
/// The clause half is the published per-clause answer
/// ([`crate::clause_mutates_store`]); this function only adds the answers
/// that live below the clause itself — a `CALL { … }` body, a `WHEN`/`ELSE`
/// body, a writes-flagged procedure — which is what the composition rules
/// need. (A nested body is walked here rather than classified outright: a
/// read-only `CALL { … }` body makes no write.) Module-private: its two
/// callers are this family's own folds; cross-module consumers
/// (the expression-body write refusal, the namespace gate) read
/// [`query_contains_write`].
///
/// Parameterized on the per-clause
/// store-mutation predicate it reads at every depth: the conservative
/// clause table ([`crate::clause_mutates_store`], where `LOAD CSV` is a
/// `Write` for the access fold, ADR-0332) or the composition rule's
/// [`clause_writes_store`]. Nested `CALL { … }` / `WHEN` bodies descend
/// with the same predicate, so the two answers never disagree below the
/// top level.
/// Whether `clause` mutates the store, as the 42I25 composition rule reads
/// it: the clause table's answer minus `LOAD CSV`, which only reads a file
/// (the table classes it `Write` for the conservative access fold,
/// ADR-0332; REL8-1224).
pub
/// Whether `clause` writes outside `CALL { … } IN TRANSACTIONS`'s own
/// batches — the 42I25 refinement over [`clause_is_write_by`]: a batched
/// subquery's own writes run in its batches' own transactions, so they
/// never make their part (or stage) a writing one. The clause-validation
/// loop folds it into the 42I25 history each clause accumulates
/// ([`WriteHistory`]), so a batched subquery is refused after any earlier
/// unbatched write — in its own part's prefix or an earlier stage of the
/// statement's `NEXT` chain. The exclusion is the one canonical per-clause
/// reading ([`crate::clause_kind::clause_is_in_transactions`], as cheap as
/// the inline match it replaces), read before the classification so a
/// batched clause pays no recursive body walk. A `LOAD CSV` (top level or
/// inside a body) is not a write here ([`clause_writes_store`]).
/// The 42I25 write history of one `NEXT` chain: whether a write outside
/// `CALL { … } IN TRANSACTIONS`'s own batches precedes the point a
/// validation walk is at. A named fact at every boundary it crosses —
/// never a bare bool, and never `Scope` state: the clause loop owns the
/// running history ([`ClausePosition`]) and folds each clause's
/// unbatched writes into it, the stage driver returns its stage's answer
/// inside its stage validation, and the successor's stage seed carries
/// it — so a writing part precedes a later batched subquery exactly like
/// a write clause does: the chained statement's parts are one statement.
pub ;
/// One clause's position in the validation walk that checks it: the
/// part's clauses, the clause's index among them, and the 42I25 write
/// history accumulated to that point. The one value the position-reading
/// checks take — the `CALL { … }` subquery checker (its 42I25 rule and
/// `IN TRANSACTIONS` modifier battery) and the `USE` placement rule — so
/// position and history travel together and no checker re-derives the
/// other's half.
pub