Skip to content

feat(linear): add Worker-safe planner contract - #230

Open
khaliqgant wants to merge 2 commits into
mainfrom
feat/linear-worker-planner-contract
Open

feat(linear): add Worker-safe planner contract#230
khaliqgant wants to merge 2 commits into
mainfrom
feat/linear-worker-planner-contract

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

  • add the dependency-free @relayfile/adapter-linear/planner-contract subpath
  • expose exactly four public symbols: LINEAR_OBJECT_TYPES, normalizeNangoLinearModel, linearStatePath, and linearStatesIndexPath
  • preserve the existing LinearPathObjectType API only from path-mapper, which re-exports the same four planner bindings for compatibility
  • bundle the public package self-reference with esbuild under Worker/browser conditions and assert its full runtime graph contains only dist/planner-contract.js and no Node built-ins
  • reject inherited object-prototype lookup keys via own-property checks
  • keep the purity harness portable by converting module URLs with fileURLToPath

The prototype-key hardening and adversarial cases incorporate the valid issue identified during comparison with the closed duplicate PR #229 (Gemini review comment: #229 (comment)).

Validation

  • clean npm ci in a dedicated worktree (no shared/symlinked node_modules)
  • npx turbo build — 49/49 packages
  • npm run build -w @relayfile/adapter-linear
  • npm run typecheck -w @relayfile/adapter-linear
  • npm test -w @relayfile/adapter-linear — 165/165
  • Worker-conditioned package self-import — exact four runtime exports
  • declaration output — exactly four public export declarations; no public planner type export
  • npm pack -w @relayfile/adapter-linear --dry-run --json — runtime and declaration artifacts included
  • npx turbo build typecheck test — 147/147 tasks on exact head
  • npm test — writeback discovery, digest contracts, catalog checks, and 99/99 tasks on exact head

Release / follow-up

This is PR 1 of AgentWorkforce/cloud#2556. Package versions are intentionally unchanged: after merge, the repository publish workflow must patch-publish linear, then the real npm version must be verified installable before Cloud PR 2 starts.

Cloud PR 2 will bump the registry package, narrowly allow only @relayfile/adapter-linear/planner-contract in the B1 Worker-import gate, switch provider-write-planner to the direct subpath, and delete the #2555 generator/snapshot/helper/CI wiring. Cloud production impact will be called out in that PR body.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@khaliqgant, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b07eff8-5fbd-4887-bf3c-8c6f21ad7c69

📥 Commits

Reviewing files that changed from the base of the PR and between 38f56a1 and eb7f377.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • CHANGELOG.md
  • packages/linear/package.json
  • packages/linear/src/__tests__/planner-contract.test.ts
  • packages/linear/src/path-mapper.ts
  • packages/linear/src/planner-contract.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/linear-worker-planner-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a new dependency-free subpath ./planner-contract for the Linear adapter, enabling Worker-safe Nango model normalization and workflow-state path planning. The changes extract relevant functions and constants into a separate file and add tests to verify the Worker-safe import graph. The review feedback suggests using fileURLToPath from node:url instead of .pathname on new URL objects in the test file to ensure cross-platform compatibility on Windows.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

import assert from 'node:assert/strict';
import { builtinModules } from 'node:module';
import test from 'node:test';
import { build } from 'esbuild';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To ensure cross-platform compatibility (especially on Windows), we should use fileURLToPath from node:url instead of accessing .pathname on a new URL(...) object. On Windows, .pathname can return paths starting with a leading slash (e.g., /C:/path/to/project), which can cause issues with esbuild and other path resolution tools.

Suggested change
import { build } from 'esbuild';
import { fileURLToPath } from 'node:url';
import { build } from 'esbuild';


test('planner-contract public subpath has a pure Worker transitive import graph', async () => {
const result = await build({
absWorkingDir: new URL('../..', import.meta.url).pathname,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use fileURLToPath to safely convert the file:// URL to an absolute path, ensuring it works correctly on Windows systems.

Suggested change
absWorkingDir: new URL('../..', import.meta.url).pathname,
absWorkingDir: fileURLToPath(new URL('../..', import.meta.url)),

stdin: {
contents: `export * from '@relayfile/adapter-linear/planner-contract';`,
loader: 'js',
resolveDir: new URL('../..', import.meta.url).pathname,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use fileURLToPath to safely convert the file:// URL to an absolute path for resolveDir to prevent path resolution failures on Windows.

Suggested change
resolveDir: new URL('../..', import.meta.url).pathname,
resolveDir: fileURLToPath(new URL('../..', import.meta.url)),

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