[P0] Harden #57 post-merge retention, adapter identity, and terminal resolution invariants #80
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#80
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Discovered by
Post-merge adversarial review of PR #78 /
mainat7af5d5f6dc833c70bd547571654485eb73a1a704.This is a substrate hardening issue. It does not implement #79 canonical provider/tool/MCP adoption.
1. Prune is not linearizable with admission/dispatch
rlm_effect_prune/2currently reads attempts and later deletes the call without holding therlm_effect_statemutex used by admission/dispatch/observation transitions.A stale interleaving can therefore be:
Additionally,
rlm_effect_admit/3andrlm_effect_cancel_ticket/3validate a ticket before entering the effect-state mutex. If pruning removes the call between validation and claim, the old code can create an orphan attempt against a call that no longer exists.Required fix
2. Adapter identity is not part of executable identity
effect_execute(Adapter, Kind, Request, Options, ...)chooses the code that crosses the external boundary, butrlm_effect_prepare/4hashes onlyKind + Request + Semantics.Therefore the same request can be submitted with adapter A and later invoked/reconciled with adapter B while sharing one durable attempt unless every caller manually encodes adapter identity into the request. The generic executor does not enforce this and the docs do not require it.
Required fix
3.
abandonedindeterminate attempts are still accepted as retry/resample parentsThe state machine distinguishes trusted resolutions:
but
allowed_explicit_parent_status/2currently acceptsabandonedas an explicit retry/resample parent. This defeats the semantic distinction between authorizing a risky retry and abandoning the uncertain operation.Required fix
An
abandonedattempt must not become an explicit retry/resample parent. Onlyretry_authorizedshould unlock retry after an indeterminate remote outcome.4. Explicit reconciliation can downgrade an already-authoritative local observation
effect_reconcile/3always calls the reconciliation adapter afterrlm_effect_status/2, including when the attempt is alreadyobserved. If the remote reconciliation is unavailable or returns uncertainty, the public result can becomeindeterminateeven though an immutable local authoritative observation already exists.Required fix
Acceptance
abandonedcannot be retried/resampled;Refs #57 #79 #53 #54