Skip to content

refactor(metadata): use snake_case for all catalogue parameter names (HF-249)#1709

Merged
sequba merged 1 commit into
feature/hf-249-function-metadata-apifrom
feature/hf-249-snake-case-param-names-2ce9
Jul 14, 2026
Merged

refactor(metadata): use snake_case for all catalogue parameter names (HF-249)#1709
sequba merged 1 commit into
feature/hf-249-function-metadata-apifrom
feature/hf-249-snake-case-param-names-2ce9

Conversation

@sequba

@sequba sequba commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Context

Addresses a code-review finding on #1692: the function-metadata catalogue mixed several parameter-name conventions, which surface directly in a function-picker UI. Even closely-related functions disagreed — SUMIF used Range, Criteria, Sumrange, SUMIFS used Sum_Range, Criterion_range1, Criterion1, AVERAGEIF used Range, Criterion, Average_Range — mixing Title-case, snake_Case, and run-on tokens.

This normalizes every FunctionDoc parameter name to snake_case so the catalogue is internally consistent.

What changed

  • All 172 unique parameter names across the 13 categories/*.ts files are now snake_case (lowercase words joined by _, camelCase/acronym boundaries split, separators unified, trailing digits kept attached: Number1/Number_1number1).
  • Run-on tokens the docs left unsplit are segmented so siblings agree: Sumrangesum_range (matches SUMIFS), Searchcriterionsearch_criterion (matches VLOOKUP/HLOOKUP), plus logical_value, date_string, time_string, start_date, minimum_length, lower_bound, upper_bound, number_x, number_y.
  • The migration generator (scripts/hf249-migrate-function-docs.ts) now emits snake_case via a shared, exported toSnakeCase helper (+ a small segmentation table), so a future regeneration stays consistent. Its main() is guarded with require.main === module so the helper can be imported without side effects.
  • Not touched: parameter descriptions, examples, documentationUrl, categories, short descriptions, ordering. Custom-function positional names (Arg1, Arg2, …) are unchanged — they are a documented, self-consistent placeholder for user functions that ship no metadata (see open question below).

How did you test your changes?

  • tsc --noEmit — clean.
  • eslint on the changed files — 0 errors.
  • test/smoke.spec.ts — 4/4 pass.
  • Ad-hoc runtime checks against the built API:
    • every catalogue and getFunctionDetails parameter name matches ^[a-z][a-z0-9]*(_[a-z0-9]+)*$;
    • names are unique within each function (no collisions introduced by the transform);
    • getAvailableFunctions/getFunctionDetails list↔details parity still holds;
    • SUMIF & SUMIFS both expose sum_range; MATCH & VLOOKUP both expose search_criterion;
    • custom-function details still report Arg1, Arg2.
  • Ran the generator to confirm it produces identical parameter names to this hand-applied transform (the only regen deltas are unrelated pre-existing drift — alphabetical re-sorting of manually-added HSTACK/XIRR, the hand-authored SUM/SUMIF fields, and a stale TEXT description — so the regen output was discarded).

Types of changes

  • Breaking change (a fix or a feature because of which an existing functionality doesn't work as expected anymore)
  • New feature or improvement (a non-breaking change that adds functionality)
  • Bug fix (a non-breaking change that fixes an issue)
  • Additional language file, or a change to an existing language file (translations)
  • Change to the documentation

Related issues:

  1. Follow-up to Function metadata API: getAvailableFunctions / getFunctionDetails (HF-249) #1692 (HF-249); targets that branch.

Notes for reviewers

  • Paired tests: the private test suite (hyperformula-tests#14) asserts specific parameter names (e.g. SUMIF params); those expectations need updating to the new snake_case names.
  • Open question — custom functions: the request was "snake_case for all param names". I scoped this to the catalogue and left the runtime custom-function placeholders as the documented Arg1/Arg2. If you'd also like those lowercased (arg1/arg2), it's a 1-line change in buildCustomFunctionDetails plus a custom-functions.md wording update — say the word.
  • Segmentation calls (sumrangesum_range, etc.) are the only editorial decisions here; everything else is mechanical.
Open in Web Open in Cursor 

…(HF-249)

Normalize every FunctionDoc parameter name to snake_case for a consistent
function-picker UI, replacing the mixed Title-case/underscore styles
(e.g. Sum_Range/Sumrange/Number1/Number_1). Sibling params now agree
(SUMIF & SUMIFS both use sum_range; MATCH & VLOOKUP both search_criterion).

The migration generator (scripts/hf249-migrate-function-docs.ts) now emits
snake_case via a shared toSnakeCase helper (camel/acronym splitting, separator
unification, digits kept attached) plus a small segmentation table for run-on
tokens the docs left unsplit; its main() is guarded so the helper is importable
without side effects. Descriptions, examples and documentationUrl are untouched;
custom-function positional names (Arg1, Arg2) are unchanged.

Co-authored-by: Kuba Sekowski <sequba@users.noreply.github.com>
@qunabu

qunabu commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

Performance comparison of head (07161a0) vs base (18d4246)

                                     testName |   base |   head | change
------------------------------------------------------------------------
                                      Sheet A | 486.32 | 504.74 | +3.79%
                                      Sheet B | 157.63 | 163.53 | +3.74%
                                      Sheet T | 146.84 | 144.89 | -1.33%
                                Column ranges | 479.49 | 481.36 | +0.39%
Sheet A:  change value, add/remove row/column |  16.99 |  17.94 | +5.59%
 Sheet B: change value, add/remove row/column | 146.24 | 145.13 | -0.76%
                   Column ranges - add column | 151.86 |  164.9 | +8.59%
                Column ranges - without batch | 468.23 | 480.48 | +2.62%
                        Column ranges - batch | 119.88 | 124.31 | +3.70%

@sequba sequba marked this pull request as ready for review July 14, 2026 13:36
@sequba sequba merged commit 4612e75 into feature/hf-249-function-metadata-api Jul 14, 2026
28 checks passed
@sequba sequba deleted the feature/hf-249-snake-case-param-names-2ce9 branch July 14, 2026 13:36
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.61%. Comparing base (18d4246) to head (07161a0).
⚠️ Report is 1 commits behind head on feature/hf-249-function-metadata-api.

Additional details and impacted files

Impacted file tree graph

@@                           Coverage Diff                            @@
##           feature/hf-249-function-metadata-api    #1709      +/-   ##
========================================================================
+ Coverage                                 96.42%   96.61%   +0.19%     
========================================================================
  Files                                       192      192              
  Lines                                     15585    15585              
  Branches                                   3447     3447              
========================================================================
+ Hits                                      15028    15058      +30     
+ Misses                                      557      527      -30     
Files with missing lines Coverage Δ
.../functionMetadata/categories/array-manipulation.ts 100.00% <ø> (ø)
...nterpreter/functionMetadata/categories/database.ts 100.00% <ø> (ø)
...reter/functionMetadata/categories/date-and-time.ts 100.00% <ø> (ø)
...rpreter/functionMetadata/categories/engineering.ts 100.00% <ø> (ø)
...terpreter/functionMetadata/categories/financial.ts 100.00% <ø> (ø)
...rpreter/functionMetadata/categories/information.ts 100.00% <ø> (ø)
...interpreter/functionMetadata/categories/logical.ts 100.00% <ø> (ø)
...unctionMetadata/categories/lookup-and-reference.ts 100.00% <ø> (ø)
...nctionMetadata/categories/math-and-trigonometry.ts 100.00% <ø> (ø)
...er/functionMetadata/categories/matrix-functions.ts 100.00% <ø> (ø)
... and 3 more

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

marcin-kordas-hoc added a commit that referenced this pull request Jul 14, 2026
…(HF-300)

Post-merge with the updated base (snake_case params #1709 + new functions):
- Author XIRR, VSTACK, HSTACK, and fill TBILLEQ/TBILLPRICE 'discount' (base-added).
- Restore examples mis-attached during conflict resolution: SEQUENCE, XNPV, GCD.
- Remove SUM's stale per-function documentationUrl re-introduced by the merge
  (the shared .html default supplies it; comment already said it's absent).

Source: https://app.clickup.com/t/86caprtgj
ADR: adr/2026-07-13-hf300-function-metadata-enrichment.md
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

3 participants