Skip to content

feat: extract private scheduler package and prove inlining - #340

Open
draedful wants to merge 1 commit into
v2from
codex/321-private-scheduler
Open

feat: extract private scheduler package and prove inlining#340
draedful wants to merge 1 commit into
v2from
codex/321-private-scheduler

Conversation

@draedful

@draedful draedful commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • move the scheduler implementation, tests, lint, and typecheck ownership into a private workspace package
  • keep ESchedulerPriority, schedule, debounce, and throttle publicly owned and exported only by @gravity-ui/graph
  • make the production build prove that the private scheduler is a workspace input and is fully inlined
  • extend the packed-package contract with manifest, generated-artifact, native-import, and isolated-consumer invariants

Validation

  • CI=1 pnpm install --frozen-lockfile
  • pnpm run lint
  • pnpm run typecheck
  • pnpm run test
  • pnpm run build-storybook
  • pnpm run test:package-contract
  • CI=1 pnpm run test:e2e:ci — 186 passed

Closes #321

Summary by Sourcery

Extract the scheduler into a private workspace package while preserving the public graph scheduler API and enforcing that the implementation is fully inlined into published output.

New Features:

  • Expose the scheduler priority type and scheduling utilities through the public @gravity-ui/graph package while keeping their implementation private.

Enhancements:

  • Extract scheduler functionality into a dedicated private workspace package and delegate the graph package’s public scheduler contracts to it.
  • Enforce production-build inlining and prevent private scheduler references from appearing in published artifacts or isolated consumers.

Build:

  • Update workspace build, lint, typecheck, and test ownership to include the private scheduler package.

Documentation:

  • Extend the package contract documentation to cover private scheduler isolation, public scheduler exports, and generated-artifact invariants.

Tests:

  • Add scheduler unit coverage and expand package-contract checks for exports, manifests, generated artifacts, native imports, and isolated consumers.

@draedful
draedful requested a review from Antamansid as a code owner August 26, 2026 15:18
@sourcery-ai

sourcery-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR relocates scheduler behavior and tests into a private workspace package, keeps the scheduler types and APIs publicly owned by @gravity-ui/graph through typed delegation, and adds build-time plus packed-package checks proving the implementation is inlined without leaking the private dependency to published artifacts or isolated consumers.

File-Level Changes

Change Details Files
Extract scheduler implementation into a private workspace package while preserving the public scheduler API in the graph package.
  • Move scheduler, scheduling helpers, and their unit tests into @gravity-ui/graph-scheduler.
  • Replace graph-owned implementations with typed delegating exports and retain public declarations for scheduler contracts.
  • Update workspace lint, typecheck, and test ownership plus development rebuild watching.
package.json
packages/graph/package.json
packages/graph/src/lib/Scheduler.ts
packages/graph/src/utils/utils/schedule.ts
packages/graph/src/utils/utils/schedule.test.ts
packages/scheduler/.eslintrc
packages/scheduler/jest.config.cjs
packages/scheduler/package.json
packages/scheduler/src/index.ts
packages/scheduler/src/Scheduler.ts
packages/scheduler/src/Scheduler.test.ts
packages/scheduler/src/schedule.ts
packages/scheduler/src/schedule.test.ts
packages/scheduler/tsconfig.json
pnpm-lock.yaml
Enforce that the private scheduler is a build-only input and is completely inlined into production artifacts.
  • Resolve the workspace package explicitly during esbuild configuration and exempt it from generic bundled-dependency failures.
  • Validate that it is private, declared via a workspace devDependency, included in metafile inputs, and absent from unresolved output imports.
  • Keep production bundles free of other unintended bundled packages.
packages/graph/scripts/build.mjs
packages/graph/package.json
Strengthen packed-package and public API contract coverage for scheduler encapsulation.
  • Check generated JavaScript and declaration files for private scheduler specifiers.
  • Verify packed manifests and isolated consumers do not expose or install the private package.
  • Add runtime and Node ESM type probes for the public scheduler exports.
packages/graph/tests/package-contract/README.md
packages/graph/tests/package-contract/checks/artifact.mjs
packages/graph/tests/package-contract/checks/runtime.mjs
packages/graph/tests/package-contract/fixtures/types/node-esm/index.mts

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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