Skip to content

feat(core): add adapter policies and storage replication - #1

Draft
bochaco wants to merge 1 commit into
mainfrom
feat/adapter-policies
Draft

bochaco wants to merge 1 commit into
mainfrom
feat/adapter-policies

Conversation

@bochaco

@bochaco bochaco commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Add optional storagePolicy and chainPolicy hooks (order, onSuccess, onFailure, onComplete) so users can override how configured adapters are used on success and failure, per operation. Without a policy, behaviour, on-chain formats and error shapes are unchanged.

Returning "continue" from storagePolicy.onSuccess writes extra copies. They are recorded inside the on-chain storageId, with no contract change, and retrieveByRefId() falls back to them. On chainPolicy, "continue" applies to init only, which lets fallback adapters that require init() work.

References with copies can't be read, updated or removed by SDK versions without this change.

Add optional storagePolicy and chainPolicy hooks (order, onSuccess,
onFailure, onComplete) so users can override how configured adapters are
used on success and failure, per operation. Without a policy, behaviour,
on-chain formats and error shapes are unchanged.

Returning "continue" from storagePolicy.onSuccess writes extra copies. They
are recorded inside the on-chain storageId, with no contract change, and
retrieveByRefId() falls back to them. On chainPolicy, "continue" applies to
init only, which lets fallback adapters that require init() work.

References with copies can't be read, updated or removed by SDK versions
without this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant