Skip to content

xlstream: centralize formula registration (single registry)#182

Merged
cilladev merged 10 commits into
mainfrom
feat/formula-registry-v2
May 22, 2026
Merged

xlstream: centralize formula registration (single registry)#182
cilladev merged 10 commits into
mainfrom
feat/formula-registry-v2

Conversation

@cilladev

Copy link
Copy Markdown
Owner

Summary

  • Replace 9 scattered function-name registration sites with a single centralized registry in xlstream-eval/src/registry.rs
  • 208 FunctionEntry structs with FunctionMeta (caps, category, agg_kind) + handler fn pointer + aliases
  • classify(), rewrite(), collect_lookup_keys() take a fn_lookup callback — parse never imports eval
  • registry::dispatch() replaces the old 300-line match in builtins/mod.rs
  • classify_function() routes via FnCaps/FnCategory flags instead of 5 sets::is_*() calls
  • sets.rs reduced from 8 phf_sets to 3 (kept: UNSUPPORTED, DYNAMIC_ARRAY, VOLATILE_UNSUPPORTED)
  • Spec: docs/roadmap/v0.4/02-formula-registry-cleanup-v2.md

Test plan

  • 13 registry unit tests (lookup, case insensitivity, aliases, flag consistency)
  • All ~2700 existing tests pass (no behavior change)
  • make check passes (fmt, clippy, test, doctest)
  • CLI smoke tests pass with real registry
  • CHANGELOG updated
  • Roadmap checkbox ticked
  • v1 spec marked superseded

cilladev added 6 commits May 22, 2026 06:34
Add bitflags dependency and pure metadata types for the centralized
function registry.
- 225 handle_* wrappers in builtins/mod.rs (uniform Value-returning sig)
- pub mod registry in lib.rs
- fix resolve.rs doctest for fn_lookup callback
- 13 registry unit tests (lookup, aliases, flag consistency)
- interp.rs: registry::dispatch replaces builtins::dispatch
- evaluate.rs: registry::lookup_meta replaces no_meta placeholder
- remove old 300-line dispatch match and agg() helper
- classify_function() routes via FnCaps/FnCategory from fn_lookup
- rewrite_node() routes via meta.category and meta.caps.LOOKUP
- collect_from_node() gates on LOOKUP flag
- agg_kind_for() removed (replaced by meta.agg_kind)
- sets.rs: removed 5 sets, kept UNSUPPORTED only
- integration tests use real registry; unit tests use test_meta mock
- CHANGELOG.md: add centralized registry entry under [Unreleased]
- roadmap: tick formula registry checkbox, mark v1 spec superseded
- cli: use registry::lookup_meta instead of no_meta placeholder
- prelude_plan tests: use real registry for classify/rewrite
- fix parse-crate doctests for registry-gated routing

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 709cc55 Previous: cf9a571 Ratio
conditional/iferror 103 ns/iter (± 0) 78 ns/iter (± 1) 1.32
date/year 258 ns/iter (± 4) 200 ns/iter (± 3) 1.29
date/datedif 512 ns/iter (± 12) 405 ns/iter (± 2) 1.26
info/isnumber 85 ns/iter (± 0) 70 ns/iter (± 0) 1.21
info/row_no_arg 55 ns/iter (± 0) 37 ns/iter (± 0) 1.49
info/column_no_arg 61 ns/iter (± 0) 44 ns/iter (± 0) 1.39
info/rows_range 64 ns/iter (± 0) 51 ns/iter (± 0) 1.25

This comment was automatically generated by workflow using github-action-benchmark.

cilladev added 4 commits May 22, 2026 11:01
…andle_*

- delete 58 pass-through wrappers (34 sub-module, 24 local)
- rename 25 builtin_* in mod.rs to handle_* for consistent naming
- registry points directly at sub-module functions where possible
- bump conditional, lookup, multi_conditional, subtotal to pub(crate)
1. fix EXPON.DIST flag: remove incorrect RANGE_EXPAND
2. fix collect_from_node: use meta.name for inner match
3. widen FnCaps from u8 to u16 for future flags
4. make FunctionEntry::handler pub(crate)
5. exact entry count test (208)
6. aggregate-implies-NEEDS_PRELUDE invariant test
@cilladev cilladev merged commit 236e269 into main May 22, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant