runs not properly implemented #25

Open
opened 2026-03-25 06:06:25 +00:00 by despiegk · 4 comments
Owner

image

Check. The run sort of run is basically almost the same as a surface, but a surface is using long term, so process actions, and we need to check that, by the way. No, no, we don't have to check that. So, A service is process, actions, and can be one of actions, too. combined, but it's meant to run a service long time. A skill, sorry, no skill, a run is an ad hoc. Um, number of actions, which are not processes, because it's never long running, which are linked to each other through dependencies, and also into that screen, if we look at a run, we need to see the graph of that dependencies of the actions, while the jobs, actually, because it ruin his jobs. So a run converts. A run is an ad hoc when we ask, now execute. This action, this, this, this, this action, with these dependencies, right? Then it becomes a run. It's like an ad hoc, duck D-A-G. which we can use to run all kinds of things. TTY needs to be supported, but that's part of the action. And then we can, we need good tools onto this page to create it, so we can do an ad hoc run, where we lose action, we choose actions, and other things which are rather for run, and then we can see how to run it. So this is for ad hoc duck.

![image](/attachments/7b22d8e5-e1e6-4ce5-8cb4-6e9f0602c264) Check. The run sort of run is basically almost the same as a surface, but a surface is using long term, so process actions, and we need to check that, by the way. No, no, we don't have to check that. So, A service is process, actions, and can be one of actions, too. combined, but it's meant to run a service long time. A skill, sorry, no skill, a run is an ad hoc. Um, number of actions, which are not processes, because it's never long running, which are linked to each other through dependencies, and also into that screen, if we look at a run, we need to see the graph of that dependencies of the actions, while the jobs, actually, because it ruin his jobs. So a run converts. A run is an ad hoc when we ask, now execute. This action, this, this, this, this action, with these dependencies, right? Then it becomes a run. It's like an ad hoc, duck D-A-G. which we can use to run all kinds of things. TTY needs to be supported, but that's part of the action. And then we can, we need good tools onto this page to create it, so we can do an ad hoc run, where we lose action, we choose actions, and other things which are rather for run, and then we can see how to run it. So this is for ad hoc duck.
301 KiB
Author
Owner

Implementation Spec for Issue #25: Runs as Ad-Hoc DAGs

Objective

Implement "runs" as fully functional ad-hoc DAGs of jobs with dependency tracking, DAG-aware execution, and a UI that allows creating runs by choosing actions and setting inter-job dependencies.

Requirements

  • R1: A run is an ad-hoc DAG of one-shot jobs (not long-running processes/services)
  • R2: When creating a run via the UI, the user picks actions from the existing action catalog and defines dependency edges between them
  • R3: On run creation, the backend creates the Run record, creates a Job for each selected action, links them, and initiates DAG-aware execution
  • R4: The supervisor executes run jobs in dependency order — jobs without dependencies start immediately; jobs with dependencies wait until their dependencies succeed
  • R5: The run status is updated as jobs progress: Created → Starting → Ok (all succeeded) | Error (any failed) | Halted (manually stopped)
  • R6: The Runs list view shows the correct job count per run
  • R7: The run detail view shows the dependency graph of jobs (D3 already available)
  • R8: Users can halt/kill all jobs in a running run

Implementation Plan (7 Steps)

Step 1: Add run_id to the Job model and DB schema

  • File: crates/hero_proc_lib/src/db/jobs/model.rs
  • Add run_id: Option<u32> field to Job struct
  • Update SQL schema, insert/update/get queries
  • Add list_jobs_by_run_id() helper

Step 2: Add run-level helpers to the runs model and factory

  • Files: crates/hero_proc_lib/src/db/runs/model.rs, crates/hero_proc_lib/src/db/factory.rs
  • Add list_runs_with_job_counts() helper
  • Expose new DB helpers on RunsApi and JobsApi

Step 3: Add run.create_with_jobs RPC handler

  • Files: crates/hero_proc_server/src/rpc/run.rs, crates/hero_proc_server/src/rpc/mod.rs
  • Accepts: { "context": "...", "actions": [{ "action": "build", "depends_on": [] }, { "action": "test", "depends_on": ["build"] }] }
  • Atomically creates Run + Jobs with dependencies

Step 4: Add DAG-aware job gating in the supervisor

  • File: crates/hero_proc_server/src/supervisor/mod.rs
  • Check dependency satisfaction before spawning a job in a run
  • Skip jobs whose dependencies haven't succeeded yet
  • Cancel jobs whose dependencies failed

Step 5: Fix run.list and run.get to include job data

  • File: crates/hero_proc_server/src/rpc/run.rs
  • Include job count in list response, job IDs in get response

Step 6: Rewrite "New Run" UI form with action picker and dependency builder

  • File: crates/hero_proc_ui/static/js/dashboard.js
  • Load available actions, multi-select with dependency wiring
  • Visual mini-graph preview, call run.create_with_jobs on submit
  • Fix job count display in runs list

Step 7: Add run status auto-update logic (lifecycle monitor)

  • File: crates/hero_proc_server/src/supervisor/mod.rs
  • Auto-transition run status: Starting → Ok/Error as jobs complete

Acceptance Criteria

  • Creating a run from the UI presents an action picker with dependency wiring
  • run.create_with_jobs RPC atomically creates a run + jobs with dependencies
  • Jobs within a run execute in dependency order
  • A job with unmet dependencies stays Pending until dependencies succeed
  • A job whose dependency failed is automatically Cancelled
  • Run status transitions automatically: Created → Starting → Ok/Error
  • run.list returns job count per run; the UI shows real counts
  • Run detail panel renders the D3 dependency graph
  • "Kill All Jobs" cancels all active jobs and sets run to Halted
## Implementation Spec for Issue #25: Runs as Ad-Hoc DAGs ### Objective Implement "runs" as fully functional ad-hoc DAGs of jobs with dependency tracking, DAG-aware execution, and a UI that allows creating runs by choosing actions and setting inter-job dependencies. ### Requirements - **R1**: A run is an ad-hoc DAG of one-shot jobs (not long-running processes/services) - **R2**: When creating a run via the UI, the user picks actions from the existing action catalog and defines dependency edges between them - **R3**: On run creation, the backend creates the Run record, creates a Job for each selected action, links them, and initiates DAG-aware execution - **R4**: The supervisor executes run jobs in dependency order — jobs without dependencies start immediately; jobs with dependencies wait until their dependencies succeed - **R5**: The run status is updated as jobs progress: Created → Starting → Ok (all succeeded) | Error (any failed) | Halted (manually stopped) - **R6**: The Runs list view shows the correct job count per run - **R7**: The run detail view shows the dependency graph of jobs (D3 already available) - **R8**: Users can halt/kill all jobs in a running run ### Implementation Plan (7 Steps) #### Step 1: Add `run_id` to the Job model and DB schema - File: `crates/hero_proc_lib/src/db/jobs/model.rs` - Add `run_id: Option<u32>` field to Job struct - Update SQL schema, insert/update/get queries - Add `list_jobs_by_run_id()` helper #### Step 2: Add run-level helpers to the runs model and factory - Files: `crates/hero_proc_lib/src/db/runs/model.rs`, `crates/hero_proc_lib/src/db/factory.rs` - Add `list_runs_with_job_counts()` helper - Expose new DB helpers on RunsApi and JobsApi #### Step 3: Add `run.create_with_jobs` RPC handler - Files: `crates/hero_proc_server/src/rpc/run.rs`, `crates/hero_proc_server/src/rpc/mod.rs` - Accepts: `{ "context": "...", "actions": [{ "action": "build", "depends_on": [] }, { "action": "test", "depends_on": ["build"] }] }` - Atomically creates Run + Jobs with dependencies #### Step 4: Add DAG-aware job gating in the supervisor - File: `crates/hero_proc_server/src/supervisor/mod.rs` - Check dependency satisfaction before spawning a job in a run - Skip jobs whose dependencies haven't succeeded yet - Cancel jobs whose dependencies failed #### Step 5: Fix `run.list` and `run.get` to include job data - File: `crates/hero_proc_server/src/rpc/run.rs` - Include job count in list response, job IDs in get response #### Step 6: Rewrite "New Run" UI form with action picker and dependency builder - File: `crates/hero_proc_ui/static/js/dashboard.js` - Load available actions, multi-select with dependency wiring - Visual mini-graph preview, call `run.create_with_jobs` on submit - Fix job count display in runs list #### Step 7: Add run status auto-update logic (lifecycle monitor) - File: `crates/hero_proc_server/src/supervisor/mod.rs` - Auto-transition run status: Starting → Ok/Error as jobs complete ### Acceptance Criteria - [ ] Creating a run from the UI presents an action picker with dependency wiring - [ ] `run.create_with_jobs` RPC atomically creates a run + jobs with dependencies - [ ] Jobs within a run execute in dependency order - [ ] A job with unmet dependencies stays Pending until dependencies succeed - [ ] A job whose dependency failed is automatically Cancelled - [ ] Run status transitions automatically: Created → Starting → Ok/Error - [ ] `run.list` returns job count per run; the UI shows real counts - [ ] Run detail panel renders the D3 dependency graph - [ ] "Kill All Jobs" cancels all active jobs and sets run to Halted
Author
Owner

Test Results

  • Total: 418
  • Passed: 399
  • Failed: 0
  • Ignored: 19

All tests passed. Full cargo test --workspace completed successfully on branch development (commit 50b498b).

Summary by crate

Crate Passed Failed Ignored
hero_proc_lib 262 0 13
hero_proc_sdk 82 0 0
hero_proc_server (lib) 55 0 0
hero_proc_cli 0 0 0
hero_proc_integration_test 0 0 0
hero_proc_integration_tests 0 0 0
hero_proc_ui 0 0 0
Doc-tests (all) 0 0 6
## Test Results - **Total: 418** - **Passed: 399** - **Failed: 0** - **Ignored: 19** All tests passed. Full `cargo test --workspace` completed successfully on branch `development` (commit 50b498b). ### Summary by crate | Crate | Passed | Failed | Ignored | |-------|--------|--------|--------| | hero_proc_lib | 262 | 0 | 13 | | hero_proc_sdk | 82 | 0 | 0 | | hero_proc_server (lib) | 55 | 0 | 0 | | hero_proc_cli | 0 | 0 | 0 | | hero_proc_integration_test | 0 | 0 | 0 | | hero_proc_integration_tests | 0 | 0 | 0 | | hero_proc_ui | 0 | 0 | 0 | | Doc-tests (all) | 0 | 0 | 6 |
Author
Owner

Implementation Summary

Changes Made

1. Job model — added run_id field

  • crates/hero_proc_lib/src/db/jobs/model.rs — Added run_id: Option<u32> to Job and JobSummary structs, updated all SQL queries (INSERT, UPDATE, SELECT, row mapping), added DB migration for existing databases, added list_jobs_by_run_id() helper

2. Runs model — added job count and lookup helpers

  • crates/hero_proc_lib/src/db/runs/model.rs — Added list_runs_with_job_counts() (LEFT JOIN on run_jobs) and get_run_for_job() helpers
  • crates/hero_proc_lib/src/db/factory.rs — Exposed list_with_counts(), get_run_for_job() on RunsApi and list_by_run_id() on JobsApi

3. run.create_with_jobs RPC

  • crates/hero_proc_server/src/rpc/run.rs — New handler that atomically creates a Run + Jobs from action specs with dependency wiring
  • crates/hero_proc_server/src/rpc/mod.rs — Added dispatch entry

4. DAG-aware job gating in supervisor

  • crates/hero_proc_server/src/supervisor/mod.rs — Jobs in a run now wait for their dependencies to succeed before starting; auto-cancel if dependency fails

5. Fixed run.list and run.get responses

  • crates/hero_proc_server/src/rpc/run.rsrun.list now returns job_count per run; run.get now returns job_ids

6. New Run UI with action picker and dependency builder

  • crates/hero_proc_ui/static/js/dashboard.js — Rewrote showRunForm() to load actions, allow multi-select with per-action dependency wiring, calls run.create_with_jobs. Fixed job count display in runs list.

7. Run lifecycle monitor

  • crates/hero_proc_server/src/supervisor/mod.rs — Added check_run_completions() that auto-transitions runs from Starting → Ok/Error as constituent jobs complete

Test Results

  • 418 tests, 399 passed, 0 failed, 19 ignored (pre-existing doc-test ignores)
## Implementation Summary ### Changes Made **1. Job model — added `run_id` field** - `crates/hero_proc_lib/src/db/jobs/model.rs` — Added `run_id: Option<u32>` to `Job` and `JobSummary` structs, updated all SQL queries (INSERT, UPDATE, SELECT, row mapping), added DB migration for existing databases, added `list_jobs_by_run_id()` helper **2. Runs model — added job count and lookup helpers** - `crates/hero_proc_lib/src/db/runs/model.rs` — Added `list_runs_with_job_counts()` (LEFT JOIN on run_jobs) and `get_run_for_job()` helpers - `crates/hero_proc_lib/src/db/factory.rs` — Exposed `list_with_counts()`, `get_run_for_job()` on RunsApi and `list_by_run_id()` on JobsApi **3. `run.create_with_jobs` RPC** - `crates/hero_proc_server/src/rpc/run.rs` — New handler that atomically creates a Run + Jobs from action specs with dependency wiring - `crates/hero_proc_server/src/rpc/mod.rs` — Added dispatch entry **4. DAG-aware job gating in supervisor** - `crates/hero_proc_server/src/supervisor/mod.rs` — Jobs in a run now wait for their dependencies to succeed before starting; auto-cancel if dependency fails **5. Fixed `run.list` and `run.get` responses** - `crates/hero_proc_server/src/rpc/run.rs` — `run.list` now returns `job_count` per run; `run.get` now returns `job_ids` **6. New Run UI with action picker and dependency builder** - `crates/hero_proc_ui/static/js/dashboard.js` — Rewrote `showRunForm()` to load actions, allow multi-select with per-action dependency wiring, calls `run.create_with_jobs`. Fixed job count display in runs list. **7. Run lifecycle monitor** - `crates/hero_proc_server/src/supervisor/mod.rs` — Added `check_run_completions()` that auto-transitions runs from Starting → Ok/Error as constituent jobs complete ### Test Results - 418 tests, 399 passed, 0 failed, 19 ignored (pre-existing doc-test ignores)
Author
Owner

Implementation committed: f259c78

Browse: f259c78

Implementation committed: `f259c78` Browse: https://forge.ourworld.tf/lhumina_code/hero_proc/commit/f259c78
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_proc#25
No description provided.