Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR standardizes SDK setup and linting across TypeScript/Python/Ruby/Go, and cleans up previously-unlinted files (examples/guides/core SDK) to pass stricter formatting, lint, and type-check rules.
Changes:
- Migrates TypeScript SDK linting to flat config and applies consistent style fixes across SDK + examples.
- Expands CI workflows to install/lint additional SDK guide directories (TypeScript/Python/Ruby/Go).
- Improves error handling/type-safety in several SDK utilities (gRPC error helpers, typed parsing, richer error causes).
Reviewed changes
Copilot reviewed 275 out of 316 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sdks/typescript/src/v1/examples/simple/cron.ts | Removes inline ESLint disable comments in examples |
| sdks/typescript/src/v1/examples/simple/bulk.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/runtime_affinity/runtime-affinity.e2e.ts | Removes inline lint suppression and keeps loop formatting consistent |
| sdks/typescript/src/v1/examples/run_details/run_details.e2e.ts | Expands single-line if into block for lint compliance |
| sdks/typescript/src/v1/examples/retries/workflow.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/retries/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/priority/workflow.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/priority/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/on_success/workflow.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/on_success/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/on_failure/workflow.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/on_failure/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/on_event/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/on_event/event.e2e.ts | Makes control flow blocks explicit for linting |
| sdks/typescript/src/v1/examples/non_retryable/run.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/multiple_wf_concurrency/run.ts | Removes inline console lint suppressions and normalizes spacing |
| sdks/typescript/src/v1/examples/migration-guides/mergent.ts | Expands throw into block for lint compliance |
| sdks/typescript/src/v1/examples/middleware/recipes.ts | Adds targeted ESLint disable for demo ts-nocheck file; expands early return block |
| sdks/typescript/src/v1/examples/logging/logger.ts | Removes inline lint suppression and normalizes spacing |
| sdks/typescript/src/v1/examples/logging/byo-logger.ts | Removes extraneous-deps lint suppression and normalizes loops |
| sdks/typescript/src/v1/examples/logger/workflow.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/logger/logger.ts | Removes inline lint suppression and normalizes spacing |
| sdks/typescript/src/v1/examples/logger/byo-logger.ts | Removes extraneous-deps lint suppression and normalizes loops |
| sdks/typescript/src/v1/examples/legacy/run.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/landing_page/queues.ts | Removes unused-vars lint suppression |
| sdks/typescript/src/v1/examples/landing_page/durable-excution.ts | Removes unused-vars lint suppression |
| sdks/typescript/src/v1/examples/inferred-typing/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/high-memory/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/events/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/events/event.e2e.ts | Makes loop/break/continue blocks explicit for linting |
| sdks/typescript/src/v1/examples/durable_sleep/run.ts | Removes inline console lint suppression and tidies spacing |
| sdks/typescript/src/v1/examples/durable_sleep/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/durable_event/run.ts | Removes inline console lint suppression and tidies spacing |
| sdks/typescript/src/v1/examples/durable_event/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/durable/workflow.ts | Replaces any and uses destructuring for tighter typing |
| sdks/typescript/src/v1/examples/durable-sleep/run.ts | Removes inline console lint suppression and tidies spacing |
| sdks/typescript/src/v1/examples/durable-sleep/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/durable-event/run.ts | Removes inline console lint suppression and tidies spacing |
| sdks/typescript/src/v1/examples/durable-event/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/deep/run.ts | Removes inline console lint suppression and simplifies catch chain |
| sdks/typescript/src/v1/examples/dag_match_condition/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/dag_match_condition/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/dag/run.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/conditions/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/conditions/event.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/concurrency_workflow_level/concurrency_workflow_level.e2e.ts | Expands guard clauses to blocks for lint consistency |
| sdks/typescript/src/v1/examples/concurrency_multiple_keys/concurrency_multiple_keys.e2e.ts | Expands guard clauses to blocks for lint consistency |
| sdks/typescript/src/v1/examples/concurrency_limit_rr/run.ts | Removes inline console lint suppressions and normalizes spacing |
| sdks/typescript/src/v1/examples/concurrency_limit_rr/load.ts | Removes file-level no-plusplus disable |
| sdks/typescript/src/v1/examples/concurrency-rr/run.ts | Removes inline console lint suppressions and normalizes spacing |
| sdks/typescript/src/v1/examples/concurrency-rr/load.ts | Removes file-level no-plusplus disable |
| sdks/typescript/src/v1/examples/child_workflows/workflow.ts | Removes file-level no-plusplus disable |
| sdks/typescript/src/v1/examples/child_workflows/run.ts | Removes inline console lint suppression |
| sdks/typescript/src/v1/examples/cancellations/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/cancellation/run.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/bulk_operations/workflow.ts | Removes file-level console disable in examples |
| sdks/typescript/src/v1/examples/affinity/affinity-workers.ts | Removes inline lint suppression and normalizes spacing |
| sdks/typescript/src/v1/examples/e2e/harness.ts | Expands early returns and while-true pattern without lint suppressions |
| sdks/typescript/src/v1/declaration.ts | Removes lint suppressions; refactors for stricter linting/types |
| sdks/typescript/src/v1/conditions/index.ts | Removes file-level disables; expands early return block |
| sdks/typescript/src/v1/conditions/base.ts | Removes file-level no-shadow disable |
| sdks/typescript/src/v1/client/worker/worker.ts | Removes lint suppression; expands early return block |
| sdks/typescript/src/v1/client/worker/worker-cancel-supervision.test.ts | Tightens cancel spy typing using a new CancellationReason export |
| sdks/typescript/src/v1/client/worker/slot-utils.ts | Removes lint suppression comments around internal property access |
| sdks/typescript/src/v1/client/worker/health-server.ts | Adds lightweight prom-client typing and improves optional-dep handling |
| sdks/typescript/src/v1/client/worker/deprecated/legacy-worker.ts | Uses shared gRPC error helpers for safer error-code checks |
| sdks/typescript/src/v1/client/worker/deprecated/legacy-v1-worker.ts | Removes file-level no-underscore-dangle disable |
| sdks/typescript/src/v1/client/worker/deprecated/deprecation.ts | Expands one-line conditionals for lint compliance |
| sdks/typescript/src/v1/client/worker/context.ts | Removes lint suppressions; simplifies workflowName assignment; keeps cancellation wiring |
| sdks/typescript/src/v1/client/features/workflows.ts | Uses array destructuring for first row selection |
| sdks/typescript/src/v1/client/features/webhooks.ts | Expands auth type guards into blocks for lint style |
| sdks/typescript/src/v1/client/features/schedules.ts | Preserves error causes when wrapping Zod/Axios errors |
| sdks/typescript/src/v1/client/features/runs.ts | Removes lint suppression for internal listener field access |
| sdks/typescript/src/v1/client/features/crons.ts | Preserves error causes when wrapping Zod/Axios errors |
| sdks/typescript/src/v1/client/features/cel.ts | Preserves error causes when wrapping Axios errors |
| sdks/typescript/src/v1/client/client.ts | Removes lint suppressions; preserves error causes; simplifies option normalization |
| sdks/typescript/src/v1/client/admin.ts | Removes lint suppression comments near underscore fields |
| sdks/typescript/src/util/workflow-run-ref.ts | Uses shared gRPC error helpers; tightens output typing; improves error parsing safety |
| sdks/typescript/src/util/retrier.ts | Avoids any in catch; logs normalized error messages |
| sdks/typescript/src/util/parse.ts | Adds generic parseJSON + better error messages with cause |
| sdks/typescript/src/util/logger/logger.ts | Removes lint suppression for enum name shadowing |
| sdks/typescript/src/util/hatchet-promise/hatchet-promise.ts | Introduces CancellationReason enum; tightens cancel signature |
| sdks/typescript/src/util/grpc-error.ts | Adds shared helpers for extracting gRPC code/details from unknown errors |
| sdks/typescript/src/util/errors/hatchet-error.ts | Adds getErrorMessage + toHatchetError helper and supports Error causes |
| sdks/typescript/src/util/config-loader/token.ts | Uses parseJSON + adds JWT claims typing and validation |
| sdks/typescript/src/util/config-loader/config-loader.ts | Improves catch blocks + preserves Zod error cause |
| sdks/typescript/src/util/abort-error.ts | Replaces ad-hoc abort error with dedicated AbortError class |
| sdks/typescript/src/legacy/step.ts | Removes lint suppressions; minor refactors to satisfy style rules |
| sdks/typescript/src/legacy/legacy-transformer.ts | Removes lint suppressions; expands early return block |
| sdks/typescript/src/legacy/legacy-client.ts | Preserves Zod validation error causes |
| sdks/typescript/src/legacy/legacy-client.test.ts | Removes ts-ignore in test object |
| sdks/typescript/src/legacy/examples/sticky-worker.ts | Removes inline lint suppression and normalizes spacing |
| sdks/typescript/src/legacy/examples/sticky-worker-with-check.ts | Removes inline lint suppression and normalizes spacing |
| sdks/typescript/src/legacy/examples/logger.ts | Removes inline lint suppression and normalizes spacing |
| sdks/typescript/src/legacy/examples/example-event.ts | Removes inline console lint suppressions |
| sdks/typescript/src/legacy/examples/concurrency/group-round-robin/concurrency-worker-key-fn.ts | Expands aborted checks into blocks |
| sdks/typescript/src/legacy/examples/concurrency/group-round-robin/concurrency-worker-expression.ts | Expands aborted checks into blocks |
| sdks/typescript/src/legacy/examples/concurrency/group-round-robin/concurrency-event.ts | Removes inline lint suppression |
| sdks/typescript/src/legacy/examples/concurrency/cancel-in-progress/concurrency-worker.ts | Expands aborted checks into blocks |
| sdks/typescript/src/legacy/examples/byo-logger.ts | Removes lint suppressions and normalizes loop style |
| sdks/typescript/src/legacy/examples/affinity-workers.ts | Removes inline lint suppression and normalizes spacing |
| sdks/typescript/src/clients/listeners/run-listener/pooled-child-listener-client.ts | Improves error message extraction from unknown; expands one-liners |
| sdks/typescript/src/clients/listeners/run-listener/pooled-child-listener-client.test.ts | Removes lint suppression and normalizes test formatting |
| sdks/typescript/src/clients/listeners/run-listener/child-listener-client.ts | Adds gRPC code helper; fixes polling interval typing; clarifies retry loop control flow |
| sdks/typescript/src/clients/listeners/durable-listener/pooled-durable-listener-client.ts | Improves error message extraction; expands one-liners |
| sdks/typescript/src/clients/listeners/durable-listener/durable-listener-client.ts | Removes lint suppression comment |
| sdks/typescript/src/clients/hatchet-client/hatchet-logger.ts | Simplifies console method selection and removes lint suppressions |
| sdks/typescript/src/clients/event/event-client.ts | Uses toHatchetError + getErrorMessage; tightens metadata types |
| sdks/typescript/src/clients/dispatcher/heartbeat/heartbeat-worker.ts | Uses gRPC code helper; improves interval typing; normalizes error messages |
| sdks/typescript/src/clients/dispatcher/dispatcher-client.ts | Uses toHatchetError instead of re-wrapping raw messages |
| sdks/typescript/src/clients/dispatcher/action-listener.ts | Uses gRPC code helper; normalizes error messages; uses toHatchetError with context |
| sdks/typescript/src/clients/admin/admin-client.ts | Uses toHatchetError instead of re-wrapping raw messages |
| sdks/typescript/eslint.config.mjs | Adds flat ESLint config with TS/Prettier + unused-imports rules and overrides |
| sdks/typescript/.eslintrc.json | Removes legacy ESLint config (flat-config migration) |
| sdks/ruby/src/Gemfile | Groups dev deps and adds ruby-lsp |
| sdks/ruby/examples/worker_fixture.rb | Simplifies control flow; safer IO closing; avoids direct $stderr writes |
| sdks/ruby/examples/worker.rb | Normalizes trailing commas for lint style |
| sdks/ruby/examples/webhooks/worker.rb | Normalizes syntax and underscores unused block args |
| sdks/ruby/examples/webhooks/test_webhooks_spec.rb | Removes unused local variable assignment (but leaves expression) |
| sdks/ruby/examples/webhook_with_scope/worker.rb | Normalizes syntax and underscores unused block args |
| sdks/ruby/examples/webhook_with_scope/test_webhooks_with_scope_spec.rb | Removes unused locals (but leaves expressions) |
| sdks/ruby/examples/unit_testing/worker.rb | Normalizes trailing commas and underscores unused args |
| sdks/ruby/examples/unit_testing/test_unit_spec.rb | Updates array literal style + trailing commas |
| sdks/ruby/examples/trigger_methods/workflow.rb | Removes unused assignments and underscores unused ctx |
| sdks/ruby/examples/timeout/worker.rb | Normalizes arguments + underscores unused args |
| sdks/ruby/examples/timeout/test_timeout_spec.rb | Adds trailing comma in multiline call for lint style |
| sdks/ruby/examples/streaming/worker.rb | Underscores unused input |
| sdks/ruby/examples/sticky_workers/worker.rb | Normalizes trailing commas + underscores unused args |
| sdks/ruby/examples/simple/worker.rb | Underscores unused args |
| sdks/ruby/examples/simple/trigger_with_metadata.rb | Normalizes trailing commas in options |
| sdks/ruby/examples/serde/worker.rb | Underscores unused args |
| sdks/ruby/examples/scheduled/worker.rb | Underscores unused args |
| sdks/ruby/examples/scheduled/programatic_sync.rb | Normalizes trailing commas; removes unused assignments |
| sdks/ruby/examples/runtime_affinity/worker.rb | Normalizes trailing commas |
| sdks/ruby/examples/runtime_affinity/test_runtime_affinity_spec.rb | Normalizes trailing commas; condenses guard |
| sdks/ruby/examples/run_details/worker.rb | Underscores unused args; normalizes trailing commas |
| sdks/ruby/examples/return_exceptions/worker.rb | Condenses guard; underscores unused ctx |
| sdks/ruby/examples/return_exceptions/test_return_exceptions_spec.rb | Normalizes trailing commas in multiline call |
| sdks/ruby/examples/retries/worker.rb | Underscores unused args; normalizes trailing commas |
| sdks/ruby/examples/rate_limit/worker.rb | Normalizes trailing commas; underscores unused args |
| sdks/ruby/examples/quickstart/workflows/first_task.rb | Underscores unused ctx |
| sdks/ruby/examples/quickstart/run.rb | Normalizes string quoting |
| sdks/ruby/examples/priority/worker.rb | Normalizes trailing commas; underscores unused args |
| sdks/ruby/examples/priority/trigger.rb | Removes unused assignments; normalizes trailing commas |
| sdks/ruby/examples/priority/test_priority_spec.rb | Normalizes trailing commas and block structure |
| sdks/ruby/examples/on_success/worker.rb | Underscores unused args |
| sdks/ruby/examples/on_failure/worker.rb | Underscores unused args; simplifies guard |
| sdks/ruby/examples/non_retryable/worker.rb | Underscores unused args |
| sdks/ruby/examples/manual_slot_release/worker.rb | Underscores unused input |
| sdks/ruby/examples/logger/worker.rb | Underscores unused args |
| sdks/ruby/examples/hatchet_client.rb | Adds frozen string literal comment; normalizes quoting/commas |
| sdks/ruby/examples/fanout/worker.rb | Underscores unused ctx; normalizes trailing commas |
| sdks/ruby/examples/fanout/trigger.rb | Normalizes trailing commas |
| sdks/ruby/examples/events/worker.rb | Normalizes trailing commas; underscores unused args |
| sdks/ruby/examples/events/test_event_spec.rb | Normalizes trailing commas in nested hashes |
| sdks/ruby/examples/events/filter.rb | Normalizes trailing commas |
| sdks/ruby/examples/events/event.rb | Normalizes trailing commas |
| sdks/ruby/examples/durable_sleep/worker.rb | Underscores unused input |
| sdks/ruby/examples/durable_event/worker.rb | Underscores unused input; normalizes commas |
| sdks/ruby/examples/dependency_injection/test_dependency_injection_spec.rb | Normalizes trailing commas |
| sdks/ruby/examples/delayed/worker.rb | Normalizes quoting; underscores unused ctx |
| sdks/ruby/examples/dedupe/worker.rb | Fixes indentation/commas; underscores unused inputs |
| sdks/ruby/examples/dataclasses/worker.rb | Normalizes quoting and underscores unused ctx |
| sdks/ruby/examples/dag/worker.rb | Underscores unused args; normalizes trailing commas |
| sdks/ruby/examples/cron/worker.rb | Underscores unused args; normalizes trailing commas |
| sdks/ruby/examples/cron/programatic_sync.rb | Removes unused assignments; normalizes commas |
| sdks/ruby/examples/concurrency_workflow_level/worker.rb | Normalizes commas; underscores unused args |
| sdks/ruby/examples/concurrency_workflow_level/test_workflow_level_concurrency_spec.rb | Simplifies block control flow; normalizes trailing commas |
| sdks/ruby/examples/concurrency_multiple_keys/worker.rb | Normalizes commas; underscores unused args |
| sdks/ruby/examples/concurrency_multiple_keys/test_multiple_concurrency_keys_spec.rb | Simplifies block control flow; normalizes trailing commas |
| sdks/ruby/examples/concurrency_limit_rr/worker.rb | Normalizes trailing commas; underscores unused args |
| sdks/ruby/examples/concurrency_limit_rr/test_concurrency_limit_rr_spec.rb | Simplifies rescue control flow |
| sdks/ruby/examples/concurrency_limit/worker.rb | Normalizes trailing commas; underscores unused ctx |
| sdks/ruby/examples/concurrency_cancel_newest/worker.rb | Normalizes trailing commas; underscores unused args |
| sdks/ruby/examples/concurrency_cancel_newest/test_concurrency_cancel_newest_spec.rb | Replaces inline rescue with block; normalizes trailing commas |
| sdks/ruby/examples/concurrency_cancel_in_progress/worker.rb | Normalizes trailing commas; underscores unused args |
| sdks/ruby/examples/concurrency_cancel_in_progress/test_concurrency_cancel_in_progress_spec.rb | Removes noisy puts; replaces inline rescue in loop |
| sdks/ruby/examples/child/worker.rb | Normalizes quoting and underscores unused ctx |
| sdks/ruby/examples/child/trigger.rb | Removes unused assignments; normalizes trailing commas |
| sdks/ruby/examples/child/simple_fanout.rb | Underscores unused args |
| sdks/ruby/examples/child/bulk.rb | Normalizes trailing commas |
| sdks/ruby/examples/cancellation/worker.rb | Underscores unused input; normalizes comment casing |
| sdks/ruby/examples/bulk_operations/worker.rb | Uses zero?; underscores unused input; normalizes commas |
| sdks/ruby/examples/bulk_operations/test_bulk_replay_spec.rb | Fixes arithmetic grouping; normalizes trailing commas |
| sdks/ruby/examples/bulk_operations/cancel.rb | Normalizes trailing commas |
| sdks/ruby/examples/bulk_fanout/worker.rb | Normalizes quoting; underscores unused ctx; normalizes commas |
| sdks/ruby/examples/affinity_workers/worker.rb | Normalizes trailing commas; underscores unused input |
| sdks/ruby/examples/Gemfile | Adds dev group tools (rubocop, rspec, ruby-lsp) |
| sdks/ruby/examples/.rubocop.yml | Adds RuboCop config for examples |
| sdks/python/lint.sh | Normalizes output; ensures Poetry isn’t confused by active venv |
| sdks/guides/typescript/package.json | Ensures lint scripts target only TS files consistently |
| sdks/guides/ruby/Gemfile | Normalizes quoting; adds ruby-lsp |
| sdks/guides/ruby/.rubocop.yml | Adds consistent string literal + trailing comma rules |
| sdks/guides/python/pyproject.toml | Adds pydantic + strict mypy configuration for guides |
| examples/typescript/streaming/nextjs-proxy.ts | Improves handler return type and removes ts-ignore |
| examples/typescript/simple/workflow-with-child.ts | Makes child tasks async; adds sleep to demonstrate async work |
| examples/typescript/multiple_wf_concurrency/run.ts | Normalizes spacing for lint style |
| examples/typescript/migration-guides/mergent.ts | Expands throw into block for lint compliance |
| examples/typescript/middleware/recipes.ts | Expands early return into block for lint compliance |
| examples/typescript/logging/logger.ts | Normalizes spacing for lint style |
| examples/typescript/logger/logger.ts | Normalizes spacing for lint style |
| examples/typescript/durable_sleep/run.ts | Normalizes spacing for lint style |
| examples/typescript/durable_event/run.ts | Normalizes spacing for lint style |
| examples/typescript/durable/workflow.ts | Replaces any with safer record typing |
| examples/typescript/durable-sleep/run.ts | Normalizes spacing for lint style |
| examples/typescript/durable-event/run.ts | Normalizes spacing for lint style |
| examples/typescript/concurrency_limit_rr/run.ts | Normalizes spacing for lint style |
| examples/typescript/concurrency-rr/run.ts | Normalizes spacing for lint style |
| examples/typescript/affinity/affinity-workers.ts | Normalizes spacing for lint style |
| examples/typescript/e2e/harness.ts | Expands early returns and makes loop returns explicit |
| examples/ruby/guides/Gemfile | Switches guide Gemfile to released dependency constraints and normalizes quoting |
| .github/workflows/sdk-typescript.yml | Adds linting for TypeScript guides in CI |
| .github/workflows/sdk-ruby.yml | Adds RuboCop runs for Ruby examples + guides in CI |
| .github/workflows/sdk-python.yml | Adds lint + mypy checks for Python guides in CI |
| .github/workflows/sdk-go.yml | Adds lint job for Go guides in CI |
Files not reviewed (1)
- sdks/guides/typescript/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| from .mock_scraper import mock_scrape | ||
| except ImportError: | ||
| from mock_scraper import mock_scrape | ||
| from .mock_scraper import mock_scrape |
There was a problem hiding this comment.
Using only a relative import (from .mock_scraper import ...) will fail when the file is executed directly (e.g., python worker.py), which is a common way users run guide snippets. Consider restoring the previous ImportError fallback (relative import first, then absolute), or otherwise structuring guides to be executed as a package module.
| from .mock_scraper import mock_scrape | |
| try: | |
| from .mock_scraper import mock_scrape | |
| except ImportError: | |
| from mock_scraper import mock_scrape |
There was a problem hiding this comment.
we're using absolute paths everywhere else, so I think we should use them here too
| class HatchetPromise<T> { | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| cancel: (reason?: any) => void = (_reason?: any) => {}; | ||
| cancel: (reason?: CancellationReason) => void = (_reason?: CancellationReason) => {}; |
There was a problem hiding this comment.
Tightening cancel(reason) from any/unknown to CancellationReason is a (type-level) breaking change for any internal or downstream callers that pass custom cancellation reasons. If the intent is to standardize but remain backwards-compatible, consider widening the parameter type (e.g., CancellationReason | string | unknown) while still exporting the canonical enum for recommended usage.
| cancel: (reason?: CancellationReason) => void = (_reason?: CancellationReason) => {}; | |
| cancel: (reason?: CancellationReason | unknown) => void = (_reason?: CancellationReason | unknown) => {}; |
| # This test requires the Hatchet server with webhook support | ||
| # to be running and accessible | ||
| test_run_id = SecureRandom.uuid | ||
| SecureRandom.uuid |
There was a problem hiding this comment.
This is a no-op expression (the UUID isn’t stored or used) and may trigger RuboCop linting (especially now that CI runs RuboCop for examples). Either remove the line entirely, or keep the intent but avoid “unused var” warnings by assigning to an underscored variable (e.g., _test_run_id = SecureRandom.uuid) and using it where needed.
| SecureRandom.uuid |
| SecureRandom.uuid | ||
| Time.now.utc |
There was a problem hiding this comment.
These are no-op expressions and can be flagged by RuboCop as useless statements (even though the examples are skipped at runtime). Prefer deleting them, or assigning to underscored variables if you want to document what would be captured (e.g., _test_run_id = ..., _test_start = ...).
9fa1400 to
7872b9c
Compare
7872b9c to
05ebfda
Compare
| set -eo pipefail | ||
|
|
||
| echo "\nLinting with ruff" | ||
| unset VIRTUAL_ENV |
There was a problem hiding this comment.
this feels like an odd change to me, I don't think we should need this?
| explicit_package_bases = true | ||
| ignore_missing_imports = true | ||
| check_untyped_defs = true | ||
| disallow_incomplete_defs = true | ||
| disallow_untyped_defs = true | ||
| warn_return_any = true | ||
| no_implicit_optional = true | ||
| strict_equality = true | ||
| warn_unused_ignores = true |
There was a problem hiding this comment.
can we copy the mypy config from the main pyproject.toml instead? I think it just uses strict=true
| @scrape_wf.task(execution_timeout="2m", retries=2) | ||
| async def scrape_url(input: dict, ctx: Context) -> dict: | ||
| return mock_scrape(input["url"]) | ||
| async def scrape_url(input: UrlInput, ctx: Context) -> dict: |
There was a problem hiding this comment.
once we enable strict=true, I think dict with no type args will fail
| No `type: ignore`, `@ts-ignore`, `nolint`, `disable_error_code`, or equivalent. Fix the code instead. | ||
|
|
||
| - If types mismatch at a third-party SDK boundary, convert explicitly (e.g. role-narrowing helpers, `.model_dump()`) | ||
| - If an import pattern triggers errors, restructure the code (e.g. `__init__.py` + relative imports instead of `try/except ImportError`) |
There was a problem hiding this comment.
nit: we use absolute imports in Python
|
|
||
| ### Package Structure | ||
|
|
||
| Every guide subdirectory must have `__init__.py`. Use relative imports only — no `try/except ImportError` fallback pattern: |
| run = await hatchet.runs.create(workflow_name="stream_task", input={}) | ||
| async for chunk in hatchet.runs.subscribe_to_stream(run.run_id): | ||
| async def run_and_subscribe() -> None: | ||
| run = await hatchet.runs.aio_create(workflow_name="stream_task", input={}) |
There was a problem hiding this comment.
we shouldn't be using hatchet.runs.create - should call one of the run methods on the workflow instead
| results = [] | ||
| for url in urls: | ||
| scraped = await scrape_wf.aio_run(input={"url": url}) | ||
| processed = await process_wf.aio_run(input={"url": url, "content": scraped["content"]}) | ||
| scraped = await scrape_wf.aio_run(input=UrlInput(url=url)) | ||
| processed = await process_wf.aio_run( | ||
| input=ContentInput(url=url, content=scraped["content"]) | ||
| ) | ||
| results.append({"url": url, **processed}) |
There was a problem hiding this comment.
bulk spawn here instead of running these in a loop?
Description
Adds tasks to setup and lint all sdks with consistent commands, lints and typechecks files that we've missed before
Type of change