S0028: effect bindings may conflict in the same tick
Generated from rellum-diagnostics/src/db.rs.
Explanation
Effects that can fire in the same tick must be independent or explicitly sequenced. If two effect bindings touch the same singleton effect or the same resource key, the execution order would otherwise be undefined and replay could not guarantee the same behavior.
Common causes
- two effects write to the same file path in the same tick
- two effects flush or close the same request handle
- two bindings call the same singleton effect without sequencing
- using on any alongside another trigger that can fire in the same tick
Canonical fixes
- sequence the conflicting effect calls in one binding
Before:
first! on line => write!("build/out.txt", a)
second! on line => write!("build/out.txt", b)
After:
main! on line => write!("build/out.txt", a) -> write!("build/out.txt", b)
- use distinct resource keys when the effects are independent
Before:
first! = write!(LOG_FILE, a)
second! = write!(LOG_FILE, b)
After:
first! = write!(LOG_FILE, a)
second! = write!(ERROR_FILE, b)
Code example
first! on line => write!("build/out.txt", a)
second! on line => write!("build/out.txt", b)