Skip to content

test(replay): fix full session replay#116

Merged
sudo-tee merged 1 commit intosudo-tee:mainfrom
cameronr:test/event-replay-fix
Nov 13, 2025
Merged

test(replay): fix full session replay#116
sudo-tee merged 1 commit intosudo-tee:mainfrom
cameronr:test/event-replay-fix

Conversation

@cameronr
Copy link
Collaborator

@cameronr cameronr commented Nov 12, 2025

The issue is a bit subtle: the event notification about the session changing from nil to an id gets wrapped in vim.schedule but that means it gets delivered after we've loaded the full session, which causes us to clear the whole session right after we just loaded it, leaving the output blank.

It's possible that we might want to not wrap state notifications in vim.schedule and expect listeners to handle cases where they can't be in a fast context. The primary benefit of that would be guaranteed ordering of events.

For example, in this case, the event that the session was set would've been processed before we loaded the session so the issue wouldn't exist.

The issue is only coming up now because the replay script used to unsubscribe to state.active_session changes but i didn't keep that because it felt like a hack.

For now, I think we can just watch out for any issues in actual usage.

The issue is a bit subtle: the event notification about the session
changing from nil to an id gets wrapped in vim.schedule but that means
it gets delivered after we've loaded the fulls session, which causes us
to clear the whole session right after we just loaded it, leaving the
output blank.

It's possible that we might want to not wrap state notifications in
vim.schedule and expect listeners to handle cases where they can't be in
a fast context. The primary benefit of that would be guaranteed ordering
of events.

For example, in this case, the event that the session was set would've
been processed before we loaded the session so the issue wouldn't exist.
@cameronr
Copy link
Collaborator Author

Actually, the more I think about this the more I think it's probably not an issue in practice. The replay harness pattern of setting the session and then manually loading the session directly has the order and effect backwards. Normally, it's setting state.active_session that should be triggering the loading.

@sudo-tee
Copy link
Owner

Actually, the more I think about this the more I think it's probably not an issue in practice. The replay harness pattern of setting the session and then manually loading the session directly has the order and effect backwards. Normally, it's setting state.active_session that should be triggering the loading.

You are right about this. It makes more sense this way

@cameronr
Copy link
Collaborator Author

Sounds good. This PR should still be merged as it just fixes the full session replay.

@sudo-tee sudo-tee merged commit 9a2cb69 into sudo-tee:main Nov 13, 2025
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants