ontola / ontola/atomic-server

Outdated resource gap - how to make sure the front-end always shows latest version

Open
#697 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.6k
Forks
82
Avg merge
10h 34m
Merged PRs (30d)
205

Description

In the CI, some E2E tests were failing - all of them related to websockets. The second window was showing outdated resources.

Cause (unverified)

  • A commit is processed for a new Resource A
  • Resource A is opened in a new window
  • Resource A is included in the HTML of the page by the server
  • A commit is processed for Resource A'
  • When the page is rendered and the JS has executed, a SUBSCRIBE message is sent to the server
  • The client does not receive the A' commit, and only knows resource A.

Possible fixes

Include last-commit in SUBSCRIBE calls
  • Client (optionally) includes the last-commit in SUBSCRIBE message
  • Server checks if this is indeed the latest commit for that resource
  • If false, the server sends an RESOURCE message to the client with the latest version.
Add a timeout in the E2E tests
  • Quick 'n Dirty fix, doesn't address the underlying problem
Combine GET and SUBSCRIBE messages
  • Instead of doing a GET and a subsequent SUBSCRIBE, just do a SUBSCRIBE and that returns the full Resource

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the websocket-related E2E failures and trace the GET, SUBSCRIBE, and RESOURCE message flow between the front end and server. Compare the client’s resource version with the server’s latest commit, then determine which proposed approach has clear tests proving that a newly opened window displays the latest resource.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, frontend, testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.