Data-bound chart components 4/8: serve composite plan tokens - #464
Data-bound chart components 4/8: serve composite plan tokens#464FarhanAliRaza wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Greptile SummaryThe PR makes composite plan/data tokens servable as figure identities and adds recovery, affinity, fan-out, and typed error handling for that tier.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| python/reflex_xy/namespace.py | Adds composite-token identity, affinity, rebuild dispatch, plan binding after successful resolution, and typed request or room-wide errors. |
| python/reflex_xy/registry.py | Extends plan-index cleanup across the transitions that end a composite mount. |
| python/reflex_xy/state_bridge.py | Rebuilds data-backed figures by resolving plans, recovering columns from Reflex state, and binding them into fresh figures. |
| python/reflex_xy/app.py | Wires registry-side failures to namespace room broadcasts. |
| spec/design/reflex-integration.md | Documents composite-token serving, recovery, affinity, fan-out, and cleanup semantics. |
| tests/reflex_adapter/test_data_var.py | Covers plan-index cleanup for unsubscribe, disconnect, release, and TTL sweep transitions. |
| tests/reflex_adapter/test_socket_data_plane.py | Adds transport-level composite-token tests for serving, interactions, recovery, affinity, fan-out, and typed errors. |
Reviews (3): Last reviewed commit: "fix(reflex): unbind plan index on every ..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
e35456f to
25a9fdc
Compare
25a9fdc to
bf312d0
Compare
|
Review addressed in bf312d0 — plan-index lifecycle (P2): |
Makes xyp1|<digest>|<data token> a servable figure identity. The namespace
learns one concept — what a token reveals about affinity and
rebuildability — instead of branching on prefixes at each call site: a
composite enforces affinity through its embedded data token and rebuilds
like any state token; a bare xyd1 token names columns, never a figure, so
it keeps affinity but is never served or rebuilt as one.
Serving a composite is plan lookup + columns (registry hit, else the data
method re-run against session state) + bind into a fresh Chart. Both halves
are independently recoverable on any worker, so §3.2's reconnect promise
holds for this tier without a central store.
Failures are typed rather than flattened to "unknown figure token": a plan
miss (hot-reload digest drift) answers err {resync} naming the digest, and
a bind mismatch answers the reason, naming both sides. The registry's
error seam is wired to a room-wide err broadcast here — a column republish
whose bind fails has no request to answer, and without it subscribers would
sit on stale pixels with nothing in the log.
The wire envelope grew no fields: rooms, versions, mid addressing, and the
attachment cap treat a composite as an ordinary fig string.
Spec: reflex-integration.md §3.6 (composite tokens, republish fan-out),
file map.
The data-token -> {digests} index was inserted on subscribe but only
pruned when a republish under the same session token later found the
plan unmounted — short-lived sessions accumulated bindings forever.
Every transition that can end a mount now funnels through
_unbind_plan_if_unmounted_locked: last unsubscribe, disconnect,
release, failed-rebuild cleanup, and the TTL sweep. A cached figure
entry keeps the binding alive (still mounted); dropping the last of
entry+subscribers drops it.
The subscribe-time rebuild truncated the state's full name to its last dotted segment while the republish fan-out used the full name, so one mismatch produced two differently-labelled err frames (and the rebuilt validate_columns label disagreed with both). Both state_bridge labels now carry the full state name, matching registry._rebuild_dependent.
bf312d0 to
0e39225
Compare
There was a problem hiding this comment.
Greptile has paused reviews on this repository — it used its 100 free open-source review credits for this billing period. Reviews resume automatically on September 3. To continue before then, an organization admin can keep reviews running past the free credits — those bill as normal usage.
Stacked on #463. Base is
stack/3-plans-and-data-vars.Makes
xyp1|<digest>|<data token>a servable figure identity.Change
The namespace learns one concept — what a token reveals about affinity and rebuildability — instead of branching on prefixes at each call site:
xyd1token names columns, never a figure, so it keeps affinity but is never served or rebuilt as one.Serving a composite is plan lookup + columns (registry hit, else the data method re-run against session state) + bind into a fresh
Chart. Both halves are independently recoverable on any worker, so §3.2's reconnect promise holds for this tier without a central store.Failures are typed rather than flattened to "unknown figure token": a plan miss (hot-reload digest drift) answers
err {resync}naming the digest, and a bind mismatch answers the reason naming both sides.The registry's error seam is wired to a room-wide
errbroadcast here — a column republish whose bind fails has no request to answer, and without this subscribers would sit on stale pixels with nothing in the log.The wire envelope grew no fields. Rooms, versions,
midaddressing, and the attachment cap treat a composite as an ordinaryfigstring.Spec
reflex-integration.md§3.6 (composite tokens, republish fan-out), file map.Test plan
uv run pytest tests/reflex_adapter tests/test_validation_timing.py— 208 passed, including composite fan-out, plan-miss resync, and bind-error frames against a real uvicorn + socket.io clientpre-commit run --all-files,ruff check,ruff format --check,ty check— clean