elsa-core/specs/001-shell-reload-api/plan.md
Sipke Schoorstra 21e982c2c6
Add shell reload API endpoints and client support (#7353)
* feat: add specification and quality checklist for Shell Reload API endpoints

* feat: implement Shell Reload API endpoints and associated documentation

* feat: enhance Shell Reload API documentation and add tasks for implementation phases

* feat: implement Shell Reload API features with endpoints, interface contracts, models, and component tests

* feat: update Shell Reload API responses and tests to reflect changes in error handling and response structure

* Fix shell reload follow-up review issues (#7354)

* Initial plan

* Address shell reload review feedback

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Dispose shell reload semaphore

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Harden shell reload follow-up fixes

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Api/Endpoints/Shells/Reload/Endpoint.cs

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'Missed opportunity to use Where'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Api/Endpoints/Shells/Reload/Endpoint.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-09 08:37:11 +01:00

92 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Implementation Plan: Shell Reload API Endpoints
**Branch**: `001-shell-reload-api` | **Date**: 2026-03-08 | **Spec**: `./spec.md`
**Input**: Feature specification from `/specs/001-shell-reload-api/spec.md`
## Summary
Add two administrative shell reload endpoints and a matching typed API client surface so operators can refresh shell-backed feature configuration without restarting the host. The implementation will use a dedicated shell reload orchestration service in `Elsa.Workflows.Api` to validate shell IDs, reject concurrent reloads, wrap the current full-reload fallback for targeted requests, and return detailed per-shell outcomes that satisfy the clarified spec.
## Technical Context
**Language/Version**: C# latest on .NET 10.0 primary, with existing multi-target support for .NET 8.0 and .NET 9.0
**Primary Dependencies**: FastEndpoints, Elsa.Api.Common abstractions, CShells, CShells.FastEndpoints.Abstractions, Refit client contracts, xUnit component test infrastructure
**Storage**: No new persistent storage; uses the existing CShells shell settings provider and in-memory shell settings cache
**Testing**: xUnit component tests in `Elsa.Workflows.ComponentTests`; no existing dedicated `Elsa.Workflows.Api` unit test project
**Target Platform**: ASP.NET Core modular server host exposing Elsa REST APIs through shell-aware FastEndpoints
**Project Type**: Modular .NET library feature plus first-party API client contract
**Performance Goals**: Keep shell reload as a synchronous admin operation within the existing API client timeout budget of 1 minute; do not add background polling or queued work
**Constraints**: Preserve existing shell-aware endpoint discovery, keep the feature scoped to current modules, reject concurrent reload requests, return per-shell outcomes, and keep targeted reload on full-reload fallback semantics until upstream CShells adds a selective reload API
**Scale/Scope**: Two new endpoints, one shared response contract, one orchestration service, one API client resource, and focused component-test coverage in the existing server fixture
## Constitution Check
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
**Pre-Phase 0 Gate Review**
- **I. Modular Architecture**: PASS. Changes stay inside existing bounded areas: `Elsa.Workflows.Api`, `Elsa.Api.Client`, and `Elsa.Workflows.ComponentTests`.
- **II. Composition & Extensibility**: PASS. A dedicated orchestration contract isolates current fallback behavior from future upstream targeted reload support.
- **III. Convention-Driven Design**: PASS. Endpoints will remain one-class-per-endpoint with collocated request/response models and standard permission configuration.
- **IV. Async & Pipeline Execution**: PASS. Endpoint and orchestration flows remain async-only and use existing middleware/endpoint infrastructure.
- **V. Testing Discipline**: PASS. Feature verification will use the existing component-test host and endpoint-style tests already used for REST APIs.
- **VI. Trunk-Based Development**: PASS. The change is one concern and includes API contract artifacts for downstream client work.
- **VII. Simplicity & Focus**: PASS. No new module is introduced; one orchestration service is the minimum additional abstraction needed to satisfy busy-state handling, fallback semantics, and detailed outcomes.
**Post-Phase 1 Design Review**
- PASS. The design keeps the concern localized, introduces no extra module boundary, uses collocated endpoint models, and adds only one new service abstraction because direct endpoint-to-`IShellManager` calls cannot satisfy partial-success reporting, busy rejection, and requested-shell strictness together.
## Project Structure
### Documentation (this feature)
```text
specs/001-shell-reload-api/
├── plan.md
├── research.md
├── data-model.md
├── quickstart.md
├── contracts/
│ └── shell-reload-api.yaml
└── tasks.md
```
### Source Code (repository root)
```text
src/
├── modules/
│ └── Elsa.Workflows.Api/
│ ├── Contracts/
│ ├── Services/
│ └── Endpoints/
│ └── Shells/
│ ├── Reload/
│ └── ReloadAll/
└── clients/
└── Elsa.Api.Client/
└── Resources/
└── Shells/
├── Contracts/
├── Requests/
├── Responses/
└── Models/
test/
└── component/
└── Elsa.Workflows.ComponentTests/
└── Scenarios/
└── RestApis/
└── Endpoints/
└── Shells/
```
**Structure Decision**: Extend the existing workflow API module and first-party API client instead of adding a new shell-management module. This aligns with the repository’s established pattern where administrative REST endpoints and typed client contracts evolve together while component tests validate behavior through the hosted server fixture.
Endpoint-specific request and response models remain collocated under `Endpoints/Shells/Reload/` and `Endpoints/Shells/ReloadAll/`. Shared orchestration result types belong under `Contracts/` so endpoint model colocation is preserved.
## Complexity Tracking
No constitutional violations requiring justification.