Skip to content

feat(deep): add sequential async traversal and stable path sorting - #254

Merged
andrewzolotukhin merged 1 commit into
developmentfrom
feat/deep-traversal-and-sort
Oct 17, 2026
Merged

andrewzolotukhin merged 1 commit into
developmentfrom
feat/deep-traversal-and-sort

Conversation

@andrewzolotukhin

@andrewzolotukhin andrewzolotukhin commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add documented reusable operations for sequential tree work and sorting records by a numeric position within a path array. Async visitor failures now propagate; skipped subtrees do not skip later siblings. Sorting validates depth against each path rather than the number of records and checks all keys before mutating the input.

Original request

Move the async deep traversal and numeric path sorting helpers into @cleverbrush/deep as a separate PR with documentation and unit tests.

What changed

  • Exported deepForEachAsync(input, visitor, context?, options?) and its typed child-selection/filtering options.
  • Defined parent-before-child sequential traversal, plain-record/array boundaries, repeated-reference handling, active-path cycle rejection and visitor failure propagation.
  • Exported stable, in-place deepSort(items, index, field) with explicit invalid-index/value errors and validation before mutation.
  • Added package README/JSDoc, a minor changeset and 25 focused cases.

Reasoning

These helpers operate on generic data and belong in the deep package. Keeping explicit traversal/mutation contracts avoids undocumented behavior, hanging promises and sorting mistakes in consumers.

Type of Change

  • New feature
  • Documentation update

Blog post

Skipped: internal data-processing infrastructure API; the package README and JSDoc document the feature.

Screenshots / preview evidence

Not applicable: no UI or demo behavior changes. Consumer editor and rendering verification belongs to its integration PR.

Validation

  • npm run lint, npm run build, npm run test: pass.
  • Full suite: 299 files, 5,363 tests, no type errors.
  • npm run test:coverage: all published-package floors pass; both new helpers have 100% lines/statements/functions/branches.
  • CI run: all required jobs pass, including lint/build/test/coverage/package checks, PostgreSQL integration, Garage storage, and demo API/browser/telemetry E2E.

Checklist

  • Added tests
  • Ran lint
  • Ran build and test
  • Added a changeset

@andrewzolotukhin
andrewzolotukhin merged commit 199250b into development Oct 17, 2026
5 checks passed
@andrewzolotukhin
andrewzolotukhin deleted the feat/deep-traversal-and-sort branch October 17, 2026 11:28
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