Skip to content

docs(HF-282): auto-derive function & language counts in docs - #1715

Merged
sequba merged 7 commits into
developfrom
feat/hf-282-docs-counts
Sep 2, 2026
Merged

sequba merged 7 commits into
developfrom
feat/hf-282-docs-counts

Conversation

@marcin-kordas-hoc

@marcin-kordas-hoc marcin-kordas-hoc commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

What & why

The docs stated a hardcoded count of built-in functions ("~400"/"400+") and languages ("17"/"18") that drifts from reality. The function count already auto-derived via {{ $page.functionsCount }}; this adds the parallel {{ $page.languagesCount }} and swaps the remaining hardcoded counts to the interpolated variables.

How

  • docs/.vuepress/config.js: derive languagesCount once at config load from the i18n export barrel src/i18n/languages/index.ts (whitespace-tolerant regex + fail-loud guard so a barrel reformat can never silently publish "0 languages"); inject $page.languagesCount.
  • Docs: ~400/400+ → {{ $page.functionsCount }} (index, ai-sdk, mcp-server, langchain); 17/18 → {{ $page.languagesCount }} (index, built-in-functions, i18n-features, localizing-functions).
  • README.md (not a VuePress page, so no interpolation possible): manual over 400 + 18, with the language count now asserted against the same i18n barrel at config load (3b4fda30f) so it fails the docs build instead of rotting silently.
  • docs/.vuepress/plugins/md-companions/index.js: register languagesCount with the companion {{ $page.* }} resolver (3ef3fdddc). The resolver arrived with Agent-friendly documentation: .md companions, llms.txt, coding-agent guide (HF-154) #1703 and substitutes an allowlist of injected keys, so without this the built .md companions and llms-full.txt shipped the raw mustache while the HTML rendered the number.

Verification

docs:build renders the real counts (functions / languages), including inside markdown link text, with no un-rendered {{ }} in the built output. Docs-only + docs-build-config → no CHANGELOG per DEV_DOCS DoD.

Known nuance

README.md counts stay hand-edited — it is rendered by GitHub and npm, neither of which runs VuePress, so {{ $page.* }} would publish literally. The language count is therefore guarded rather than interpolated: the docs build fails if README disagrees with the barrel, or if the <n> built-in languages phrase disappears. Verified both failure modes. The function count needs no guard — "over 400" is chosen so the line does not restale as functions grow. The localizing-functions.md language table rows remain hand-maintained.

The guard couples the docs build to README.md, which is a deliberate trade: the alternative was generating README as a build product, and it is a file people edit directly.

ClickUp task: https://app.clickup.com/t/9015210959/HF-282

Update (28.08 rebase): develop replaced docs/guide/built-in-functions.md with a generated page (template docs/guide/built-in-functions.tmpl.md + generator, HF-249/#1692). This PR's one-line change to that page now lives in the template — the generator copies prose verbatim, and npm run docs:build renders {{ $page.languagesCount }} correctly in the generated output (verified: zero unrendered mustaches in dist/). Commit SHAs in this description refer to the rebased branch.


Note

Low Risk
Docs and VuePress build configuration only; no runtime library or API behavior changes.

Overview
Stops hardcoded function and language totals in docs and the root README from drifting when the catalogue or i18n packs change.

VuePress now derives languagesCount at config load from src/i18n/languages (with a barrel re-export check) and injects {{ $page.languagesCount }} alongside the existing function count. The function total is computed once via getAvailableFunctions() on a default-config engine—the same approach as script/generate-builtin-functions-doc.ts—instead of getRegisteredFunctionNames, so the headline number matches the generated built-in-functions table. Guide pages, index, and integration previews swap ~400 / 400+ and 17 / 18 for {{ $page.functionsCount }} and {{ $page.languagesCount }}; the md-companions allowlist resolves languagesCount in shipped .md / llms-full.txt.

README.md (GitHub/npm, no VuePress) is updated manually to over 400 functions and 18 languages; the docs build fails if the i18n features bullet’s language number disagrees with the derived count.

Reviewed by Cursor Bugbot for commit ea8e6a4. Bugbot is set up for automated code reviews on this repo. Configure here.

@netlify

netlify Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hyperformula-dev-docs ready!

Name Link
🔨 Latest commit 474c21a
🔍 Latest deploy log https://app.netlify.com/projects/hyperformula-dev-docs/deploys/6a68b8f63a267600080a8ba7
😎 Deploy Preview https://deploy-preview-1715--hyperformula-dev-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@qunabu

qunabu commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Performance comparison of head (ea8e6a4) vs base (f9c50c1)

                                     testName |    base |    head | change
--------------------------------------------------------------------------
                                      Sheet A |  496.65 |  502.29 | +1.14%
                                      Sheet B |  164.56 |  163.52 | -0.63%
                                      Sheet T |  145.97 |  138.44 | -5.16%
                                Column ranges |  483.83 |  474.46 | -1.94%
                                Sorted lookup | 14346.3 | 14059.4 | -2.00%
Sheet A:  change value, add/remove row/column |   16.31 |   15.93 | -2.33%
 Sheet B: change value, add/remove row/column |  144.51 |  142.86 | -1.14%
                   Column ranges - add column |  158.53 |  159.06 | +0.33%
                Column ranges - without batch |   497.2 |  490.11 | -1.43%
                        Column ranges - batch |  120.95 |  123.03 | +1.72%

@marcin-kordas-hoc
marcin-kordas-hoc marked this pull request as ready for review July 24, 2026 11:38
@marcin-kordas-hoc

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9974cda. Configure here.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 717e7f4. Configure here.

Comment thread docs/.vuepress/config.js
marcin-kordas-hoc and others added 3 commits August 27, 2026 08:05
The function count already auto-derived via {{ $page.functionsCount }};
add a parallel {{ $page.languagesCount }} sourced from the i18n export
barrel (src/i18n/languages/index.ts), and swap the remaining hardcoded
counts to the interpolated variables.

- config.js: derive languagesCount once at module load from the barrel
  (whitespace-tolerant regex + fail-loud guard so a barrel reformat can
  never silently publish "0 languages"); inject $page.languagesCount.
- docs: ~400/400+ -> {{ $page.functionsCount }} (index, ai-sdk,
  mcp-server, langchain); 17/18 -> {{ $page.languagesCount }}
  (index, built-in-functions, i18n-features, localizing-functions).
- README (not a VuePress page): manual "over 400" + "18" (drift-resistant).

Verified via docs:build: renders 418 functions / 18 languages, incl.
inside markdown link text, with no un-rendered mustache in dist.
Docs-only + docs-build-config: no CHANGELOG per DEV_DOCS DoD.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The companion resolver added in #1703 substitutes `{{ $page.* }}` only for an
allowlist of injected keys. `languagesCount` was not on it, so the built `.md`
companions and `llms-full.txt` shipped the raw mustache while the HTML rendered
the number -- visible only after rebasing onto develop, which is where the
resolver came from.

Verified on a full docs:build: no `$page.` remains anywhere in dist; index.md,
localizing-functions.md, i18n-features.md, built-in-functions.md and
llms-full.txt all carry the resolved count.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The root README.md is rendered by GitHub and npm, not VuePress, so it cannot use
the `{{ $page.languagesCount }}` interpolation and states the count literally.
That number already rotted once: the Indonesian pack (#1674) left the README
saying 17.

Check it at config load against the same barrel the interpolation derives from,
and fail the docs build on a mismatch or on the phrase disappearing. The function
count needs no equivalent check -- "over 400" stays true as functions are added.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
hyperformula-docs ea8e6a4 Commit Preview URL

Branch Preview URL
Sep 02 2026, 02:16 PM

@qunabu

qunabu commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Comment thread docs/.vuepress/config.js Outdated
cursoragent and others added 4 commits September 2, 2026 10:35
Use getAvailableFunctions() instead of getRegisteredFunctionNames() to
derive the function count in config.js for consistency with the docs
generation script (generate-builtin-functions-doc.ts).

Both methods return the same count (423), but getAvailableFunctions is
the recommended metadata API and ensures the count source stays aligned
with the built-in functions page table generator.

Co-authored-by: Kuba Sekowski <sequba@users.noreply.github.com>
Conflict: README.md features list. develop (#1751) rewrote every docs URL
to include the /docs/ base; this branch changed two counts in the same
lines ("~400" -> "over 400", 17 -> 18 built-in languages). Resolved by
taking develop's URLs with this branch's counts.

The 18 is required by the assertion in docs/.vuepress/config.js, which
checks README.md against src/i18n/languages/index.ts; develop's 17 was
stale (the Indonesian pack landed in #1674).

Verified with a full `npm run docs:build`: exit 0, index/guide pages and
the .md companions render 423 functions / 18 languages, and no
unresolved `{{ $page.* }}` remains in the built HTML, .md or llms-full.txt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYPSYJTXUDSqycT2HtX3zV
Brings in #1733 (AVERAGEIF zero results). No conflict — it touches
CHANGELOG.md and src/interpreter/plugin/ConditionalAggregationPlugin.ts,
neither of which this branch changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYPSYJTXUDSqycT2HtX3zV
… README check

Four review fixes to the count derivation, all in docs build config.

Language count no longer depends on how the i18n barrel is punctuated. It was
matched with /^export \{\s*default as \w+\}/gm, which tolerates whitespace after
the brace but not before it: `export { default as ukUA }` is the same export to
TypeScript, yet the regex missed it and the total silently stayed at 18 while 19
shipped. Nothing caught that -- the zero-check only trips at zero, and README
still agreed with the wrong number. No object-curly-spacing rule exists to keep
the spacing uniform either. Counted by listing src/i18n/languages instead, which
no formatting can change.

Because listing the directory counts what is present rather than what ships, the
opposite error becomes possible -- a module nobody re-exported would overstate
the total -- so the codes are cross-checked against the barrel by name (no brace
matching) and a missing export now fails the build with the codes named.

README assertion anchored on the features bullet that links to the i18n guide,
and fenced blocks skipped. `String.match` without /g returns the first hit
anywhere in the file, so a fenced example or a sentence about an older release
won the match and the error then reported a count from a line that was never the
claim, sending the reader to correct text that was already right.

The engine behind functionsCount is built once at config load rather than inside
extendPageData, which runs per page; the count is invariant. Its comment now
also records why the license key is named, pointing at the fuller note in
generate-builtin-functions-doc.ts.

Two comments in script/ described the total as coming from the global registry
"computed independently" of the generator. Since it moved to
getAvailableFunctions that is no longer what happens, and the thing worth
flagging is what remains true: the two engines are separate call sites whose
options have to stay in step.

Verified: `npm run docs:build` exits 0; index and guide pages, the .md
companions and llms-full.txt all render 423 functions / 18 languages, with the
generated table at 423 rows and no unresolved mustaches in the output. The new
counting logic was exercised against compact, spaced and multi-line barrels
(18 each), an unexported module and an empty directory (both throw). The two
README cases that previously mis-blamed a correct line now load, while a
genuinely stale bullet and a removed phrase both still fail.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYPSYJTXUDSqycT2HtX3zV
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.32%. Comparing base (f9c50c1) to head (ea8e6a4).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1715   +/-   ##
========================================
  Coverage    97.32%   97.32%           
========================================
  Files          195      195           
  Lines        15739    15739           
  Branches      3390     3390           
========================================
  Hits         15318    15318           
  Misses         421      421           
🚀 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.

@sequba
sequba merged commit c920375 into develop Sep 2, 2026
34 checks passed
@sequba
sequba deleted the feat/hf-282-docs-counts branch September 2, 2026 18:54
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.

5 participants