Commit 0b7622e
wshallwshall
test(store): widen the writer-txn guard to the nested-transaction verbs
tests/test_writer_txn_is_the_only_begin.py pins which functions may open a
transaction, but its AST scan matched BEGIN only. SAVEPOINT opens a nested
transaction and ROLLBACK TO unwinds one, so both landed in exactly the gap the
guard exists to close. RELEASE is scanned with them for the mirror hazard: it
commits a savepoint and every savepoint opened after it, so a stray or mispaired
one makes durable what the caller still expected to be able to roll back.
Widening the verb list alone would not have worked. The matcher was gated on
ast.Constant upstream of the prefix check, and a savepoint name has to be
interpolated, so real savepoint code is f-string or concatenation code. Measured:
the old scan run over PR 1233's store.py -- the live user of these verbs -- finds
its two known BEGINs and reports the file clean. The scan now reconstructs
f-strings and "+" concatenation, in the shape of tests/test_adr0157_fence_scope.py.
executescript is now scanned as well, statement by statement, resolving a script
passed by module-constant name. It was the one call carrying many statements in a
single argument, and nothing read it.
COMMIT and bare ROLLBACK stay out of the verb set on purpose: MessageStore._read
issues one of each as the ordinary whole-transaction close, and matching either
would red a clean tree on the statements that keep it clean. Control arms pin both
exclusions, alongside executemany and a SELECT whose text merely names a savepoint.
_ALLOWED is left byte-identical because PR 1227 has live edits on its
MessageStore._read entry. The new per-verb counts live in a separate table joined
at check time, with the merge condition and the value-shape constraint recorded so
the split does not outlive its reason.
_ALLOWED_NESTED ships empty, which is the measurement rather than an unfinished
table: store.py holds no savepoint statement today. Whichever of this change and
PR 1233 lands second registers that PR's four sites, which the failure message
names by verb, function and line.
Receipts are now four and include a pinned count of arguments the scan could not
read as text, since a new unreadable argument is the shape an evasion takes.1 parent ec32c96 commit 0b7622e
3 files changed
Lines changed: 391 additions & 52 deletions
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
208 | 214 | | |
209 | 215 | | |
210 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| |||
0 commit comments