Skip to content

core: a refused argument form (undefined for null, a bigint for a display nat) shares a query key with the valid call, so it can be served cached data #765

Description

@b3hr4d

Found while fixing #761/#762 (PR #764). Everything here happens on main.

1. A refused argument can share a key with a valid call

When the valid call's result is cached, the refused form is answered from the cache through fetchQuery or a query hook, instead of failing. So an app with a bad argument can look like it works, until the cache is empty and the call throws.

Suggested fix: key a value only by the form the codec accepts at that position, and give refused values a key that can't match an accepted one. #757 and #764 already read argument types in the key builder, so this is local.

2. Some forms that send the same bytes still get separate keys

Extra calls, not wrong data:

  • extra record fields
  • a number vs numeric text for integers of 32 bits or less, and for floats
  • a Principal vs its text
  • a typed array vs a plain array for non-blob vectors
  • different values of reserved

Acceptance

  • A refused form never shares a key with an accepted one. The test fails on main.
  • Item 2 is fixed where it's cheap, or documented.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions