botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

DCR: change BotState to use template based storage keys

Open Stevenic opened this issue 6 years ago • 3 comments

Issue

The addition of remote skills is requiring that we rev the structure of our state storage keys which could break existing bots if we're not careful. Ideally we can come up with a solution that doesn't break existing bots and makes us more robust to additional key changes in the future.

Proposed change

One idea I have is to be more transparent with regards to the storage keys being used by moving away from our existing UserState and ConversationState classes and instead make the root BotState class template based. So to create your bots various state instances you could do the following:

const userState = new BotState(storage, '{callerId}/{botId}/{channelId}/users/{userId}');
const conversationState = new BotState(storage, '{callerId}/{botId}/{channelId}/conversations/{conversationId}');

We would leave the legacy UserState and ConversationState classes using the old keys but all of our samples would be updated to use the new keys above.

Moving forward if we need to make further changes to our storage keys we can simple update the samples without risk of breaking any existing bots.

Component Impact

BotState class and samples.

Customer Impact

Should be a non-breaking change for customers.

Tracking Status

Dotnet SDK

  • [ ] PR
  • [ ] Merged

Javascript SDK

  • [ ] PR
  • [ ] Merged

Java SDK

  • [ ] PR
  • [ ] Merged

Python SDK

  • [ ] PR
  • [ ] Merged

Emulator

  • [ ] PR
  • [ ] Merged

Samples

  • [ ] PR
  • [ ] Merged

Docs

  • [ ] PR
  • [ ] Merged

Tools

  • [ ] PR
  • [ ] Merged

[dcr]

Stevenic avatar May 13 '19 18:05 Stevenic