Move the combo garbage line estimate into the engine for reuse - #758
Merged
JamesVanBoxtel merged 1 commit intoSep 18, 2026
Merged
Conversation
Problem Analytics kept its own copy of how many garbage lines each combo size sends, out of reach of engine code. This makes it hard to share for UI, GPM analysis in future work such as CPU code, etc. Solution Stack.getEstimatedGarbageLinesForCombo now provides the value publicly with shared truth from the combo table. Why this approach The calculation needs to be shared somewhere, arguably this is not "engine" code but it should be shared between server, client, etc so I think this is the best spot. Verification Added tests lua-language-server check reports nothing in the changed files.
JamesVanBoxtel
commented
Sep 13, 2026
| local class = require("common.lib.class") | ||
| local RollbackBuffer = require("common.engine.RollbackBuffer") | ||
| local Stack = require("common.engine.Stack") | ||
| require("common.engine.checkMatches") |
Contributor
Author
There was a problem hiding this comment.
its a little weird that check matches is an exstencion on stack but has to be required in this way, but its preexisting.
Probably should just require check matches at the end of Stack and call it StackCheckMatches or something, but this is a pre existing pattern so I'm not going to bundle it with this change
Endaris
approved these changes
Sep 16, 2026
Endaris
left a comment
Collaborator
There was a problem hiding this comment.
If we add more helpers for analytics in the future, we probably want to move these into its own file.
I think it's not wrong for this to be in the engine directory as its information directly pertains to the engine but longterm I think it would be nice if this was a separate file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Analytics kept its own copy of how many garbage lines each combo size sends, out of reach of engine code.
This makes it hard to share for UI, GPM analysis in future work such as CPU code, etc.
Solution
Stack.getEstimatedGarbageLinesForCombo now provides the value publicly with shared truth from the combo table.
Why this approach
The calculation needs to be shared somewhere, arguably this is not "engine" code but it should be shared between server, client, etc so I think this is the best spot.
Verification
Added tests
lua-language-server check reports nothing in the changed files.