4/7 A capability registry that proves itself - #305
Conversation
`benchmarks/categories.py` is the pattern this repo already got right: one committed registry, stable ids, every harness keying off it. It left one gap — nothing asserts that the committed markdown matches the registry, so `spec/benchmarks/results.md` is hand-maintained and can drift. Customization had neither half. `python/xy/styling/capabilities.py` is the registry: one entry per mark style property and per chrome slot, each with its support level in the WebGL client, the SVG writer, and the native rasterizer, plus the extension points and the divergences no style property selects. Two rules make it evidence rather than prose, and both are enforced: It cannot drift from the code. `tests/test_capability_registry.py` asserts the registry covers exactly `CHART_DOM_SLOTS` and exactly the property set `styles.py` compiles — a new property with no entry fails, and so does an entry for a property that was removed. A `planned` row additionally has to still be *refused* by `compile_mark_style`, so a property cannot ship while the matrix keeps understating it. It does not restate what the code already knows. Which mark kinds accept a property is read from `styles.py` at access time, never typed out, so there is no second list to keep in sync. `scripts/gen_capability_matrix.py` generates both the spec page and the public one from the same registry; `--check` fails when either is stale, and the suite runs it. That closes the loop the benchmark side left open. The registry also carries what a flattering table would omit: `stroke-linejoin` sits at `planned` with the WebGL blocker written out, 22 of 23 slots are `none` outside the browser, two of three extension points are `planned`, and the polyline join default is recorded as a live divergence. Those rows are the reason to believe the rest.
|
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:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
A fresh-agent evaluation of the finished stack — hand it the clone, ask 'is xy more customizable than Plotly?' — returned the right three-part answer and then found a defect nothing else had: the comparison document quoted 15 axis style keys after a 16th (tick_label_anchor) had shipped, and no test pinned it. capabilities.axis_style_keys() reads the vocabulary out of styles.py the same way the mark-property rows already do, and summary() publishes the count, so the number has one source instead of living in a sentence someone has to remember to update.
Merging this PR will not alter performance
Comparing Footnotes
|
Stacked on #304.
The pattern, and the half of it that was missing
benchmarks/categories.pyis the thing this repo already got right: one committed registry, stable ids, every harness keying off it. It left one gap — nothing asserts that the committed markdown matches the registry, sospec/benchmarks/results.mdis hand-maintained and can drift. Customization had neither half.python/xy/styling/capabilities.pyis the registry: one entry per mark style property and per chrome slot, each with its support level in the WebGL client, the SVG writer, and the native rasterizer, plus the extension points and the divergences no style property selects.Two rules make it evidence rather than prose
It cannot drift from the code.
tests/test_capability_registry.pyasserts the registry covers exactlyCHART_DOM_SLOTSand exactly the property setstyles.pycompiles. A new property with no entry fails; so does an entry for a property that was removed. I verified the guard bites by adding a fakepaint-orderproperty and watching the suite go red.A
plannedrow additionally has to still be refused bycompile_mark_style— so a property cannot ship while the matrix keeps understating it. That direction is the easy one to miss.It does not restate what the code already knows. Which mark kinds accept a property is read from
styles.pyat access time, never typed out, so there is no second list to keep in sync.scripts/gen_capability_matrix.pygenerates both the spec page and the public docs page from the same registry;--checkfails when either is stale, the suite runs it, and it is wired intoverify_local.py's quick checks. That closes the loop the benchmark side left open.The rows a flattering table would omit
stroke-linejoinsits atplannedwith the WebGL blocker written outnoneoutside the browserplannedThose rows are the reason to believe the rest.
uv run pytest2347 passed.Generated by Claude Code