Skip to content

Inverse cloud logs replay order#1968

Merged
255kb merged 1 commit intomainfrom
bugfix/1966-cloud-logs-reversed
Nov 20, 2025
Merged

Inverse cloud logs replay order#1968
255kb merged 1 commit intomainfrom
bugfix/1966-cloud-logs-reversed

Conversation

@255kb
Copy link
Member

@255kb 255kb commented Nov 19, 2025

It's more correct to emit them in the order in which they were made, instead of reversing the order like in the app view. Closes #1966

Technical implementation details

Checklist

  • data migration added (@mockoon/commons)
  • commons lib tests added (@mockoon/commons)
  • commons-server lib tests added (@mockoon/commons-server)
  • CLI tests added (@mockoon/cli)
  • desktop UI automated tests added (@mockoon/app)

Closes #{issue_number}

Copilot AI review requested due to automatic review settings November 19, 2025 15:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reverses the order in which transaction logs are stored and replayed, changing from newest-first to oldest-first (chronological order). This aligns cloud logs replay with the order in which transactions actually occurred.

Key changes:

  • Transaction logs are now appended to the end of the array instead of the beginning
  • Log trimming now keeps the most recent entries by removing the oldest ones
  • SSE initial events now fetch the last N logs instead of the first N logs

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/commons-server/src/libs/server/server.ts Changes log storage from unshift to push and updates trimming logic to keep the last N transactions
packages/commons-server/src/libs/server/admin-api.ts Updates SSE initial events to fetch the last N logs and adds proper validation for maxLogs parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

It's more correct to emit them in the order in which they were made, instead of reversing the order like in the app view.
Closes #1966
@255kb 255kb force-pushed the bugfix/1966-cloud-logs-reversed branch from dae066f to 73fb9c9 Compare November 20, 2025 08:34
@255kb 255kb merged commit ccfbb9b into main Nov 20, 2025
15 checks passed
@255kb 255kb deleted the bugfix/1966-cloud-logs-reversed branch November 20, 2025 12:31
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.

Cloud logs replay are reversed

2 participants