Why: Account disable could be followed by late Backend business writes, API key creation could implicitly create users, account bootstrap locks could invert, and directory cursors were process-local or leaked out-of-scope changes. Evidence: Local go test ./... and isolated PostgreSQL package suites passed on the staged candidate; exact committed-head SELF replay and stage 6 human review remain pending. Impact: Adds final account transactions and external-effect checks across HTTP, Host, Bus and run manager; tightens API key issuance and persists versioned cursor signing. Delegated RDM rename still needs the separately proposed real-operator contract, so A1 and stage 6 are not complete. Refs: Documents U3 r1, approved A1-A4 amendment fb3a821, pending delegated-projection amendment 5783940, Dev feature/iam-u3-account-directory-recovery.
37 lines
838 B
Go
37 lines
838 B
Go
package tools
|
|
|
|
import "context"
|
|
|
|
// externalEffectChecker is supplied by the runtime context for account and
|
|
// resource admission immediately before an effect. Older embedded tool
|
|
// contexts can omit it; the runtime is responsible for wiring the real check.
|
|
type externalEffectChecker interface {
|
|
CheckExternalEffect() error
|
|
}
|
|
|
|
func checkToolExternalEffect(rc ToolExecCtx) error {
|
|
return checkExternalEffect(execParentCtx(rc), func() error {
|
|
if checker, ok := rc.(externalEffectChecker); ok {
|
|
return checker.CheckExternalEffect()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
func checkExternalEffect(ctx context.Context, check func() error) error {
|
|
if ctx != nil {
|
|
if err := ctx.Err(); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
if check != nil {
|
|
if err := check(); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
if ctx != nil {
|
|
return ctx.Err()
|
|
}
|
|
return nil
|
|
}
|