docs: clarify setRowOrder/setColumnOrder permutation semantics#1687
Open
sequba wants to merge 7 commits into
Open
docs: clarify setRowOrder/setColumnOrder permutation semantics#1687sequba wants to merge 7 commits into
sequba wants to merge 7 commits into
Conversation
* Fix package-lock file * Docs: remove CodeSandbox embedded demos and add links to working exa,ples in Stackblitz (#1621)
<!-- CURSOR_SUMMARY --> > [!NOTE] > **Low Risk** > Low risk documentation-only changes: adds new guide pages and adjusts VuePress sidebar navigation with no runtime or API impact. > > **Overview** > Adds three new AI-focused documentation pages: `ai-sdk`, `integration-with-langchain`, and `mcp-server`, describing how to use HyperFormula for deterministic spreadsheet computation in agent workflows. > > Updates the VuePress guide sidebar to surface these pages under **Integrations**, renames the section from *Framework integration* to *Integrations*, and moves the former *Overview* links into a new *About* section. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 54c541b. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: GreenFlux <support@greenflux.us> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
The existing examples for setRowOrder and setColumnOrder used self-inverse permutations like [2, 1, 0] or [0, 3, 2, 1]. These produce the same output under either interpretation of the permutation argument: A. newOrder[i] = new position for the row/column currently at index i B. newOrder[i] = previous position of the row/column ending up at index i The implementation uses interpretation A, but the old examples did not disambiguate, leading users to assume interpretation B (issue #1668). This change replaces the examples with non-self-inverse cyclic shifts ([1, 2, 0] on a 3-element sheet) and adds explicit prose explaining the semantics in both the JSDoc and the guide pages. Updates apply to: - API JSDoc for setRowOrder, isItPossibleToSetRowOrder, setColumnOrder and isItPossibleToSetColumnOrder in src/HyperFormula.ts - docs/guide/sorting-data.md (intro, row and column step-by-step sections, with new warning callouts) - docs/guide/basic-operations.md (Reordering rows and columns subsections) - CHANGELOG.md entry under [Unreleased] Co-authored-by: Kuba Sekowski <sequba@users.noreply.github.com>
✅ Deploy Preview for hyperformula-dev-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Documentation-only changes don't need a CHANGELOG.md entry. Remove the entry added for the setRowOrder docs clarification and add a note to DEV_DOCS.md spelling out the convention so future contributors know. Co-authored-by: Kuba Sekowski <sequba@users.noreply.github.com>
sequba
commented
Jun 2, 2026
Contributor
Author
sequba
left a comment
There was a problem hiding this comment.
@cursoragent fix it
Address review feedback: move the note as a sub-bullet under '- changelog entry' instead of a separate section. Co-authored-by: Kuba Sekowski <sequba@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1687 +/- ##
========================================
Coverage 97.16% 97.16%
========================================
Files 176 176
Lines 15322 15322
Branches 3356 3356
========================================
Hits 14887 14887
Misses 427 427
Partials 8 8
🚀 New features to boost your workflow:
|
Performance comparison of head (9be0229) vs base (00e5c73) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Context
Fixes #1668. The reporter ran
setRowOrderexpecting the array argument to mean "previous position for each new row", got the opposite behavior, and was unable to disambiguate from the docs.Root cause: every example in the JSDoc and guide pages used a self-inverse permutation (
[2, 1, 0]on 3 rows,[0, 3, 2, 1]on 4 rows). Self-inverse permutations produce the same output under both of the two natural interpretations of the argument:newOrder[i]= new position for the row/column currently at indexi(this is the actual behavior, verified inmappingFromOrderinsrc/CrudOperations.tsandOperations.setRowOrderinsrc/Operations.ts)newOrder[i]= previous position of the row/column that should end up at indexiSo the examples didn't actually demonstrate which interpretation was correct.
Changes
Doc-only. No runtime behavior changed.
[1, 2, 0]on a 3-element sheet → result[['C'], ['A'], ['B']]). Under interpretation B the result would have been[['B'], ['C'], ['A']], so the example now visibly reinforces the correct semantics.iis the new position for the row/column currently at indexi".::: warningcallout in the sorting guide explicitly contrasting the correct interpretation with the inverse-permutation interpretation that the reporter assumed.setColumnOrder/isItPossibleToSetColumnOrderdocumentation for consistency.DEV_DOCS.mdclarifying that documentation-only PRs do not require aCHANGELOG.mdentry.Files touched:
src/HyperFormula.ts- JSDoc forsetRowOrder,isItPossibleToSetRowOrder,setColumnOrder,isItPossibleToSetColumnOrder.docs/guide/sorting-data.md- intro paragraph, "Sorting rows" and "Sorting columns" step-by-step sections.docs/guide/basic-operations.md- "Reordering rows" and "Reordering columns" subsections.DEV_DOCS.md- new "Documentation-only changes" note under "Definition of Done".Out of scope:
swapRowIndexes/swapColumnIndexesuse[[source, target], ...]pairs and are already described as "array mapping original positions to final positions"; the ambiguity does not apply, so those are untouched.How did you test your changes?
npm run lint- 0 errors (pre-existing warnings in tests are unrelated).npm run compile- clean TypeScript compile.Types of changes
Related issues:
setRowOrderis unclear #1668Checklist: