Module: Hermetic::SilasLedgerGuard
- Included in:
- Backends::Base
- Defined in:
- lib/hermetic/silas.rb
Overview
OPTIONAL Silas shim — require "hermetic/silas" from an app that runs
Silas (spec §4). A sandbox run is a non-replayable external effect, so it
must never happen inside a ledger transaction: a rollback after the guest
ran would replay it on retry. Silas's own Docker adapter carries this
guard; prepending here gives every Hermetic backend the same fail-loud
posture. Without Silas loaded the check no-ops, so requiring this file is
always safe.
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/hermetic/silas.rb', line 12 def run(...) if defined?(::Silas::Ledger) && ::Silas::Ledger.in_transaction? raise Error, "sandbox exec inside a ledger transaction — sandbox-backed tools " \ "must be at_most_once!, never transactional!" end super end |