Commit f6e3757
committed
feat: enforce ADR-0029 closure-scope discipline (queue #86)
Adds EnforceAuditTransactionScopeRule enforcing the success-side of
ADR-0029 (Audit Row Durability Contract): non-transactional state
mutations (StatefulGuard / Session / Cache / Bus / Queue / Mail /
Notification / Broadcast / Storage facades + contracts, mutation
methods only) MUST NOT happen inside transaction(...) closures in
App\Actions\* classes.
Identifier: enforceAuditTransactionScope.nonTransactionalMutationInClosure.
Doctrine: ADR-0029 §Decision rule 3. Seed: ISMS-0003 PR #7 commit
f1d357b (2026-05-28). Failure-side (sentinel-return; throws inside
closure) is enforcement queue #85 — separate Pest arch tests, not
bundled.
Algorithm: namespace-gate App\Actions\*; locate execute()'s top-level
transaction() calls; for each, walk the closure body recursively
including nested closures and nested transactions; flag every
MethodCall|StaticCall whose receiver-type + method match the blocklist.
Instance-call detection matches the constructor-property's declared
FQCN against blocklist keys; static-facade detection uses
Scope::resolveName(). Reads (Auth::user(), Session::get(), Cache::get())
are deliberately permitted.
CHANGELOG [Unreleased] grows; no version bump in this PR.1 parent e3572b9 commit f6e3757
22 files changed
Lines changed: 1274 additions & 0 deletions
File tree
- src/Rules
- tests
- Fixtures/AuditTransactionScope
- Rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
0 commit comments