job-workflow 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.agents/instructions/coding-style.md +38 -0
  3. data/.agents/instructions/domain.md +37 -0
  4. data/.agents/instructions/environment.md +44 -0
  5. data/.agents/instructions/general.md +29 -0
  6. data/.agents/instructions/security.md +20 -0
  7. data/.agents/instructions/structure.md +43 -0
  8. data/.agents/instructions/tech-stack.md +40 -0
  9. data/.agents/instructions/testing.md +46 -0
  10. data/.agents/instructions/workflow.md +39 -0
  11. data/.rubocop.yml +10 -0
  12. data/AGENTS.md +23 -0
  13. data/CHANGELOG.md +14 -0
  14. data/README.md +1 -1
  15. data/Rakefile +1 -1
  16. data/Steepfile +4 -0
  17. data/app/controllers/job_workflow/monitoring/application_controller.rb +1 -0
  18. data/app/controllers/job_workflow/monitoring/executions_controller.rb +7 -0
  19. data/app/controllers/job_workflow/monitoring/workflows_controller.rb +3 -0
  20. data/guides/PRODUCTION_DEPLOYMENT.md +1 -1
  21. data/guides/README.md +1 -1
  22. data/lib/job_workflow/auto_scaling/executor.rb +3 -1
  23. data/lib/job_workflow/context.rb +5 -8
  24. data/lib/job_workflow/dsl.rb +14 -8
  25. data/lib/job_workflow/instrumentation/opentelemetry_subscriber.rb +2 -0
  26. data/lib/job_workflow/logger.rb +1 -2
  27. data/lib/job_workflow/monitoring/dag_layout.rb +4 -0
  28. data/lib/job_workflow/monitoring/execution_view_model.rb +11 -11
  29. data/lib/job_workflow/monitoring.rb +4 -1
  30. data/lib/job_workflow/queue_adapters/null_adapter.rb +6 -1
  31. data/lib/job_workflow/sub_task_job.rb +3 -2
  32. data/lib/job_workflow/task_graph.rb +2 -0
  33. data/lib/job_workflow/task_output.rb +3 -1
  34. data/lib/job_workflow/version.rb +1 -1
  35. data/lib/job_workflow/workflow.rb +8 -1
  36. data/lib/job_workflow/workflow_status.rb +21 -3
  37. data/rbs_collection.lock.yaml +67 -15
  38. data/rbs_collection.yaml +4 -0
  39. data/sig/generated/controllers/job_workflow/monitoring/application_controller.rbs +11 -0
  40. data/sig/generated/controllers/job_workflow/monitoring/executions_controller.rbs +21 -0
  41. data/sig/generated/controllers/job_workflow/monitoring/workflows_controller.rbs +12 -0
  42. data/sig/generated/job_workflow/auto_scaling/executor.rbs +2 -0
  43. data/sig/generated/job_workflow/dsl.rbs +4 -0
  44. data/sig/generated/job_workflow/instrumentation/opentelemetry_subscriber.rbs +2 -1
  45. data/sig/generated/job_workflow/logger.rbs +1 -2
  46. data/sig/generated/job_workflow/monitoring/dag_layout.rbs +6 -0
  47. data/sig/generated/job_workflow/monitoring/execution_view_model.rbs +8 -2
  48. data/sig/generated/job_workflow/monitoring.rbs +4 -2
  49. data/sig/generated/job_workflow/queue_adapters/null_adapter.rbs +8 -1
  50. data/sig/generated/job_workflow/sub_task_job.rbs +2 -2
  51. data/sig/generated/job_workflow/task_graph.rbs +2 -0
  52. data/sig/generated/job_workflow/workflow.rbs +8 -0
  53. data/sig/generated/job_workflow/workflow_status.rbs +12 -2
  54. data/sig-private/activejob.rbs +7 -0
  55. data/sig-private/job-workflow.rbs +2 -1
  56. data/sig-private/mission_control.rbs +10 -0
  57. data/sig-private/rails.rbs +7 -0
  58. data/sig-private/solid_queue.rbs +1 -1
  59. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbf6231d334745f4814282d93fa8c7b54461680e6bb57edc6632cd39b86cb71b
4
- data.tar.gz: c627082defb65e2a4cd79cb2b88d3f54ce8b082a88d9ccaff3d96029ee49ea65
3
+ metadata.gz: 54b1b4244da651dd7a48b083dbff5194d414964a2269fa53580d3d6b68f9428e
4
+ data.tar.gz: bad5b87fe9e7f60699841de280554e05d8e07025d0cc01bdaa972b1ca24f37d0
5
5
  SHA512:
6
- metadata.gz: f8caf717541c7f549d3957a5939d636881f8ad98389e5e53759dde43e561c8bbdeda0211feab0843f2625fbc974fb217b479bc2421e0bc828b9f6d910b749cd5
7
- data.tar.gz: 466d87d40597d0d3c68de4cec3f2f6d158faab74100d098420cd376108fb88667f15cf1ecccdf2b810e41df402a9db5f7d84945a71de2dd756e71ae99588fe58
6
+ metadata.gz: 445ed81a6feb664a4f9ef139f7178e74701c9507b2cb0e91b017b9998b076bb8d7000bf2ce169a965ae797002ebe7e82596e18bb03200a06b22fd2ebac29ee5c
7
+ data.tar.gz: 35242db3bb8c3d0cf11f35be438eae04f929af4c77268326990512ca124acfe0b63876dd3618f9e24d44c1e04ab4014293f14ff90d540c4810b594b88e57a0a8
@@ -0,0 +1,38 @@
1
+ # Coding Style
2
+
3
+ ## Primary sources of truth
4
+
5
+ - `.rubocop.yml` for Ruby style, complexity, and naming constraints
6
+ - `Steepfile`, `rbs_collection.yaml`, and inline RBS usage for type-checking expectations
7
+ - `.github/copilot-instructions.md` for repository-specific design and testing rules
8
+
9
+ ## Mechanical style constraints
10
+
11
+ - Ruby string literals use double quotes.
12
+ - RuboCop line length is capped at 120 characters.
13
+ - The repository excludes `examples/**/*` from the root RuboCop config because the example app validates itself separately.
14
+
15
+ ## Design rules
16
+
17
+ - Keep code small and focused on a single responsibility.
18
+ - Prefer composable behavior over large monolithic methods.
19
+ - Favor immutable workflow inputs through `Arguments`.
20
+ - Use `Output` as the main way to communicate task side effects and downstream data.
21
+ - Preserve clear boundaries between `Workflow`, `Task`, and `Runner`.
22
+ - Avoid breaking public APIs without a documented migration or deprecation path.
23
+
24
+ ## Type and signature rules
25
+
26
+ - Prefer `rbs-inline` comments in implementation files when type information changes.
27
+ - Do not edit generated `.rbs` files or `sig/` artifacts directly unless maintainers explicitly approve it.
28
+
29
+ ## Test-adjacent implementation rules
30
+
31
+ - Add only the code necessary for the requested behavior and its directly related fixes.
32
+ - Reuse existing helpers and patterns before adding new abstractions.
33
+ - Comment code only when the behavior is non-obvious.
34
+ - Do not change established naming conventions without approval.
35
+
36
+ ## Unconfirmed items
37
+
38
+ - Any additional hand-written naming rules beyond Ruby conventions and RuboCop enforcement
@@ -0,0 +1,37 @@
1
+ # Domain
2
+
3
+ ## Repository purpose
4
+
5
+ JobWorkflow is a workflow orchestration library for Ruby on Rails applications. It provides a declarative DSL on top of ActiveJob so applications can define task graphs, dependencies, fan-out work, retries, throttling, and monitoring.
6
+
7
+ ## Core concepts
8
+
9
+ - `Workflow`: the ordered graph of tasks for a job class
10
+ - `Task`: one unit of work in a workflow, optionally depending on other tasks
11
+ - `Arguments`: immutable workflow inputs exposed to tasks through `Context`
12
+ - `Context`: the task-facing object used to read arguments, outputs, runtime helpers, and execution state
13
+ - `Output`: the structured result store for completed task outputs
14
+ - `Runner`: the orchestration layer that executes tasks and updates workflow state
15
+ - `SubTaskJob`: the dedicated async job class used for `enqueue: true` fan-out work
16
+ - `WorkflowStatus` / `JobStatus`: read models for workflow and sub-task execution state
17
+ - Monitoring UI: the Rails engine that visualizes workflow definitions and execution DAGs
18
+
19
+ ## Common terminology
20
+
21
+ - `each task`: a task that fans out over a collection
22
+ - `dependency_wait`: waiting behavior for dependent async work
23
+ - `fan-out`: splitting work into sub-jobs
24
+ - `root execution`: the top-level workflow job, excluding sub-task jobs
25
+
26
+ ## Detailed references
27
+
28
+ - `guides/GETTING_STARTED.md` for the high-level workflow model
29
+ - `guides/DSL_BASICS.md` for task definitions and dependency rules
30
+ - `guides/TASK_OUTPUTS.md` for output flow and downstream consumption
31
+ - `guides/PARALLEL_PROCESSING.md` for fan-out and aggregation behavior
32
+ - `guides/WORKFLOW_STATUS_QUERY.md` for workflow vs job status read models
33
+ - `guides/MONITORING_UI.md` for the monitoring view of root executions and sub-task jobs
34
+
35
+ ## Unconfirmed items
36
+
37
+ - Additional external domain vocabulary used by downstream adopters
@@ -0,0 +1,44 @@
1
+ # Environment
2
+
3
+ ## Required local tools
4
+
5
+ - Ruby and Bundler for gem development
6
+ - SQLite3 for local development and the example app
7
+ - A shell environment that can run the root and example-app Rake tasks
8
+
9
+ ## Root setup
10
+
11
+ ```bash
12
+ bin/setup
13
+ bundle install
14
+ bundle exec rake rbs:install
15
+ ```
16
+
17
+ ## Example app setup
18
+
19
+ From `examples/rails_8_1/`:
20
+
21
+ ```bash
22
+ bundle install
23
+ bundle exec rails db:prepare
24
+ bundle exec rake rbs:install
25
+ ```
26
+
27
+ ## Running the example app
28
+
29
+ - Start the Rails server from `examples/rails_8_1/` with `bin/rails server`
30
+ - Start background job processing with `bin/jobs`
31
+ - Open `/job_workflow` for the monitoring UI and `/jobs` for Mission Control Jobs in the example app
32
+ - For a denser monitoring DAG preview, enqueue `AcceptanceComplexMonitoringDagJob` from `examples/rails_8_1/`
33
+
34
+ ## Useful notes
35
+
36
+ - The example app is the main place to verify real monitoring UI behavior.
37
+ - The example app has its own lockfile and validation commands; treat it as an additional maintained surface.
38
+ - Use `examples/rails_8_1/README.md` for the full preview sequence.
39
+ - Use `guides/GETTING_STARTED.md` for first-time library setup and `guides/MONITORING_UI.md` for monitoring behavior.
40
+
41
+ ## Unconfirmed items
42
+
43
+ - Preferred Ruby version manager for maintainers
44
+ - Any editor or shell configuration the team expects
@@ -0,0 +1,29 @@
1
+ # General
2
+
3
+ ## Core behavior
4
+
5
+ - Respond to repository collaborators in Japanese, even though these agent resource files are written in English.
6
+ - Interpret user instructions literally and keep changes scoped to the requested task.
7
+ - Ask for clarification before making risky, ambiguous, or behavior-changing edits.
8
+ - Prefer existing repository conventions over personal defaults.
9
+
10
+ ## Always do
11
+
12
+ - Read the relevant repository context before editing.
13
+ - Keep changes focused and avoid unrelated cleanup.
14
+ - Report what changed, what was validated, and any unresolved points when finishing work.
15
+
16
+ ## Do not do
17
+
18
+ - Do not create unrelated refactors while working on a user request.
19
+ - Do not assume undocumented behavior when repository sources do not confirm it.
20
+ - Do not treat generated signatures in `sig/generated/` as the primary editing surface.
21
+
22
+ ## Communication
23
+
24
+ - Use concise Japanese in user-facing chat.
25
+ - State uncertainty explicitly instead of presenting guesses as facts.
26
+
27
+ ## Unconfirmed items
28
+
29
+ - Additional organization-wide communication rules beyond this repository
@@ -0,0 +1,20 @@
1
+ # Security
2
+
3
+ ## Secrets and sensitive data
4
+
5
+ - Do not commit API keys, tokens, passwords, private keys, or other secrets.
6
+ - Stop and ask if a value looks like a secret or production credential.
7
+
8
+ ## Restricted operations
9
+
10
+ - Do not modify files outside the repository root.
11
+
12
+ ## Dependency and code safety
13
+
14
+ - Prefer existing repository dependencies and tools over introducing new ones.
15
+ - Avoid risky shell operations, destructive git commands, and history rewriting unless explicitly requested.
16
+ - Surface errors instead of silently swallowing them.
17
+
18
+ ## Unconfirmed items
19
+
20
+ - External secret-management system used by maintainers
@@ -0,0 +1,43 @@
1
+ # Structure
2
+
3
+ ## Repository layout
4
+
5
+ ```text
6
+ .
7
+ ├── app/ # Rails engine assets for the monitoring UI
8
+ ├── bin/ # executable helpers
9
+ ├── config/ # Rails engine and routing configuration
10
+ ├── examples/rails_8_1/ # acceptance Rails application used to verify integration
11
+ ├── guides/ # user-facing documentation
12
+ ├── lib/ # main JobWorkflow library code
13
+ ├── sig/ # generated signatures and type artifacts
14
+ ├── sig-private/ # private type definitions used by Steep
15
+ ├── spec/ # main RSpec suite
16
+ ├── .agents/instructions/ # agent instructions files referenced from AGENTS.md
17
+ └── AGENTS.md # root agent entry point
18
+ ```
19
+
20
+ ## Key areas
21
+
22
+ - `lib/job_workflow/` holds the core DSL, runtime, adapters, monitoring models, and version file.
23
+ - `lib/job_workflow/monitoring/` contains monitoring presenters, registries, and layout helpers.
24
+ - `app/` and `config/routes.rb` support the monitoring UI engine.
25
+ - `examples/rails_8_1/` is a separate validation surface with its own Rake tasks, lockfile, and specs.
26
+ - `examples/rails_8_1/app/jobs/` contains acceptance workflow definitions.
27
+ - `examples/rails_8_1/spec/jobs/` contains acceptance and integration-oriented example-app specs.
28
+ - `guides/` is the documentation index for feature and operational guides.
29
+
30
+ ## Structure expectations
31
+
32
+ - Treat this repository as a single package with an embedded example application, not as a monorepo of independent packages.
33
+ - Keep agent-wide documentation at the root unless a future task explicitly introduces subdirectory-specific AGENTS.md files.
34
+
35
+ ## Documentation entry points
36
+
37
+ - Start with `guides/README.md` to find the right feature guide.
38
+ - Use `guides/MONITORING_UI.md` for monitoring-specific behavior.
39
+ - Use `examples/rails_8_1/README.md` for example-app setup and preview flows.
40
+
41
+ ## Unconfirmed items
42
+
43
+ - Whether additional future example applications should get their own AGENTS.md
@@ -0,0 +1,40 @@
1
+ # Tech Stack
2
+
3
+ ## Languages and frameworks
4
+
5
+ - Ruby `>= 3.1.0` for the gem runtime
6
+ - Rails and ActiveJob for the workflow runtime and monitoring engine integration
7
+ - Solid Queue in the example app for asynchronous execution scenarios
8
+ - SQLite in local and example-app development flows
9
+ - RBS Inline plus Steep for type checking
10
+ - RSpec for tests
11
+ - RuboCop with repository plugins for linting
12
+ - SimpleCov for 100% line and branch coverage enforcement
13
+
14
+ ## Primary commands
15
+
16
+ - Root validation:
17
+ - `bundle exec rake spec`
18
+ - `bundle exec rake lint`
19
+ - `bundle exec rake typecheck`
20
+ - Useful root helpers:
21
+ - `bundle exec rake lint:fix`
22
+ - `bundle exec rake lint:fixall`
23
+ - `bundle exec rake rbs:install`
24
+ - `bundle exec rake rbs:update`
25
+ - `bundle exec rake rbs:inline`
26
+ - Example app validation from `examples/rails_8_1/`:
27
+ - `bundle exec rake spec`
28
+ - `bundle exec rake lint`
29
+ - `bundle exec rake typecheck`
30
+
31
+ ## Architecture summary
32
+
33
+ - `Workflow`, `Task`, `Runner`, `Arguments`, `Context`, and `Output` form the core execution model.
34
+ - Queue adapters isolate runtime-specific job lookup and persistence behavior.
35
+ - Monitoring code lives under `lib/job_workflow/monitoring/` and is rendered through the Rails engine in `app/`.
36
+ - The example Rails app is the main integration harness for real ActiveJob and Solid Queue behavior.
37
+
38
+ ## Important command rule
39
+
40
+ - Use the repository Rake tasks instead of calling `rspec`, `rubocop`, or `steep` directly for final validation.
@@ -0,0 +1,46 @@
1
+ # Testing
2
+
3
+ ## Required validation
4
+
5
+ - Every functional change must include new or updated specs that cover the changed behavior.
6
+ - Root repository changes must pass:
7
+ - `bundle exec rake spec`
8
+ - `bundle exec rake lint`
9
+ - `bundle exec rake typecheck`
10
+ - Root coverage must remain at `100%` line coverage and `100%` branch coverage.
11
+
12
+ ## Example app validation
13
+
14
+ - If a change touches `examples/rails_8_1/`, also run inside that directory:
15
+ - `bundle exec rake spec`
16
+ - `bundle exec rake lint`
17
+ - `bundle exec rake typecheck`
18
+ - Example app coverage must also stay at `100%` line coverage and `100%` branch coverage.
19
+
20
+ ## Validation scope
21
+
22
+ - If the change only touches root library, engine, guides, or specs outside `examples/rails_8_1/`, run the root validation set.
23
+ - If the change touches both root code and `examples/rails_8_1/`, run both validation sets.
24
+ - If the change alters behavior, update the relevant guide examples as well as tests.
25
+
26
+ ## Test-writing rules
27
+
28
+ - Use `bundle exec rake spec`, not `bundle exec rspec`.
29
+ - Define a named subject with `subject(:name)`.
30
+ - Keep `describe` / `context` nesting at three levels or fewer.
31
+ - Prefer one expectation per example unless a matcher like `have_attributes` or a combined matcher makes the assertion a single behavior check.
32
+ - Test through public APIs only; do not use `instance_variable_set`, `instance_variable_get`, or similar reflection in specs.
33
+ - Keep `let` usage lean and split contexts when conditions differ.
34
+
35
+ ## Completion rule
36
+
37
+ - Do not report a code change as ready until the required validation commands for the touched surfaces have succeeded.
38
+
39
+ ## Reference material
40
+
41
+ - Use `guides/TESTING_STRATEGY.md` for testing guidance beyond the mandatory checks.
42
+ - Use `guides/MONITORING_UI.md` and feature-specific guides when behavior-oriented expectations need clarification.
43
+
44
+ ## Unconfirmed items
45
+
46
+ - Whether any additional external CI jobs run outside the repository-local Rake tasks
@@ -0,0 +1,39 @@
1
+ # Workflow
2
+
3
+ ## Branches
4
+
5
+ - Use a dedicated branch for work.
6
+ - Preferred branch prefixes are `feature/<short-desc>` and `fix/<short-desc>`.
7
+
8
+ ## Commits
9
+
10
+ - Use Conventional Commits in `type(scope): short summary` format.
11
+ - Valid types include `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, and `perf`.
12
+ - Keep the subject line within 72 characters.
13
+ - Update `CHANGELOG.md` before creating a commit when the change should be reflected in release notes.
14
+
15
+ ## Pull requests
16
+
17
+ - Keep one PR focused on one logical change.
18
+ - PR creation and merge are normally done by the user unless they explicitly delegate that step.
19
+ - A completion handoff should include validation results, coverage, lint status, typecheck status, major changed files, and any recommended follow-up.
20
+
21
+ ## Before changing behavior
22
+
23
+ - Check `guides/README.md` first to find the relevant feature guide.
24
+ - Use feature guides such as `guides/DSL_BASICS.md`, `guides/TASK_OUTPUTS.md`, `guides/PARALLEL_PROCESSING.md`, `guides/DEPENDENCY_WAIT.md`, and `guides/MONITORING_UI.md` before changing semantics in those areas.
25
+
26
+ ## Release preparation
27
+
28
+ - Record shipped changes in `CHANGELOG.md`, starting from `## [Unreleased]` before they are cut into a release section.
29
+ - Keep version-related files in sync when preparing a release.
30
+
31
+ ## Review expectations
32
+
33
+ - Explain why a change is necessary.
34
+ - Keep PRs small enough to review without mixing unrelated work.
35
+
36
+ ## Unconfirmed items
37
+
38
+ - Reviewer assignment rules outside the repository instructions
39
+ - Whether release tagging always happens from `main`
data/.rubocop.yml CHANGED
@@ -8,6 +8,7 @@ AllCops:
8
8
  TargetRubyVersion: 3.1
9
9
  NewCops: enable
10
10
  SuggestExtensions: false
11
+ UseProjectIndex: true
11
12
  Exclude:
12
13
  - examples/**/*
13
14
  - tmp/**/*
@@ -80,6 +81,15 @@ RSpec/ExampleLength:
80
81
  Style/Documentation:
81
82
  Enabled: false
82
83
 
84
+ Style/RbsInline:
85
+ Mode: opt_out
86
+
87
+ Style/RbsInline/MissingTypeAnnotation:
88
+ EnforcedStyle: method_type_signature
89
+
90
+ Style/RbsInline/RedundantTypeAnnotation:
91
+ EnforcedStyle: method_type_signature
92
+
83
93
  Style/StringLiterals:
84
94
  EnforcedStyle: double_quotes
85
95
 
data/AGENTS.md ADDED
@@ -0,0 +1,23 @@
1
+ # AGENTS.md
2
+
3
+ This repository uses AGENTS.md as a thin hub. Read the required instructions files before making changes.
4
+
5
+ ## Required instructions
6
+
7
+ - @.agents/instructions/general.md
8
+ - @.agents/instructions/structure.md
9
+ - @.agents/instructions/tech-stack.md
10
+ - @.agents/instructions/security.md
11
+ - @.agents/instructions/testing.md
12
+ - @.agents/instructions/workflow.md
13
+
14
+ ## Load when needed
15
+
16
+ - .agents/instructions/domain.md — JobWorkflow concepts and terminology
17
+ - .agents/instructions/environment.md — local setup and example app workflow
18
+ - .agents/instructions/coding-style.md — design rules, style constraints, and implementation patterns
19
+
20
+ ## Repository notes
21
+
22
+ - Repository-specific reusable agent assets should live under `.agents/skills/`.
23
+ - No subdirectory-level AGENTS.md files are defined at the moment. Use this root entry point unless a later task adds a more specific AGENTS.md.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.2] - 2026-08-09
4
+
5
+ ### Changed
6
+
7
+ - Extend RBS/Steep type checking to the monitoring Rails controllers and add signatures for Rails, Mission Control Jobs, and Solid Queue integrations
8
+ - Upgrade the RBS inline, Steep, and RuboCop development tooling used by the type and lint checks
9
+ - Keep the Rails 8.1 example app's lint task compatible with the root RuboCop configuration
10
+
11
+ ## [0.6.1] - 2026-06-01
12
+
13
+ ### Fixed
14
+
15
+ - Fix monitoring UI task state rendering so tasks recorded as completed in ActiveJob continuation data no longer appear as `pending` when they have no outputs or sub-task statuses
16
+
3
17
  ## [0.6.0] - 2026-05-24
4
18
 
5
19
  ### Added
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JobWorkflow
2
2
 
3
- > ⚠️ **Early Stage (v0.6.0):** This library is in active development. APIs and features may change in breaking ways without notice. Use in production at your own risk and expect potential breaking changes in future releases.
3
+ > ⚠️ **Early Stage (v0.6.2):** This library is in active development. APIs and features may change in breaking ways without notice. Use in production at your own risk and expect potential breaking changes in future releases.
4
4
 
5
5
  ## Overview
6
6
 
data/Rakefile CHANGED
@@ -40,7 +40,7 @@ namespace :rbs do
40
40
  require "rbs/inline"
41
41
  require "rbs/inline/cli"
42
42
  FileUtils.rm_r(File.expand_path("sig/generated", __dir__), secure: true)
43
- RBS::Inline::CLI.new.run(%w[lib --output --opt-out])
43
+ RBS::Inline::CLI.new.run(%w[app lib --output --opt-out])
44
44
  end
45
45
  end
46
46
 
data/Steepfile CHANGED
@@ -5,6 +5,10 @@
5
5
  target :lib do
6
6
  signature "sig"
7
7
  signature "sig-private"
8
+ library "actionpack"
9
+ library "actionview"
10
+ library "rack"
8
11
 
9
12
  check "lib"
13
+ check "app"
10
14
  end
@@ -4,6 +4,7 @@ module JobWorkflow
4
4
  module Monitoring
5
5
  # Resolve the host app controller at load time so engine controllers inherit
6
6
  # the app's existing authentication and access control hooks.
7
+ # @rbs inherits ActionController::Base
7
8
  class ApplicationController < JobWorkflow::Monitoring.resolved_base_controller_class.constantize
8
9
  layout "job_workflow/monitoring/application"
9
10
  end
@@ -3,6 +3,12 @@
3
3
  module JobWorkflow
4
4
  module Monitoring
5
5
  class ExecutionsController < ApplicationController
6
+ # @rbs @workflow: singleton(DSL)
7
+ # @rbs @page: ExecutionPage
8
+ # @rbs @executions: Array[ExecutionViewModel]
9
+ # @rbs @execution: ExecutionViewModel
10
+
11
+ #: () -> void
6
12
  def index
7
13
  @workflow = WorkflowRegistry.find(params[:workflow_job_class_name])
8
14
  return render plain: "Workflow definition not found.", status: :not_found if @workflow.nil?
@@ -14,6 +20,7 @@ module JobWorkflow
14
20
  @executions = @page.executions
15
21
  end
16
22
 
23
+ #: () -> void
17
24
  def show
18
25
  @workflow = WorkflowRegistry.find(params[:workflow_job_class_name])
19
26
  return render plain: "Workflow definition not found.", status: :not_found if @workflow.nil?
@@ -3,6 +3,9 @@
3
3
  module JobWorkflow
4
4
  module Monitoring
5
5
  class WorkflowsController < ApplicationController
6
+ # @rbs @workflows: Array[WorkflowDefinition]
7
+
8
+ #: () -> void
6
9
  def index
7
10
  @workflows = Monitoring.workflows
8
11
  end
@@ -1,6 +1,6 @@
1
1
  # Production Deployment
2
2
 
3
- > ⚠️ **Early Stage (v0.6.0):** JobWorkflow is still in early development. While this section outlines potential deployment patterns, please thoroughly test in your specific environment and monitor for any issues before relying on JobWorkflow in critical production systems.
3
+ > ⚠️ **Early Stage (v0.6.2):** JobWorkflow is still in early development. While this section outlines potential deployment patterns, please thoroughly test in your specific environment and monitor for any issues before relying on JobWorkflow in critical production systems.
4
4
 
5
5
  This section covers suggested settings and patterns for running JobWorkflow in production-like environments.
6
6
 
data/guides/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JobWorkflow Guides
2
2
 
3
- > ⚠️ **Early Stage (v0.6.0):** JobWorkflow is in active development. APIs and features may change. The following guides provide patterns and examples for building workflows, but be aware that implementations may need adjustment as the library evolves.
3
+ > ⚠️ **Early Stage (v0.6.2):** JobWorkflow is in active development. APIs and features may change. The following guides provide patterns and examples for building workflows, but be aware that implementations may need adjustment as the library evolves.
4
4
 
5
5
  Welcome to the JobWorkflow documentation! This directory contains comprehensive guides to help you build robust workflows with JobWorkflow.
6
6
 
@@ -3,6 +3,8 @@
3
3
  module JobWorkflow
4
4
  module AutoScaling
5
5
  class Executor
6
+ # @rbs @adapter: Adapter::_InstanceMethods
7
+
6
8
  #: (Configuration) -> void
7
9
  def initialize(config)
8
10
  @config = config
@@ -36,7 +38,7 @@ module JobWorkflow
36
38
 
37
39
  #: () -> Array[Integer]
38
40
  def desired_count_list
39
- config.min_count.step(config.max_count, config.step_count).to_a
41
+ config.min_count.step(config.max_count, config.step_count).to_a #: Array[Integer]
40
42
  end
41
43
  end
42
44
  end
@@ -120,8 +120,7 @@ module JobWorkflow
120
120
 
121
121
  #: () -> String
122
122
  def job_id
123
- local_job = job
124
- raise "job is not set" if local_job.nil?
123
+ local_job = job || (raise "job is not set")
125
124
 
126
125
  local_job.job_id
127
126
  end
@@ -215,11 +214,8 @@ module JobWorkflow
215
214
 
216
215
  #: (?Symbol?, ?fallback: untyped) { () -> untyped } -> untyped
217
216
  def skip_in_dry_run(dry_run_name = nil, fallback: nil)
218
- local_job = job
219
- task = task_context.task
220
-
221
- raise "job is not set" if local_job.nil?
222
- raise "skip_in_dry_run can be called only within with_task_context" if task.nil?
217
+ local_job = job || (raise "job is not set")
218
+ task_context.task || (raise "skip_in_dry_run can be called only within with_task_context")
223
219
 
224
220
  current_index = skip_in_dry_run_index
225
221
  self.skip_in_dry_run_index += 1
@@ -298,7 +294,8 @@ module JobWorkflow
298
294
 
299
295
  #: () -> bool
300
296
  def each_task?
301
- task_context.task.each?
297
+ task = task_context.task || (raise "each_task? can be called only in task")
298
+ task.each?
302
299
  end
303
300
 
304
301
  #: (untyped) -> untyped
@@ -2,6 +2,8 @@
2
2
 
3
3
  module JobWorkflow
4
4
  module DSL
5
+ # @rbs @_context: Context?
6
+
5
7
  extend ActiveSupport::Concern
6
8
 
7
9
  include ActiveJob::Continuable
@@ -19,6 +21,8 @@ module JobWorkflow
19
21
  #
20
22
  # def queue_name: () -> String
21
23
  #
24
+ # def arguments: () -> Array[untyped]
25
+ #
22
26
  # def set: (Hash[Symbol, untyped]) -> self
23
27
  #
24
28
  # def step: (Symbol, ?start: ActiveJob::Continuation::_Succ, ?isolated: bool) -> void
@@ -33,13 +37,13 @@ module JobWorkflow
33
37
  #: (Hash[untyped, untyped]) -> void
34
38
  def perform(arguments)
35
39
  self._context ||= Context.from_hash({ job: self, workflow: self.class._workflow })
36
- context = self._context #: Context
40
+ context = _context #: Context
37
41
  Runner.new(context: context._update_arguments(arguments)).run
38
42
  end
39
43
 
40
44
  #: () -> Output
41
45
  def output
42
- context = self._context
46
+ context = _context
43
47
  raise "context is not set." if context.nil?
44
48
 
45
49
  context.output
@@ -211,14 +215,16 @@ module JobWorkflow
211
215
  # ) -> void
212
216
  def workflow_concurrency(to:, key:, **opts)
213
217
  concurrency_key_proc = key
218
+ wrapped_key = proc {
219
+ # @type self: DSL
220
+ ctx = _context || Context.from_hash(
221
+ job: self, workflow: self.class._workflow
222
+ )._update_arguments((arguments.first || {}).symbolize_keys)
223
+ concurrency_key_proc.call(ctx)
224
+ } #: ^(untyped) -> untyped
214
225
  limits_concurrency(
215
226
  to:,
216
- key: proc {
217
- ctx = _context || Context.from_hash(
218
- job: self, workflow: self.class._workflow
219
- )._update_arguments((arguments.first || {}).symbolize_keys)
220
- concurrency_key_proc.call(ctx)
221
- },
227
+ key: wrapped_key,
222
228
  **opts
223
229
  )
224
230
  end
@@ -45,6 +45,7 @@ module JobWorkflow
45
45
  # @rbs!
46
46
  # def self.subscriptions: () -> Array[untyped]
47
47
  # def self.subscriptions=: (Array[untyped]) -> void
48
+
48
49
  cattr_accessor :subscriptions, instance_accessor: false, default: []
49
50
 
50
51
  class << self
@@ -110,6 +111,7 @@ module JobWorkflow
110
111
  [span, token]
111
112
  end
112
113
 
114
+ #: (String, Hash[Symbol, untyped]) -> untyped
113
115
  def start_span(name, payload)
114
116
  span_name = build_span_name(name, payload)
115
117
  attributes = build_attributes(payload)
@@ -14,8 +14,7 @@ module JobWorkflow
14
14
  # JobWorkflow.logger.formatter = JobWorkflow::Logger::JsonFormatter.new(log_tags: [:request_id])
15
15
  # ```
16
16
  module Logger
17
- #: (ActiveSupport::Logger) -> void
18
- attr_writer :logger
17
+ attr_writer :logger #: ActiveSupport::Logger
19
18
 
20
19
  #: () -> ActiveSupport::Logger
21
20
  def logger