Skip to content

refactor(page-tree): reuse traversal selectors in form analysis#81

Merged
DavidBabinec merged 1 commit into
mainfrom
refactor/page-tree-traversal-helpers
Jun 26, 2026
Merged

refactor(page-tree): reuse traversal selectors in form analysis#81
DavidBabinec merged 1 commit into
mainfrom
refactor/page-tree-traversal-helpers

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

What changed

  • Replaced local recursive form tree walkers with flattenSubtree from @core/page-tree.
  • Replaced the editor form analyzer's derived child-scan parent map with getParent, using the canonical parent index maintained by page-tree parsing/mutation boundaries.
  • Added an architecture regression to prevent these form modules from reintroducing local tree-walk/parent-map helpers.
  • Updated form analyzer fixtures to stamp parentId via reindexNodeParents, matching the production page-tree invariant.

Why

Form publishing and editor-side form settings had their own tree traversal and parent lookup implementations. That duplicated logic bypassed the cycle-safe page-tree selector path and obscured the parentId source-of-truth invariant.

Impact

Form snapshot generation and form settings analysis now depend on the same page-tree selector primitives as the rest of the editor engine. The form-specific inference behavior is unchanged and covered by existing tests.

Verification

  • bun test src/__tests__/architecture/page-tree-single-source.test.ts red before implementation, then passing
  • bun test src/__tests__/forms/formSnapshot.test.ts src/__tests__/forms/formSettingsAnalysis.test.ts
  • bun run build
  • bun test
  • bun run lint
@DavidBabinec DavidBabinec marked this pull request as ready for review June 26, 2026 15:03
@DavidBabinec DavidBabinec merged commit 0e0121f into main Jun 26, 2026
6 checks passed
@DavidBabinec DavidBabinec deleted the refactor/page-tree-traversal-helpers branch June 30, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant