Skip to content

feat(react-draggable): add exact Octane binding - #556

Closed
jonkwheeler wants to merge 68 commits into
octanejs:mainfrom
jonkwheeler:jon/react-draggable-binding
Closed

jonkwheeler wants to merge 68 commits into
octanejs:mainfrom
jonkwheeler:jon/react-draggable-binding

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Octane applications can now migrate from [email protected] without giving up the root Draggable API, DraggableCore, controlled and uncontrolled movement, bounds, grid snapping, SVG transforms, mouse/touch behavior, SSR, or hydration.
  • The package preserves the legacy callable CommonJS root while exposing the same default and named exports through ESM, with no React runtime in the installed consumer graph.

Why

  • React Draggable is a common package-level migration blocker. This port keeps its public contract and observable behavior while requiring an explicit nodeRef, matching the upstream modern API boundary.
  • The parity ledger maps every pinned upstream component case to one unique public-package test identity and records upstream-private utility tests as implementation evidence rather than pretending private seams are public compatibility.

Changes

  • Adds the complete @octanejs/react-draggable package, provenance lock, migration docs, release metadata, generated catalogs, playground example, and package-condition support.
  • Exercises public-root runtime, React differential, SSR, hydration, type, Chromium, Firefox, owner-document, ShadowRoot, cleanup, error-retention, and overlapping-input behavior.
  • Adds reusable callable-default CommonJS packaging and compiler-backed packed-ESM validation. The repository-wide pieces remain in prerequisite drafts and are stacked here until they merge.

Related: #548, #550, #555

Session-settled decisions carried from planning: one binding per isolated draft PR (user-directed, over multi-binding batches); exact React public-contract parity (user-approved, over similar-but-different APIs); agent-authored PRs remain draft for maintainer promotion (user-directed, over agent readiness promotion).

Validation

  • pnpm format:check (targeted changed-file formatting passed; repo-wide formatting was not rerun)
  • pnpm typecheck (pristine tsc and adapted tsrx-tsc projects passed; repo-wide typecheck was not rerun)
  • pnpm test (targeted projects and workflow tests passed; repo-wide test was not rerun)
  • targeted tests: 8 runtime/SSR/hydration/differential/feasibility files, 92 tests
  • upstream audit: 58 pinned artifacts, 204 unit/type cases, 23 browser cases, 40 type assertions, and 15 fail-closed controls
  • browser parity: Chromium 2/2 and Firefox 2/2
  • React parity metadata: 5,345 stable and 5,413 canary cases current
  • packaging: 70 tarballs, 583 raw TSRX sources, callable CommonJS/ESM export parity, executed SSR, external examples, and no React runtime
  • CI workflow and browser-selector guards: 46 focused tests

Risk / follow-ups

Provenance

  • An agent produced this diff (agent-authored)

Compound Engineering


Note

Medium Risk
Large new public drag API with native input, SSR/hydration, and cross-browser behavior, plus export-map changes for core UI packages; mitigated by extensive parity/audit lanes but still stacked on prerequisite PRs per the description.

Overview
Introduces @octanejs/react-draggable as a port of [email protected] (Draggable, DraggableCore, bounds/grid/axis, mouse/touch, SSR/hydration) with React differential, browser, audit, CLI/MCP migration (react-draggable → @octanejs/react-draggable), playground demo, and generated binding/package docs.

Packaging and compiler: Publishes executable CommonJS require conditions (with build:cjs / prepack) for octane, @octanejs/floating-ui, @octanejs/base-ui, and @octanejs/radix while keeping ESM/source-first exports; the new binding uses callable-default CJS. A separate octane patch adds compiler-visible descriptor children for bindings that clone/inspect TSЯX children.

CI and browsers: Heavy integration browser work splits into Chromium and Firefox matrix jobs, discovers specs via scripts/discover-heavy-browser-specs.mjs, sets PLAYWRIGHT_BROWSER, and installs WebKit alongside the matrix engine. Dexie’s browser suite switches to shared launchBrowser; root adds a playwright dev dependency.

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

Define the pinned consumer contract, framework adaptations, executable parity lanes, and draft-only review lifecycle before implementation.
Vendor the exact npm and tag evidence, retain the MIT notice, and add fail-closed source, export, test, fixture, and type inventories.
Force-track the ignored build directory so the vendored npm artifact remains complete and its runtime and declaration bytes can be audited.
Characterize React 19 nodeRef timing and cleanup behavior, then prove Octane cloning, native listeners, SSR, and hydration can represent those observable contracts.
- run Three launch normalization in ordinary CI shards
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Babysit run report (pipeline)

Status: blocked-needs-human — not posting READY FOR REVIEW.

Applied this round

  • Restored upstream oracle strength in four public-root cases (dragging-class pre/post, full callback data, custom-component ref-as-prop adaptation for forwardRef, mid-drag unmount cleanup assertion).
  • Merged origin/main (no rebase/force-push) and resolved mechanical conflicts (vitest projects, CI browser install, regenerated catalogs via pnpm sync).
  • Replied + resolved the four public-root review threads.

Residual (open)

  • Browser parity evidence (parity.browser.test.ts): inventory maps 23 upstream browser cases onto two aggregate journeys. Needs maintainer call on approach (one-to-one ports vs ordinary authored journeys vs differential). Thread left open with options/lean.

Draft left unchanged. No merge.

Comment thread .github/workflows/ci.yml Resolved
Port each upstream browser.test.js case with an exact adaptedCase identity,
stop scenario-lumping in the inventory, and keep the heavy browser lane able
to run behavior-root by installing WebKit and skipping that suite on Firefox.

Co-authored-by: Cursor <[email protected]>
… case

Match upstream's default enableUserSelectHack so the adapted identity still
exercises scheduleRemoveUserSelectStyles on unmount.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Addressed leonidaz public-root and browser-parity feedback with one-for-one upstream browser identities, merged origin/main earlier, and cleared Bugbot findings on the current head.

READY FOR REVIEW

@leonidaz leonidaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React parity audit review only; no tests were run.

Comment thread packages/react-draggable/UPSTREAM.md Resolved
Comment thread packages/react-draggable/UPSTREAM.md Resolved
Inventory adapted case assertions/scenario steps, type assertion groups,
exhaustive authored-test classifications, and immutable React oracle pins so
title-only or wholesale type mappings can no longer pass the audit.

Co-authored-by: Cursor <[email protected]>

@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 ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 3cc2919. Configure here.

Inventory prop-object probes in typings.consumer.ts, record upstream JSX
probes as upstream-only, and mutation-test clearing the adapted consumer file.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Parity audit feedback addressed on the current head: adapted case structure inventories + negative controls, type assertion-group inventories with upstream-only React probes, exhaustive authored-test classifications, immutable React oracle pins, and UPSTREAM.md aligned with the allowedTransforms ledger. Bugbot is clean on this head; merge state is CLEAN.

READY FOR REVIEW

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

REVIEW WITHDRAWN

jonkwheeler and others added 2 commits August 10, 2026 09:12
Keep descriptor-children binding path; take Fragment-ref isFragmentLongForm(node, ctx).

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

return {
upstream: value.id,
kind: 'unit-case',
disposition: 'upstream-internal-implementation',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still waives 141 upstream utility cases wholesale as upstream-internal-implementation solely because their helpers are unexported. These are framework-neutral tests for the mirrored src/utils implementation, including bounds, scale, touch, focus, nonce, event-listener, grid, and data calculations. The port workflow requires framework-neutral upstream suites to run against the reused or ported core; source paths and a generic claim of public coverage are not executable counterparts, and unexported alone is not a not-applicable reason. Run these suites against the Octane utility implementation or give case-specific reasons for any genuinely inapplicable seam.

path: relativePath,
assertionGroups: groups,
assertionGroupCount: groups.length,
sha256: sha256(JSON.stringify(groups)),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type audit still does not enforce the recorded transformations structurally. This sha256 covers only the recognized assertion-group array, not the full file, and verifyReactDraggableTypes later checks only that each permittedTransformation has a kind and rule. There is no normalized upstream-to-adapted comparison; for typeCompat, required adapted groups even default to the current adapted inventory itself. Deleting or changing an unrecognized statement and regenerating inventories is therefore accepted. Hash the full files, map upstream groups to adapted groups under executable transformations, and reject every unrecorded structural change.

const resolvedConfig = config ?? readTypeParityConfig(packageRoot, { packageRoot });
const upstream = [];
const adapted = [];
for (const entry of resolvedConfig.fileDispositions) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither compiler project is parsed here, so the required type lanes still lack compiler-program membership verification. The mapped files can remain on disk and in these inventories while a narrowed include in tsconfig.pristine.json or tsconfig.adapted.json causes the corresponding compiler to check no mapped probe. Require every mapped upstream and adapted fixture to belong to its recorded parsed program and add a negative control that excludes an existing file through tsconfig.

const packageRoot = options.packageRoot
? resolve(options.packageRoot)
: resolve(rootOrPackage, 'packages/react-draggable');
const discovered = discoverPackageTests(packageRoot);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exactly-once ledger is not exhaustive for authored type tests. Discovery scans only packages/react-draggable/tests, so the two required port-authored fixtures under typetests/adapted are absent from test-classifications.json and cannot receive an adapted-type disposition. Extend discovery and the ledger to cover both runtime and type-test roots; vendored pristine type programs can retain their upstream disposition separately.

]
}
],
"divergences": []

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structured divergence ledger cannot be empty. status.json and type-parity.json already document consumer-visible differences for React synthetic events versus native mouse/touch events, React class/component and instance-ref surfaces versus function components and nodeRef, and ReactNode children. Record these as manifest divergences with the relevant runtime or type case IDs, rationale, impact, and migration guidance so the parity evidence and published status agree.

@leonidaz

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! This pull request was incorporated into main as commit 9c397a280763 through consolidated PR #699.

@leonidaz leonidaz closed this Aug 12, 2026
kotarotaniguchi0523 pushed a commit to kotarotaniguchi0523/octane that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants