Skip to content

PR: merge cherry-picking from upstream / common-v8#4

Closed
miccy wants to merge 18 commits into
loot-mainfrom
feat/cherrypick-common-v8-jan23
Closed

PR: merge cherry-picking from upstream / common-v8#4
miccy wants to merge 18 commits into
loot-mainfrom
feat/cherrypick-common-v8-jan23

Conversation

@miccy

@miccy miccy commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Closes #2.

Integration of Daniel's commits from upstream/common-v8. This PR completes Phase 1 of the roadmap.

Changes

  • Cherry-picked structured concurrency features (all, withConcurrency, etc.)
  • Added polyfills for Promise.try and Promise.withResolvers
  • Fixed TypeScript build errors (strict mode)
  • Updated documentation

See ROADMAP.md and .changeset/cherry-pick-common-v8.md for details.

Summary by CodeRabbit

  • New Features

    • Expanded task orchestration: concurrency controls, composition helpers (all, allSettled, any, forEach, withConcurrency, withResolvers), richer abort/cause and observable state, new concurrency primitives and DI-friendly task APIs; Promise polyfills added.
  • Documentation

    • Improved conventions, clearer lazy-evaluation examples, added project roadmap.
  • Bug Fixes

    • Fixed build issues from stricter type checking and aligned tests with abort schema.
  • Chores

    • Formatting/tooling tweaks, editor/vitest settings updated, CI/web workflows migrated to Bun.

✏️ Tip: You can customize this high-level summary in your review settings.

steida and others added 10 commits January 23, 2026 21:40
Adds the all() function to run multiple Tasks in parallel or sequentially, supporting arrays, tuples, structs, and iterables. Introduces withConcurrency to control the maximum number of concurrent tasks, with type-safe options and inheritance. Updates Task, Runner, and related types to support concurrency primitives, and provides comprehensive tests for all() and withConcurrency behaviors.
Introduces a polyfill for Promise.try in the react-expo example to ensure compatibility with environments where Promise.try is not available.
Corrected the 'useSqlCipher' key to 'useSQLCipher' in the expo-sqlite configuration to match the expected property name.
Introduces new helpers for advanced task composition: `allSettled`, `forEach`, `forEachSettled`, and `any`, each with their own abort error types. Refactors `all` and `race` to use a shared concurrent worker pool implementation that respects concurrency limits and abort propagation. Updates documentation and tests to cover new helpers, concurrency inheritance, abort handling, and type preservation for tuples, structs, and arrays. Improves `Runner.onAbort` to invoke callbacks immediately if already aborted and ensures proper event listener cleanup.
Introduces Int1To99 and Int1To100 types for numeric literals, along with a helper type NumberFromString to parse numbers from string literal types. These additions enhance type safety for numeric ranges.
@coderabbitai

coderabbitai Bot commented Jan 23, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Cherry-pick introduces a large DI- and structured-concurrency refactor to Task (new lifecycle, abort-cause semantics, many composition helpers), Promise polyfills, docs/ROADMAP updates, VSCode/CI moved to Bun, TestDeps extended with ConsoleDep, plus assorted import/formatting tweaks and small API re-exports.

Changes

Cohort / File(s) Summary
Changeset & Roadmap
\.changeset/cherry-pick-common-v8.md, README.md, ROADMAP.md
New changeset and roadmap entries documenting the bump, Task helpers (allSettled, forEach, any, withConcurrency), docs/ conventions updates, and phased refactor plan (arrayFrom breaking change).
Core Task Module
packages/common/src/Task.ts
Major refactor to DI-friendly, structured-concurrency Task model: AbortError uses cause; Runner/Fiber lifecycle reworked with state/snapshot model and abort(cause?); new public types/utilities (AnyTask, InferTask*, withResolvers, withConcurrency, all/allSettled/any/race/forEach/timeout/retry/repeat), concurrency primitives, event/snapshot model, updated RunnerDeps.
Task docs & small API edits
packages/common/src/Function.ts, packages/common/src/Option.ts
Documentation clarification for lazy() and whitespace/formatting adjustments in Option.ts (no behavior change).
Test deps & Tests
packages/common/src/Test.ts, packages/common/test/*, packages/common/test/local-first/Protocol.test.ts, packages/common/test/Option.test.ts, packages/common/test/Assert.test.ts
Added ConsoleDep to TestDeps and createTestDeps (uses testCreateConsole()); createTestRunner casts merged defaults as any as D; tests mostly formatting; Assert.test.ts updated to expect cause instead of reason; some casts added in Protocol tests.
Examples & Polyfills
examples/react-expo/app.json, examples/react-expo/polyfills.ts
app.json reformatted; added Promise.try polyfill (alongside existing Promise.withResolvers).
Docs site content
apps/web/src/app/(docs)/docs/conventions/page.mdx
Minor wording/formatting tweaks in Arrow functions docs.
Editor & CI config
.vscode/settings.json, .github/workflows/ci.yaml, .github/workflows/web-build.yaml
Per-language VSCode formatter overrides commented out; added vitest.disableWorkspaceWarning; CI/workflows migrated from Node/pnpm to Bun (oven-sh/setup-bun@v2, bun install, bun x playwright install --with-deps, bun run ...).
Platform drivers & local no-ops
packages/nodejs/src/BetterSqliteDriver.ts, packages/react-native/src/sqlite-drivers/createOpSqliteDriver.ts, packages/react/src/useEvoluError.ts, packages/react/src/useIsSsr.ts, packages/react/src/useQuerySubscription.ts
Replaced imports of small helpers (constVoid/constNull/constTrue/constFalse) with local no-op implementations; swapped a cache-miss callback to () => {}; moved some imports between @evolu/common and @evolu/common/local-first.
Index export change
packages/common/src/index.ts
Added value export emptyRows alongside existing type exports from local-first/Query.js.
Miscellaneous formatting & metadata
.agent/*, examples/*, tests, small files
New agent lists (cherry candidates, phase subjects), various whitespace/indent/import-order edits across examples and tests.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Runner
  participant Fiber
  participant Deps as "Deps (Time/Console/Random)"
  participant Abort as "AbortSignal/Cause"

  Client->>Runner: create/run Task<T,E,D>
  Runner->>Deps: resolve injected deps
  Runner->>Fiber: spawn fiber with run closure
  Fiber->>Deps: use injected deps during execution
  note right of Fiber: state: pending → running → done/aborted
  Abort->>Runner: signal abort(cause)
  Runner->>Fiber: propagate abort(cause)
  Fiber->>Client: emit RunnerEvent / Snapshot update
  Fiber-->>Runner: finalize result or error (with cause)
  Runner->>Client: deliver final FiberSnapshot / result
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐇 I nibbled code, rewired each task and clause,
Causes carried where reasons used to stay,
Concurrency hops through fences and draws,
Promises tucked with tricks to start the day,
The rabbit cheers — the runner finds its way.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@miccy miccy self-assigned this Jan 24, 2026
@miccy miccy added docs Improvements or additions to documentation upstream Needs cherry-pick or merge from upstream update Update libs and deps labels Jan 24, 2026
@miccy miccy changed the title feat: cherry-pick strict build fixes from upstream/common-v8 PR: merge cherry-picking from upstream / common-v8 Jan 24, 2026
…ubjects.txt` containing lists of commit subjects.
@miccy
miccy requested a review from Copilot January 28, 2026 10:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@miccy miccy closed this Feb 2, 2026
@miccy
miccy deleted the feat/cherrypick-common-v8-jan23 branch February 10, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation update Update libs and deps upstream Needs cherry-pick or merge from upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 1: Cherry-pick common-v8 & Fix Build Errors

3 participants