Skip to content

Conversation

@joshua-spacetime
Copy link
Collaborator

@joshua-spacetime joshua-spacetime commented Nov 17, 2025

Description of Changes

Fixes a subscription plan caching bug related to client-specific views.

Before this fix, you could define a client-specific view:

fn my_view(ctx: &ViewContext) -> Option<Player> {
    ctx.db.player().identity().find(ctx.sender)
}

And subscribe to it as follows:

SELECT * FROM my_view

Note this view is implicitly parameterized by :sender, however when generating a query hash for this subscription, this fact would not be taken into account which would result in this query being cached and reused for all callers.

After this fix, a query hash is generated for this subscription as though it were given as:

SELECT * FROM my_view WHERE identity = :sender

API and ABI breaking changes

None

Note for CLI code owners:

I had to touch the subscribe cli command file. No updates to the api. It just needed to be updated to look for views in the module def.

Expected complexity level and risk

1

Testing

  • Added a regression smoketest

@joshua-spacetime joshua-spacetime added the bugfix Fixes something that was expected to work differently label Nov 17, 2025
@joshua-spacetime joshua-spacetime linked an issue Nov 17, 2025 that may be closed by this pull request
@joshua-spacetime joshua-spacetime changed the title Joshua/fix/view caching fix subscription plan caching for client-specific views Nov 17, 2025
@bfops bfops added the release-any To be landed in any release window label Nov 17, 2025
Copy link
Collaborator

@jdetter jdetter left a comment

Choose a reason for hiding this comment

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

Leaving my review as a CLI code owner, Joshua explained the change and it's not API breaking so this seems fine. I did not test this myself.

@joshua-spacetime joshua-spacetime changed the title fix subscription plan caching for client-specific views fix plan caching for client-specific views Nov 19, 2025
@joshua-spacetime joshua-spacetime added this pull request to the merge queue Nov 19, 2025
Merged via the queue into master with commit f7ef92b Nov 19, 2025
24 of 25 checks passed
@joshua-spacetime joshua-spacetime deleted the joshua/fix/view-caching branch November 19, 2025 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that was expected to work differently release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid plan caching for views

5 participants