Skip to content

Conversation

@Gozala
Copy link
Contributor

@Gozala Gozala commented Apr 7, 2025

Illustration of the design

To try this branch you need to run local toolshed

cd toolshed
deno task dev

And run local jumble pointing at it e.g.

cd jumble
TOOLSHED_API_URL=http://0.0.0.0:8000/ AI_URL=https://toolshed.saga-castor.ts.net VITE_STORAGE_TYPE=cached deno task dev

const merged = merge(stored, entry);
if (merged === undefined) {
this.store.delete(key);
updated.add(key);
Copy link
Contributor

@ubik2 ubik2 Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we delete here, we'll pass undefined to the subscriber on line 194, which violates the type signature for that method. It's possible there's some guarantee that we won't have a subscriber in that case, but I'm not sure that's true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good catch, thanks for spotting it. I guess I'm not sure what the right solution here, because we need to route this back to sink callback

sink<T = any>(
entityId: EntityId,
callback: (value: StorageValue<T>) => void,
): Cancel;

@seefeldb what should I pass into a callback when fact is removed / retracted ? I think it does not happen in practice but I imagine we need to support this. I think we either pass no value or we do not call subscription at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this in the meantime to fix spotted issue c899082

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it with {} as StorageValue for now. That removes the source and sets the value to undefined. Maybe add a TODO, since this isn't really the same as actual deleting. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in f648213

@ubik2 ubik2 merged commit 3d119c9 into main Apr 8, 2025
5 checks passed
@ubik2 ubik2 deleted the feat/memory-replica-idb branch April 8, 2025 18:00
jakedahn added a commit that referenced this pull request Apr 8, 2025
jakedahn added a commit that referenced this pull request Apr 8, 2025
#993)

* Enabling feature flag to enable #989

* fix: multi-space support

---------

Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
@sentry
Copy link

sentry bot commented Apr 18, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing. /:replicaName/:charmId View Issue

Did you find this useful? React with a 👍 or 👎

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.

4 participants