Skip to content

feat(node): contrib integrations + advanced workflows (conditions/gates/sub-workflows/saga)#271

Merged
pratyush618 merged 25 commits into
masterfrom
feat/node-contrib-workflows
Jun 20, 2026
Merged

feat(node): contrib integrations + advanced workflows (conditions/gates/sub-workflows/saga)#271
pratyush618 merged 25 commits into
masterfrom
feat/node-contrib-workflows

Conversation

@pratyush618

@pratyush618 pratyush618 commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

What

  • Contrib: OpenTelemetry + Prometheus + Sentry middleware, Express + Fastify (REST router + dashboard mount via extracted createDashboardHandler), NestJS module. Each an optional taskito/contrib/* subpath export with an optional peer dep.
  • Advanced workflows driven by the TS WorkflowTracker over the worker outcome stream:
    • step conditions (on_success/on_failure/always)
    • approval gates (resolveGate/approveGate/rejectGate, timeouts)
    • nested sub-workflows (parent linkage, storage-driven child→parent resolve)
    • saga compensation (reverse-dependency rollback)
  • Node SDK lint + typecheck pre-commit hooks; tests regrouped by feature area (Python-style).

Verification

  • cargo check/clippy -D warnings (default + postgres,redis,mesh,workflows) ✓
  • napi build --release ✓ · tsc ✓ · biome ✓ · tsup ✓
  • vitest run — 90 tests pass ✓

Notes

Summary by CodeRabbit

  • New Features
    • Added workflow step conditions, approval gates, sub-workflows, and saga compensation/rollback, including new Node APIs to control workflow progression and compensation.
    • Introduced Node contrib integrations for OpenTelemetry, Prometheus, Sentry, and Express/Fastify/NestJS REST + dashboard support via contrib subpath exports.
  • Documentation
    • Expanded Node workflow guides (conditions, gates, sub-workflows, saga) and added contrib docs (observability + web frameworks), plus updated workflow navigation.
  • Bug Fixes
    • Improved REST query handling to safely ignore prototype-polluting keys.
  • Tests
    • Added integration coverage for workflows, observability middleware, and web framework integrations.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds advanced Node workflow capabilities (conditions, gates, sub-workflows, saga compensation) and a new Node contrib surface (Express, Fastify, NestJS, OpenTelemetry, Prometheus, Sentry), with matching Rust bindings, tests, packaging/build updates, pre-commit hooks, and expanded Node SDK/docs roadmap documentation.

Changes

Advanced workflow execution features

Layer / File(s) Summary
Step metadata contract updates
crates/taskito-workflows/src/definition.rs, crates/taskito-python/src/py_workflow/*, crates/taskito-workflows/tests/*
StepMetadata now derives Default, gains gate, sub_workflow, compensate, and skips serializing absent optionals; callsites switched to ..Default::default().
Node workflow types and exports
sdks/node/src/workflows/types.ts, sdks/node/src/workflows/index.ts
Introduces WorkflowCondition union, GateStepOptions, SubWorkflowStepOptions/SubWorkflowTransport types; extends WorkflowStepOptions with condition/compensate; adds metadata fields to StepMetadataJson; extends WorkflowSpec with subWorkflows mapping.
WorkflowBuilder gates and sub-workflows
sdks/node/src/workflows/builder.ts
Extends builder to mark conditioned steps as deferred, introduces gate(...) and subWorkflow(...) fluent APIs with sentinel task names, metadata persistence, and subWorkflows field in output spec.
WorkflowManager transport and gate resolution
sdks/node/src/workflows/manager.ts
Imports WorkflowTracker, implements resolveGate/approveGate/rejectGate APIs, refactors transport serialization and submission for nested workflows with base64 encoding.
Rust JsQueue workflow controls
crates/taskito-node/src/queue/workflows.rs
Adds skip/gate/state/compensation N-API methods, enriches submit_workflow with parent-run linkage, introduces compensation metadata parsing and job mapping.
Workflow feature tests and path alignment
sdks/node/test/workflows/{conditions,gates,saga,subworkflows}.test.ts, sdks/node/test/{core,worker,dashboard,integrations}/*.test.ts
Adds tests for conditions, gates with timeout/rejection, saga compensation/failure, and sub-workflow composition; updates existing test imports/paths to ../../src/index.
Workflow documentation
docs/content/docs/node/workflows/{conditions,gates,sub-workflows,saga}.mdx, docs/content/docs/node/{index,workflows/index,workflows/meta}.json, docs/content/docs/node/workflows/fan-out.mdx, sdks/node/README.md
Adds comprehensive docs for conditions/gates/sub-workflows/saga; updates workflow navigation cards; removes outdated unsupported-feature callout; replaces README placeholder with concrete examples.

Node contrib integrations

Layer / File(s) Summary
Dashboard handler extraction and REST contract
sdks/node/src/dashboard/{server,index}.ts, sdks/node/src/contrib/rest.ts, sdks/node/test/integrations/rest.test.ts
Exports createDashboardHandler factory; introduces framework-neutral REST request/response/route contracts, flattenQueryParams with key filtering, and buildRestRoutes with all endpoint handlers.
Express adapter
sdks/node/src/contrib/express.ts, sdks/node/test/integrations/express.test.ts
Implements taskitoRouter Express router and taskitoDashboard middleware with default static-dir resolution and dashboard handler integration; includes integration tests.
Fastify adapter
sdks/node/src/contrib/fastify.ts, sdks/node/test/integrations/fastify.test.ts
Implements taskitoFastify and taskitoDashboardPlugin Fastify plugins with request/response mapping, body preservation, and URL prefix stripping; includes integration tests.
NestJS adapter
sdks/node/src/contrib/nest.ts, sdks/node/test/integrations/nest.test.ts
Exports TASKITO_QUEUE DI token, TaskitoService wrapper, and TaskitoModule dynamic module with forRoot(queue) wiring; includes integration test.
Observability adapters
sdks/node/src/contrib/{otel,prometheus,sentry}.ts, sdks/node/test/observability/*.test.ts
Adds OpenTelemetry middleware for spans with filtering/naming/attributes, Prometheus middleware and stats collector for gauges/histogram/counters, and Sentry middleware for dead-letter and optional retry capture; includes comprehensive integration tests.
Packaging, build, and tooling
sdks/node/package.json, sdks/node/tsup.config.ts, sdks/node/tsconfig.json, sdks/node/biome.json, .pre-commit-config.yaml
Publishes contrib subpath exports, adds contrib build entrypoints and dependencies, enables TypeScript/Biome decorators, updates peer dependencies and metadata, adds Node pre-commit lint and typecheck hooks.
Contrib documentation and roadmap
docs/content/docs/node/contrib/{index,observability,web-frameworks,meta}.json, docs/content/docs/node/{index,meta}.json, sdks/node/README.md, NODE_SDK_TODO.md
Adds contrib docs with examples for all adapters, updates Node docs navigation, expands README contrib section, updates TODO roadmap/file-map/test-count.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant WebAdapter
  participant RestRoutes
  participant Queue
  participant Worker

  Client->>WebAdapter: POST /tasks/enqueue (Express/Fastify/NestJS)
  WebAdapter->>RestRoutes: route.handle(queue, request)
  RestRoutes->>Queue: enqueue(task, args)
  Queue-->>RestRoutes: jobId
  RestRoutes-->>WebAdapter: { status: 201, body: {jobId} }
  WebAdapter-->>Client: HTTP 201 with jobId

  Worker->>Queue: runWorker polls and executes job
  Client->>WebAdapter: GET /tasks/jobs/:id/result
  WebAdapter->>RestRoutes: route.handle(queue, request)
  RestRoutes->>Queue: result(jobId, timeoutMs)
  Queue-->>RestRoutes: { status: 200, body: {jobId, status, result} }
  RestRoutes-->>WebAdapter: HTTP 200
  WebAdapter-->>Client: Job result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • ByteVeda/taskito#270: This PR extends the workflow binding layer by expanding crates/taskito-node/src/queue/workflows.rs with additional lifecycle and compensation control APIs that coordinate with WorkflowTracker orchestration.

Poem

🐇 I drummed on logs with a carrot spoon,
gates now wait for the right monsoon.
Child flows hop from parent tracks,
saga bunnies roll failures back.
Express and Fastify share the lane,
and metrics sing in Prometheus rain. 📊✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: contrib integrations and advanced workflows (conditions/gates/sub-workflows/saga) are now available in the Node SDK.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/node-contrib-workflows

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

Comment thread sdks/node/src/contrib/express.ts Fixed
Comment thread sdks/node/src/contrib/express.ts Fixed
Comment thread sdks/node/src/contrib/fastify.ts Fixed
Comment thread sdks/node/src/contrib/fastify.ts Fixed
Shared flattenQueryParams uses a null-proto object and skips __proto__/constructor/prototype, so user-controlled query keys can't pollute. Resolves CodeQL remote-property-injection in express/fastify.
@pratyush618

Copy link
Copy Markdown
Collaborator Author

CodeQL — remote property injection (express/fastify contrib query flattening): user-controlled query keys were assigned onto a plain object (prototype-pollution sink). Fixed by a shared flattenQueryParams that uses a null-prototype object and skips __proto__/constructor/prototype. Regression test in test/integrations/rest.test.ts (93 green). Fixed in e079e29.

Comment thread sdks/node/src/contrib/rest.ts Fixed
Comment thread sdks/node/src/contrib/rest.ts Fixed

@coderabbitai coderabbitai 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.

Actionable comments posted: 8

🧹 Nitpick comments (3)
crates/taskito-node/src/queue/workflows.rs (1)

342-343: 💤 Low value

Stale doc comment — sub-workflows are now supported.

The comment claims the Node SDK "does not yet create sub-workflows," but this PR adds sub-workflow support via submitSubWorkflow in the tracker and the parent_run_id/parent_node_name parameters added to submit_workflow.

📝 Suggested fix
-    /// Child (sub-workflow) runs spawned by a run. Always empty for runs
-    /// submitted by the Node SDK, which does not yet create sub-workflows.
+    /// Child (sub-workflow) runs spawned by a run.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/taskito-node/src/queue/workflows.rs` around lines 342 - 343, The
documentation comment describing the Child (sub-workflow) runs field contains
outdated information claiming the Node SDK "does not yet create sub-workflows."
Update this comment to reflect that sub-workflows are now supported in the Node
SDK through the submitSubWorkflow function and the parent_run_id and
parent_node_name parameters added to submit_workflow. Remove or revise the
phrase that states sub-workflows are not yet supported.
sdks/node/src/workflows/types.ts (1)

115-116: ⚡ Quick win

Use WorkflowCondition for StepMetadataJson.condition for stronger type safety.

condition?: string allows invalid values in manually-authored specs; using the union keeps compile-time checks consistent with WorkflowStepOptions.

♻️ Proposed change
 export interface StepMetadataJson {
@@
-  condition?: string;
+  condition?: WorkflowCondition;
@@
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sdks/node/src/workflows/types.ts` around lines 115 - 116, In the
StepMetadataJson type definition, the condition field is currently typed as
string which allows invalid values. Change the type of the condition field from
string to WorkflowCondition to enforce compile-time validation of valid
condition values (on_success, on_failure, always) and maintain consistency with
WorkflowStepOptions. This ensures only valid condition values can be specified
in manually-authored workflow specs.
NODE_SDK_TODO.md (1)

37-38: ⚡ Quick win

Avoid hardcoded test counts in roadmap/status text.

These numeric counts are brittle and can drift quickly (and the PR context already references a different total). Prefer non-numeric wording or point to CI/test output instead of embedding fixed counts.

Also applies to: 240-240

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@NODE_SDK_TODO.md` around lines 37 - 38, The roadmap document contains
hardcoded test counts that are brittle and prone to drift as tests are added or
modified. In the "Contrib integrations" row, replace the hardcoded "17 new
vitest tests" with non-numeric language such as "comprehensive test coverage" or
"extensive test suite". Similarly, in the "Workflows: conditions / gates /
sub-workflows / saga" row, replace "12 new tests" with non-numeric wording. Also
check line 240 and apply the same fix to any other hardcoded test counts in the
document. This approach makes the document maintainable without requiring
updates each time test counts change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/taskito-node/src/queue/workflows.rs`:
- Around line 682-721: The enqueue_compensation method enqueues a job but does
not cancel it if the subsequent set_workflow_node_compensation_job binding call
fails, leaving an untracked compensation job that will execute without saga
state machine tracking. Add a rollback mechanism similar to create_deferred_job:
after calling self.storage.enqueue, if set_workflow_node_compensation_job
returns an error, call a job cancellation method on the storage to remove the
already-enqueued job before returning the error. This ensures that failed
bindings do not leave orphaned compensation jobs in the queue.

In `@docs/content/docs/node/workflows/gates.mdx`:
- Around line 96-99: The documentation incorrectly states that all downstream
nodes are skipped when a gate is rejected. Clarify the rejection semantics by
specifying that only default on_success path downstream nodes are skipped, while
on_failure and always type successors can still execute after a gate rejection.
Revise the sentence in the gates.mdx file (around the section discussing
rejection behavior) to accurately reflect that only the default success paths
are blocked, not all downstream execution paths.
- Around line 114-118: The POST endpoint at /hooks/deploy-approval in the
example code handles privileged workflow state transitions through resolveGate()
but contains no authentication, authorization, or webhook signature validation.
Add documentation guidance explaining how to properly secure this endpoint by
implementing appropriate checks such as API key validation, webhook signature
verification, or authorization checks to ensure only trusted and authorized
requests can approve deployments. The hardened example should demonstrate one or
more verification mechanisms before the resolveGate() call executes.

In `@sdks/node/src/contrib/express.ts`:
- Around line 53-55: The catch block in the error handler is exposing raw
internal error messages to API callers by returning err.message directly in the
JSON response, which is a security risk. Instead, log the actual error details
server-side using a logger, and return a generic error message like "Internal
Server Error" to the client in the 500 response. This way, debugging information
remains on the server while protecting sensitive details from being leaked to
API callers.

In `@sdks/node/src/contrib/prometheus.ts`:
- Around line 158-162: The constructor accepts intervalMs without validation,
allowing invalid values like zero, negative numbers, or NaN to be assigned to
this.intervalMs. Add validation logic in the constructor after line 161 to
ensure intervalMs is a positive number, either by throwing an error for invalid
values or by using a minimum threshold to guarantee a reasonable polling
interval. Check both the provided options.intervalMs and the final assigned
value to this.intervalMs to catch invalid inputs early.

In `@sdks/node/src/contrib/rest.ts`:
- Around line 150-159: The buildRestRoutes function currently silently
prioritizes includeRoutes when both includeRoutes and excludeRoutes are
provided, but the documentation states they should be mutually exclusive. Add a
validation check at the beginning of the buildRestRoutes function that throws an
error if both options.includeRoutes and options.excludeRoutes are defined
simultaneously, making misconfiguration detectable rather than silently ignored.

In `@sdks/node/test/integrations/fastify.test.ts`:
- Around line 32-57: The Fastify app instance is closed at the end of the test
body, but if any assertion throws before reaching that line, the app will not be
closed and resources will leak. Wrap the test body logic (starting from queue
creation through the final assertion) in a try/finally block, moving the await
app.close() call to the finally block. This ensures the app is closed regardless
of whether assertions succeed or fail. Apply this pattern to all test functions
mentioned in the comment that create and register the Fastify app with
taskitoFastify.

In `@sdks/node/test/integrations/nest.test.ts`:
- Around line 35-50: The moduleRef.close() call is only executed if all
assertions pass, but if any expect() call fails earlier in the test, the module
context remains open and can destabilize subsequent tests. Wrap the test logic
in a try/finally block ensuring moduleRef.close() executes in the finally clause
regardless of assertion outcomes, or alternatively move the moduleRef creation
and closure logic to beforeEach/afterEach hooks to guarantee cleanup runs after
each test case.

---

Nitpick comments:
In `@crates/taskito-node/src/queue/workflows.rs`:
- Around line 342-343: The documentation comment describing the Child
(sub-workflow) runs field contains outdated information claiming the Node SDK
"does not yet create sub-workflows." Update this comment to reflect that
sub-workflows are now supported in the Node SDK through the submitSubWorkflow
function and the parent_run_id and parent_node_name parameters added to
submit_workflow. Remove or revise the phrase that states sub-workflows are not
yet supported.

In `@NODE_SDK_TODO.md`:
- Around line 37-38: The roadmap document contains hardcoded test counts that
are brittle and prone to drift as tests are added or modified. In the "Contrib
integrations" row, replace the hardcoded "17 new vitest tests" with non-numeric
language such as "comprehensive test coverage" or "extensive test suite".
Similarly, in the "Workflows: conditions / gates / sub-workflows / saga" row,
replace "12 new tests" with non-numeric wording. Also check line 240 and apply
the same fix to any other hardcoded test counts in the document. This approach
makes the document maintainable without requiring updates each time test counts
change.

In `@sdks/node/src/workflows/types.ts`:
- Around line 115-116: In the StepMetadataJson type definition, the condition
field is currently typed as string which allows invalid values. Change the type
of the condition field from string to WorkflowCondition to enforce compile-time
validation of valid condition values (on_success, on_failure, always) and
maintain consistency with WorkflowStepOptions. This ensures only valid condition
values can be specified in manually-authored workflow specs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 827399bb-6eaa-4690-a679-261a6d1d8e63

📥 Commits

Reviewing files that changed from the base of the PR and between 94839d2 and 03d7b50.

⛔ Files ignored due to path filters (1)
  • sdks/node/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (66)
  • .pre-commit-config.yaml
  • NODE_SDK_TODO.md
  • crates/taskito-node/src/queue/workflows.rs
  • crates/taskito-python/src/py_queue/workflow_ops/test_helpers.rs
  • crates/taskito-python/src/py_workflow/mod.rs
  • crates/taskito-workflows/src/definition.rs
  • crates/taskito-workflows/src/tests.rs
  • crates/taskito-workflows/tests/storage_contract.rs
  • docs/content/docs/node/contrib/index.mdx
  • docs/content/docs/node/contrib/meta.json
  • docs/content/docs/node/contrib/observability.mdx
  • docs/content/docs/node/contrib/web-frameworks.mdx
  • docs/content/docs/node/index.mdx
  • docs/content/docs/node/meta.json
  • docs/content/docs/node/workflows/conditions.mdx
  • docs/content/docs/node/workflows/fan-out.mdx
  • docs/content/docs/node/workflows/gates.mdx
  • docs/content/docs/node/workflows/index.mdx
  • docs/content/docs/node/workflows/meta.json
  • docs/content/docs/node/workflows/saga.mdx
  • docs/content/docs/node/workflows/sub-workflows.mdx
  • sdks/node/README.md
  • sdks/node/biome.json
  • sdks/node/package.json
  • sdks/node/src/contrib/express.ts
  • sdks/node/src/contrib/fastify.ts
  • sdks/node/src/contrib/nest.ts
  • sdks/node/src/contrib/otel.ts
  • sdks/node/src/contrib/prometheus.ts
  • sdks/node/src/contrib/rest.ts
  • sdks/node/src/contrib/sentry.ts
  • sdks/node/src/dashboard/index.ts
  • sdks/node/src/dashboard/server.ts
  • sdks/node/src/workflows/builder.ts
  • sdks/node/src/workflows/index.ts
  • sdks/node/src/workflows/manager.ts
  • sdks/node/src/workflows/tracker.ts
  • sdks/node/src/workflows/types.ts
  • sdks/node/test/core/cancel.test.ts
  • sdks/node/test/core/inspection.test.ts
  • sdks/node/test/core/locks.test.ts
  • sdks/node/test/core/logger.test.ts
  • sdks/node/test/core/options.test.ts
  • sdks/node/test/core/roundtrip.test.ts
  • sdks/node/test/core/serializer.test.ts
  • sdks/node/test/core/typed.test.ts
  • sdks/node/test/core/webhooks.test.ts
  • sdks/node/test/dashboard/server.test.ts
  • sdks/node/test/integrations/cli.test.ts
  • sdks/node/test/integrations/express.test.ts
  • sdks/node/test/integrations/fastify.test.ts
  • sdks/node/test/integrations/nest.test.ts
  • sdks/node/test/observability/otel.test.ts
  • sdks/node/test/observability/prometheus.test.ts
  • sdks/node/test/observability/sentry.test.ts
  • sdks/node/test/worker/events.test.ts
  • sdks/node/test/worker/mesh.test.ts
  • sdks/node/test/worker/periodic.test.ts
  • sdks/node/test/workflows/conditions.test.ts
  • sdks/node/test/workflows/dag.test.ts
  • sdks/node/test/workflows/fanout.test.ts
  • sdks/node/test/workflows/gates.test.ts
  • sdks/node/test/workflows/saga.test.ts
  • sdks/node/test/workflows/subworkflows.test.ts
  • sdks/node/tsconfig.json
  • sdks/node/tsup.config.ts
💤 Files with no reviewable changes (1)
  • docs/content/docs/node/workflows/fan-out.mdx

Comment thread crates/taskito-node/src/queue/workflows.rs
Comment thread docs/content/docs/node/workflows/gates.mdx Outdated
Comment thread docs/content/docs/node/workflows/gates.mdx
Comment thread sdks/node/src/contrib/express.ts
Comment thread sdks/node/src/contrib/prometheus.ts
Comment thread sdks/node/src/contrib/rest.ts
Comment thread sdks/node/test/integrations/fastify.test.ts
Comment thread sdks/node/test/integrations/nest.test.ts Outdated
@pratyush618

Copy link
Copy Markdown
Collaborator Author

Addressed CodeRabbit (8) + the earlier CodeQL prototype-pollution (×4) on this PR.

  • express router 500s — log internally, return generic "internal server error" (no leak).
  • prometheus collector — validate intervalMs is positive/finite (no tight loop).
  • rest routesincludeRoutes/excludeRoutes now throw if both given (documented as mutually exclusive).
  • sagaenqueue_compensation cancels the job if node binding fails (mirrors create_deferred_job), so a compensation job can't run untracked.
  • query flatteningflattenQueryParams builds via Object.fromEntries over filtered entries (no dynamic obj[key]= sink) + drops __proto__/constructor/prototype → resolves CodeQL remote-property-injection.
  • tests — fastify/nest now close in afterEach (guaranteed teardown, no leak on assertion failure); added route-option + query-flatten regression tests (94 green).
  • docs/gates — clarified that rejection skips only on_success successors (on_failure/always still run); added an auth/signature note to the gate-resolution webhook example.

cargo + clippy (default & all features) + tsc + biome + 94 vitest green.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
sdks/node/test/integrations/rest.test.ts (1)

18-24: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Harden the prototype-pollution regression input to exercise real forbidden-key paths.

This case can be a false negative because object-literal __proto__ is special syntax and may not become an enumerable own query key. Build the input with explicit own properties (including __proto__, constructor, and prototype) so the filter logic is actually tested.

Suggested test adjustment
 it("ignores prototype-polluting query keys", () => {
-  const out = flattenQueryParams({ __proto__: "x", constructor: "y", limit: "10" });
+  const query = Object.create(null) as Record<string, unknown>;
+  query.__proto__ = "x";
+  query.constructor = "y";
+  query.prototype = "z";
+  query.limit = "10";
+  const out = flattenQueryParams(query);
   expect(out.limit).toBe("10");
   // No pollution of Object.prototype, and the dangerous keys aren't carried over.
   expect(({} as Record<string, unknown>).x).toBeUndefined();
   expect(Object.hasOwn(out, "__proto__")).toBe(false);
+  expect(Object.hasOwn(out, "constructor")).toBe(false);
+  expect(Object.hasOwn(out, "prototype")).toBe(false);
 });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sdks/node/test/integrations/rest.test.ts` around lines 18 - 24, The current
test for prototype-pollution in the "ignores prototype-polluting query keys"
test case uses object literal syntax for __proto__, which is special JavaScript
syntax that doesn't create a regular enumerable own property. This means the
test may not actually exercise the filtering logic properly. Instead, build the
input object for flattenQueryParams using explicit property assignment (such as
Object.assign or Object.defineProperty) to create real own properties including
__proto__, constructor, and prototype keys. This ensures the flattenQueryParams
function is genuinely tested against enumerable own properties that need to be
filtered out.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@sdks/node/test/integrations/rest.test.ts`:
- Around line 18-24: The current test for prototype-pollution in the "ignores
prototype-polluting query keys" test case uses object literal syntax for
__proto__, which is special JavaScript syntax that doesn't create a regular
enumerable own property. This means the test may not actually exercise the
filtering logic properly. Instead, build the input object for flattenQueryParams
using explicit property assignment (such as Object.assign or
Object.defineProperty) to create real own properties including __proto__,
constructor, and prototype keys. This ensures the flattenQueryParams function is
genuinely tested against enumerable own properties that need to be filtered out.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ee10e966-eef4-41dc-868a-575a848f1d6c

📥 Commits

Reviewing files that changed from the base of the PR and between 33df47f and a502508.

📒 Files selected for processing (8)
  • crates/taskito-node/src/queue/workflows.rs
  • docs/content/docs/node/workflows/gates.mdx
  • sdks/node/src/contrib/express.ts
  • sdks/node/src/contrib/prometheus.ts
  • sdks/node/src/contrib/rest.ts
  • sdks/node/test/integrations/fastify.test.ts
  • sdks/node/test/integrations/nest.test.ts
  • sdks/node/test/integrations/rest.test.ts
✅ Files skipped from review due to trivial changes (1)
  • docs/content/docs/node/workflows/gates.mdx
🚧 Files skipped from review as they are similar to previous changes (5)
  • sdks/node/test/integrations/nest.test.ts
  • sdks/node/test/integrations/fastify.test.ts
  • sdks/node/src/contrib/rest.ts
  • sdks/node/src/contrib/prometheus.ts
  • crates/taskito-node/src/queue/workflows.rs

@pratyush618 pratyush618 merged commit f54e99f into master Jun 20, 2026
24 checks passed
@pratyush618 pratyush618 deleted the feat/node-contrib-workflows branch June 20, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants