Add additive detailed evaluation APIs - #33
Draft
staplen wants to merge 1 commit into
Draft
Conversation
compileDetailed and makeDetailedPredicate return {matched,
referencedSegmentIds, metadataComplete}; compile and makePredicate keep
returning predicates that evaluate to primitive Booleans, so every existing
caller is unaffected.
The compiler collects a segment reference only from the exact form
$user.segments CONTAINS <integer literal>, across the complete expression
and independent of evaluation order. Any other use of $user.segments marks
the whole rule metadataComplete: false rather than reporting a partial set.
Version 1.9.0.
minikevel
Bot
force-pushed
the
kp-633-detailed-evaluation
branch
from
September 11, 2026 13:08
b51d6e4 to
dc466ce
Compare
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.
Adds an additive way for a caller to learn which segment IDs an expression references, alongside the verdict.
What changes
compileDetailed(source)andmakeDetailedPredicate(compiled)return predicates whose result is an extensible object carrying at least:matched— BooleanreferencedSegmentIds— array of safe integersmetadataComplete— BooleancompileandmakePredicateare untouched. Their predicates still evaluate to primitive Booleans, so existing callers are unaffected.A reference is collected only from the exact form
$user.segments CONTAINS <integer literal>, across the complete expression including underNOT,ANDandOR, and independently of evaluation order, short-circuiting and environment values. Any other use of$user.segments, including a dynamic right operand, setsmetadataComplete: falsefor the whole expression rather than reporting a partial set.The reference metadata is embedded in the generated expression, so the compiled form stays a string.
Version
1.9.0.
masteris at 1.8.10, so this is the next minor.Tests
1,124 pass on Node 24.11.1, including the version-replay suite, which replays every stored historical compiled string through the current runtime and asserts behavior rather than output shape.
One qualification on that.
.gitignoreignorestest-data/, while nine corpora from 1.6.0 to 1.8.8 are tracked from before that rule existed. Each run writestest-data/{version}.jsonlocally and it is never committed, so compiled output from 1.8.9 and 1.8.10 is absent from the corpus. Closing that gap would mean force-addingtest-data/1.9.0.json, regenerating the missing corpora from their tags, and narrowing the ignore rule. Not done here.Compatibility
Old compiled expressions run unchanged on the new runtime, which is what the replay suite covers.
A newly compiled expression will not run on an older runtime, because the metadata capture helper does not exist there. The runtime therefore has to be deployed everywhere before any newly compiled expression reaches it, and a rollback cannot restore an older runtime afterwards.
Draft
Draft deliberately, pending review by a maintainer.