Files
git.stella-ops.org/docs/features/unchecked/scheduler/scheduler-graph-job-dtos.md

28 lines
2.5 KiB
Markdown

# Scheduler Graph Job DTOs (GraphBuildJob/GraphOverlayJob)
## Module
Scheduler
## Status
IMPLEMENTED
## Description
New graph-specific job contracts (GraphBuildJob, GraphOverlayJob) with state machine enforcement, metadata fields, and event schemas for graph build/overlay operations coordination between Scheduler and Cartographer/Graph services.
## Implementation Details
- **Graph Build Job Request**: `src/Scheduler/StellaOps.Scheduler.WebService/GraphJobs/GraphBuildJobRequest.cs` -- DTO for graph build job requests with source, target, and metadata fields for triggering full graph rebuilds.
- **Graph Overlay Job Request**: `src/Scheduler/StellaOps.Scheduler.WebService/GraphJobs/GraphOverlayJobRequest.cs` -- DTO for incremental graph overlay operations that merge new data into existing graphs.
- **Graph Job Service**: `src/Scheduler/StellaOps.Scheduler.WebService/GraphJobs/GraphJobService.cs` -- orchestrates graph job lifecycle with state machine enforcement (Pending, Running, Completed, Failed).
- **In-Memory Graph Job Store**: `src/Scheduler/StellaOps.Scheduler.WebService/GraphJobs/InMemoryGraphJobStore.cs` -- in-memory persistence for graph job state.
- **Cartographer Webhook Client**: `src/Scheduler/StellaOps.Scheduler.WebService/GraphJobs/CartographerWebhookClient.cs` -- HTTP client for notifying the Cartographer service of graph job state changes.
- **Graph Job Endpoints**: `src/Scheduler/StellaOps.Scheduler.WebService/GraphJobs/GraphJobEndpointExtensions.cs` -- REST endpoints for submitting, querying, and managing graph jobs.
- **Tests**: `src/Scheduler/__Tests/StellaOps.Scheduler.WebService.Tests/GraphJobs/GraphJobServiceTests.cs`, `GraphJobEndpointsTests.cs`, `CartographerWebhookClientTests.cs`
## E2E Test Plan
- [ ] Submit a `GraphBuildJobRequest` via the REST endpoint and verify it is created with "Pending" status and correct metadata fields
- [ ] Advance the job through the state machine (Pending -> Running -> Completed) and verify each transition is enforced (e.g., cannot go from Pending directly to Completed)
- [ ] Submit a `GraphOverlayJobRequest` and verify it references the existing graph to overlay onto
- [ ] Verify webhook notification: start a graph job and confirm the `CartographerWebhookClient` sends a webhook to the Cartographer service with the job details
- [ ] Attempt an invalid state transition (e.g., Completed -> Running) and verify it is rejected with an appropriate error
- [ ] Query graph jobs by status and verify filtering works correctly (e.g., only "Running" jobs are returned)