Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewing Broadcast - Source realizes they've sent a wrong move, and sends a correction - Viewer stuck on variation #15354

Closed
tors42 opened this issue May 21, 2024 · 3 comments
Assignees

Comments

@tors42
Copy link
Contributor

tors42 commented May 21, 2024

Scenario:

When a viewer is viewing a broadcast in the web browser,
moves are automatically displayed on the board as they come in from the source.
If the source changes its mind, and regards a previously sent move as a "wrong" move,
and instead sends a "new" move - the "wrong" move will end up in a variation - and the "new" move will continue as mainline.

Problem:

The viewer will now be "stuck" seeing only the variation move,
instead of enjoying the incoming moves in the mainline.

I guess the intention of this behaviour,
is that it is nice to let the viewer browse variations without being "disturbed" by new incoming moves.

But in this case,
the viewer didn't initiate the act of browsing a variation... So maybe it is possible to detect this scenario, and help the viewer out of the variation and onto the mainline again... 🤔

Below is a scala-cli application which helps reproduce the scenario.
It creates a broadcast and prints its URL,
and pushes a move and waits for keypress so one has time to view the broadcast,
and then the application changes its mind and sends another move.

scala-cli broadcast
//> using scala 3.4.2
//> using dep io.github.tors42:chariot:0.0.88

@main
def main() =

  val lichessApi = "http://localhost:8080"
  val token      = "lip_yulia"

  val client = chariot.Client.basic(conf => conf.api(lichessApi))
    .withToken(token)

  val broadcast = client.broadcasts().create(p => p
    .name("Broadcast Name")
    .shortDescription("Short Broadcast Description")
    .longDescription("Looooong Broadcast Description")).get()

  val roundId = client.broadcasts().createRound(broadcast.id(),
    p => p.name("Round Name")).get().id()


  val push1 = """
    [White "Hou Yifan"]
    [Black "Lei Tingjie"]

    1. d4 *
    """

  val push2 = """
    [White "Hou Yifan"]
    [Black "Lei Tingjie"]

    1. d4 a5 *
    """

  val push3 = """
    [White "Hou Yifan"]
    [Black "Lei Tingjie"]

    1. d4 d5 *
    """

  println(s"Broadcast at $lichessApi/broadcast/-/-/$roundId")

  client.broadcasts().pushPgnByRoundId(roundId, push1)

  println("1. d4 has been broadcasted. Press enter to broadcast 1. d4 a5 followed by corrective 1. d4 d5")
  System.in.read()

  client.broadcasts().pushPgnByRoundId(roundId, push2)
  client.broadcasts().pushPgnByRoundId(roundId, push3)


  println(String.join("\n", client.broadcasts().exportOneRoundPgn(roundId).stream().map(_.toString).toList()))
@ornicar ornicar self-assigned this May 23, 2024
@AbdullahKhetran
Copy link

This still doesn't work in broadcast
Screenshot from 2024-05-23 20-03-34

2 API requests were sent using Postman where moves were 1. e4 e6 and 1. e3 e6 2. a3 respectively

The viewer is still stuck on the variation (e6 highlighted in blue)

@tors42
Copy link
Contributor Author

tors42 commented May 23, 2024

This still doesn't work in broadcast

I tested the fix on my development instance, and there the fix works! 🎉

The fix has not been deployed at https://lichess.org yet, it is running an older version.

It is possible to see which commit Lichess is currently running, at the top of https://lichess.org/source

@AbdullahKhetran
Copy link

Oh okay, got it.

How often does the production server get updated?

Current versions on the site shows the commit of May 15, 2024

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

No branches or pull requests

3 participants