Repository navigation
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR adds sidebar-aware item ordering to documentation generation. A new ChangesDocumentation generation item ordering
Sequence Diagram(s)sequenceDiagram
participant User
participant GenerateDocs as Generate Docs Handler
participant Utility as sortItemsBySidebarOrder
participant CollectionCopy as Cloned Collection
participant ExportFlow as Export/Serialize
User->>GenerateDocs: Click "Generate Documentation"
GenerateDocs->>CollectionCopy: Deep clone collection
GenerateDocs->>Utility: Sort items
Utility->>Utility: Filter transient
Utility->>Utility: Separate folders/requests
Utility->>Utility: Sort each group
Utility->>Utility: Recurse nested items
Utility->>CollectionCopy: Return sorted structure
GenerateDocs->>ExportFlow: Export sorted collection
ExportFlow->>ExportFlow: Serialize to HTML
ExportFlow->>User: Download documentation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/bruno-app/src/utils/common/sort-items-by-sidebar-order.spec.js (1)
1-2: ⚡ Quick winTest file location doesn't match function location.
The test file is at
packages/bruno-app/src/utils/common/sort-items-by-sidebar-order.spec.jsbut the function under test is inpackages/bruno-app/src/utils/collections/index.js.Consider moving this test file to
packages/bruno-app/src/utils/collections/sort-items-by-sidebar-order.spec.jsto co-locate it with the function being tested, improving discoverability and maintainability.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/utils/common/sort-items-by-sidebar-order.spec.js` around lines 1 - 2, Move the spec to live next to the implementation: relocate the test file named sort-items-by-sidebar-order.spec.js into the same folder containing the collections index module so it directly tests sortItemsBySidebarOrder; update its require/import to reference ../index (or the local module) if necessary and run tests to ensure paths resolve correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/bruno-app/src/utils/collections/index.js`:
- Around line 891-905: The JSDoc claims code/data files are preserved but
sortItemsBySidebarOrder currently only keeps folders and requests (using
sortByNameThenSequence, isItemAFolder, isItemARequest) and drops other item
types; update the function to collect "other" items (those not matching
isItemAFolder and not matching isItemARequest), preserve their original order,
and include them after requestItems when building the returned array (still
recursively sorting folder.items via sortItemsBySidebarOrder), or alternatively
update the JSDoc to reflect that only folders and requests are preserved — pick
the behavior you want and make the code or JSDoc consistent with
sortItemsBySidebarOrder.
In `@tests/collection/generate-docs/generate-docs.spec.ts`:
- Around line 55-66: The test fallback uses new Function(...) when
JSON.parse(literal) fails because jsesc emitted JS-only escapes; instead
configure jsesc in GenerateDocumentation/index.js to produce JSON-compatible
output (e.g., enable the json option / disable JS-only escapes) so the literal
is always valid JSON, then remove the catch fallback in generate-docs.spec.ts
(the literal / yamlContent flow) and rely solely on JSON.parse; if you cannot
guarantee JSON-compatible output, add a brief comment in generate-docs.spec.ts
explaining why using new Function is safe in this controlled test context and
keep the fallback.
---
Nitpick comments:
In `@packages/bruno-app/src/utils/common/sort-items-by-sidebar-order.spec.js`:
- Around line 1-2: Move the spec to live next to the implementation: relocate
the test file named sort-items-by-sidebar-order.spec.js into the same folder
containing the collections index module so it directly tests
sortItemsBySidebarOrder; update its require/import to reference ../index (or the
local module) if necessary and run tests to ensure paths resolve correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 79b826b2-6162-46f1-9871-398476dc0dd6
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (18)
package.jsonpackages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/index.jspackages/bruno-app/src/utils/collections/index.jspackages/bruno-app/src/utils/common/sort-items-by-sidebar-order.spec.jstests/collection/generate-docs/fixtures/collection/Aviary/Parrot.brutests/collection/generate-docs/fixtures/collection/Aviary/folder.brutests/collection/generate-docs/fixtures/collection/ReqAlpha.brutests/collection/generate-docs/fixtures/collection/ReqBeta.brutests/collection/generate-docs/fixtures/collection/Zoo/Bear.brutests/collection/generate-docs/fixtures/collection/Zoo/Lion.brutests/collection/generate-docs/fixtures/collection/Zoo/Reptiles/Gecko.brutests/collection/generate-docs/fixtures/collection/Zoo/Reptiles/Snake.brutests/collection/generate-docs/fixtures/collection/Zoo/Reptiles/folder.brutests/collection/generate-docs/fixtures/collection/Zoo/folder.brutests/collection/generate-docs/fixtures/collection/bruno.jsontests/collection/generate-docs/generate-docs.spec.tstests/collection/generate-docs/init-user-data/preferences.jsontests/utils/page/actions.ts
Description
A user organizes their Bruno collection with folders ordered using the seq attribute. When they run "Generate Docs", they expect the HTML output to reflect that order. Today the order is non-deterministic — each regeneration produces a different folder order in the rendered output and in the JSON blob embedded in the HTML.
JIRA
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
Bug Fixes
Tests
Chores