Repository navigation
API: Introduced recording conditions that record only once the checked action happened - #10
Merged
Merged
Conversation
ConditionType.Recording is a type about one part that holds by what it recorded on its line before, such as a cooldown. Checking records nothing: a Passed verdict carries the recordings of the conditions that decided it, and the host calls passed.record() once the action the check allowed happened. Only deciding conditions record: the taken branch of an any, never one inside a not, and nothing when a later line refuses. Line names the condition's config path, so two lines of one type keep apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Some conditions depend on what happened before: a cooldown, a daily limit, something that may happen once. Such a condition must not count a use when it's only checked. Otherwise a cooldown is used up by a message that a later line refused, or that was never sent. This adds a shape for that: the host decides when the action happened.
What's in it
ConditionType.Recording<T, S>: a fourth shape, about one part, that answers at once, so every place takes it.holdsandrecordboth get the condition'sLine.model.Line: the condition's config path, such aschats.global.requires[1].cooldown, so two lines of one type keep their records apart.Verdict.Passed(recordings):Verdict.Recordables (path, condition, action) for the recording conditions that decided the check.passed.record()runs each once and in order. One that throws doesn't stop the others; the first failure is rethrown, with the later ones suppressed.new Verdict.Passed()still exists and records nothing.any, only the branch that was taken.not, which held only by failing.Passedthen.PlaceandDeferredPlacecarry recordings.API compatibility:
Verdict.Passedgains a record component. Code that deconstructs it with the record patternVerdict.Passed()has to writeVerdict.Passed passedorVerdict.Passed(var recordings).First user: Socialismus's
cooldowncondition, whose timers live in a replicated store (whereareiam/Socialismus#273).Checks
./gradlew buildpasses locally, Javadoc included.DefaultConditionsTest:not;anyrecords;🤖 Generated with Claude Code