adds stripped state pre processor - #330
Open
PoTheMagicDragon wants to merge 3 commits into
Open
PoTheMagicDragon wants to merge 3 commits into
PoTheMagicDragon wants to merge 3 commits into
Conversation
beanbag44
self-requested a review
September 16, 2026 16:56
beanbag44
requested changes
Sep 16, 2026
| interface StateProcessor { | ||
| /** Checked before [acceptsState], so a disabled processor still falls back to breaking. */ | ||
| context(_: AutomatedSafeContext) | ||
| fun isEnabled(): Boolean = true |
Member
There was a problem hiding this comment.
the isEnabled check is only overridden by StrippedStateProcessor so the check should probably be moved into the acceptsState for StrippedStateProcessor and the function removed.
| override fun isEnabled() = automatedSafeContext.buildConfig.stripLogs | ||
|
|
||
| override fun acceptsState(state: BlockState, targetState: BlockState): Boolean { | ||
| val unstrippedVariant = unstrippedToStripped[targetState.block] ?: return false |
Member
There was a problem hiding this comment.
this function as a whole can probably be simplified to an = function without a full block
|
|
||
| override fun acceptsState(state: BlockState, targetState: BlockState): Boolean { | ||
| val unstrippedVariant = unstrippedToStripped[targetState.block] ?: return false | ||
| return state.isReplaceable || state.block == unstrippedVariant |
Member
There was a problem hiding this comment.
state.isReplaceable shouldnt be necessary here. Its best to have strict requirements for a preprocessor to accept. If the state is replaceable, the preprocessor doesnt need to pre process as its not a log
Contributor
Author
There was a problem hiding this comment.
How do we make it place the unstripped log in the correct spot then?
| if (processor.acceptsState(state, targetState)) { | ||
| with(processor) { preProcess(state, targetState, pos) } | ||
| stateProcessing = true | ||
| if (!processor.acceptsState(state, targetState)) return@forEach |
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.
Description
Adds a pre processor for handling stripped logs