feat(rpc): report rule progress as built vs total rules#14985
Open
rgrinberg wants to merge 1 commit into
Open
Conversation
dd9f7af to
3fd483f
Compare
Rule progress now reports the number of rules whose value has been
established this run ("built") against the true total number of live rules,
rather than executed-vs-discovered counted only over the rules rebuilt this
run.
The counts are driven by Memo's [on_event] callback. [State.on_rule_event] is
wired into the rule and anonymous-action memo nodes: [Live] (a node becoming
live in the current run) increments [number_of_rules_discovered], and
[Validated] (its value established for the run) increments the new
[number_of_rules_validated]. Because [Live] fires for every live rule -
including ones restored from the cache - [number_of_rules_discovered] is now
the true total, not just the rules rebuilt this run. The previous
[number_of_rules_executed] counter, which counted only the rules rebuilt this
run, is no longer used and is removed.
[on_event] is a synchronous callback, so the build progress moves from a
[Fiber.Svar.t] to a plain [ref]. To keep the RPC server able to observe it,
[Rpc.Server] gains a long-poll [Source]: [Svar] (blocking on [Svar.wait], as
before) or [Computed] (read from a thunk and polled every [poll_every]). The
progress long poll uses a [Computed] source over the [ref]; the errors and
running-jobs long polls keep their [Svar]s. The status line and RPC progress
report built / total / in-progress.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
3fd483f to
9df749a
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.
Rule progress now reports built vs total rules: the number of rules whose
value has been established this run, against the true total number of live
rules — instead of the previous "executed vs discovered", which counted only
the rules rebuilt this run (so an incremental build that was mostly cache hits
never approached 100%).
How
The counts are driven by Memo's
on_eventcallback, wired into the rule andanonymous-action memo nodes:
Live(a node becomes live this run) →number_of_rules_discovered. BecauseLivefires for every live rule, including cache-restored ones, this is nowthe true total.
Validated(its value established for the run) → the newnumber_of_rules_validated("built").in_progress = discovered - validated. The previousnumber_of_rules_executedcounter is no longer used and is removed.
Plumbing
on_eventis a synchronous callback, so the build progress moves from aFiber.Svar.tto a plainref. To keep the RPC server able to observe it,Rpc.Servergains a long-pollSource:Svar(blocks onSvar.wait, asbefore) or
Computed(reads a thunk, polled everypoll_every). The progresspoll uses a
Computedsource over theref; errors and running-jobs keeptheir
Svars. The RPC wire type ({ complete; remaining; failed }) isunchanged — only the values improve.