hypothesis / hypothesis/client
Send annotations to correct frame when annotation URL does not match frame URL
- Dominant language
- Mustache
- Stars
- 730
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/hypothesis/client/pull/4131 implemented initial support for sending annotations to a specific frame based on a match between the annotation URL and the frame URL. This means that if an annotation is fetched for a non-main guest frame based on some other identifier (eg. a DOI, a fingerprint) or the backend returns an annotation with URL A when viewing frame with URL B because URLs A and B are deemed equivalent by the h backend (in other words `storage.expand_uri` for URL A returns a set that includes URL B), then the annotation will not be sent to the frame.
The client currently requests annotations for all frames with a single sequence of search requests, and the backend does not provide information about why a particular URL matched the query (eg. which of the search URLs matched). In order to fix this we'll either need to make separate calls to the `/api/search` endpoint for each frame, or make this endpoint return information about which URL (from the `uri` query params) matched a particular annotation.
The same issues also applies to the WebSocket. The client sends a filter to the backend which includes a set of query URLs for each frame. When the WebSocket server matches an annotation-related notification to a socket and sends a notification to the client, it does not indicate which of the query URLs matched. As a result the client can't tell which frame a newly-added annotation relates to.
Related issues:
- https://github.com/hypothesis/client/issues/3992
- https://github.com/hypothesis/client/issues/4153#issuecomment-1031383538
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.