Deterministic ZIP export and 404 test coverage for consumers endpoint#7312
Merged
sfmskywalker merged 2 commits intocopilot/expose-api-endpoint-consumersfrom Feb 19, 2026
Merged
Conversation
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Expose consumers API and recursive export option
Deterministic ZIP export and 404 test coverage for consumers endpoint
Feb 19, 2026
sfmskywalker
approved these changes
Feb 19, 2026
3f8b0af
into
copilot/expose-api-endpoint-consumers
1 check passed
Contributor
Greptile SummaryThis PR addresses two specific code review comments by ensuring deterministic ZIP exports and adding test coverage for the 404 error path in the consumers endpoint.
The changes are minimal, focused, and directly address the stated review comments without introducing side effects. Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Export/Endpoint.cs | Adds deterministic ZIP export by sorting definitions by DefinitionId and setting LastWriteTime to Unix epoch |
| test/component/Elsa.Workflows.ComponentTests/Scenarios/WorkflowReferenceGraph/WorkflowReferenceGraphTests.cs | Adds 404 test coverage for consumers endpoint with non-existent workflow definition ID |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[WriteZipResponseAsync] --> B[Sort definitions by DefinitionId]
B --> C[Create ZIP Archive]
C --> D[For each sorted definition]
D --> E[Create WorkflowModel]
E --> F[Serialize to JSON]
F --> G[Create ZIP entry with filename]
G --> H[Set LastWriteTime to UnixEpoch]
H --> I[Write JSON to entry stream]
I --> J{More definitions?}
J -->|Yes| D
J -->|No| K[Send ZIP to client]
Last reviewed commit: 7314adb
sfmskywalker
added a commit
that referenced
this pull request
Feb 20, 2026
* Initial plan
* Add consumers API endpoint and enhance export with IncludeConsumingWorkflows option
- New endpoint: GET /workflow-definitions/{definitionId}/consumers
- Export request model: added IncludeConsumingWorkflows boolean property
- Export endpoint: recursive consumer discovery and inclusion in exports
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Address greptile-apps feedback: fix double-fetch, remove redundant HashSet, add version comment, remove unused params
- Extract WriteZipResponseAsync helper to avoid double-fetching definitions from DB
- Remove redundant existingDefinitionIds HashSet in IncludeConsumersAsync
- Add XML doc comment documenting that consumers are resolved at VersionOptions.Latest
- Remove unused constructor parameters (workflowDefinitionService, variableDefinitionMapper)
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Address greptile-apps round 2: 404 for unknown definitions, deterministic ZIP response, parallel BFS
- Consumers endpoint now returns 404 when the definition ID doesn't exist
- Single-workflow export always returns ZIP when includeConsumingWorkflows=true
- BFS traversal processes each frontier level concurrently via Task.WhenAll
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Implement workflow reference graph feature
- Added `IWorkflowReferenceGraphBuilder` interface for building complete graphs of workflow references.
- Created `WorkflowReferenceGraph` and `WorkflowReferenceEdge` models.
- Implemented `WorkflowReferenceGraphBuilder` service for recursive graph building.
- Replaced previous workflow reference query logic with the new graph-based approach in consumers.
* Refactor workflow consumers to utilize recursive graph-based approach for retrieving consumer definitions.
* Enhance workflow export by adding support for including consuming workflows and update nullable default values across endpoints and models.
* Add WorkflowReferenceGraphOptions for depth and definition limit configuration
- Introduced `WorkflowReferenceGraphOptions` to configure max depth and definition limits for reference graph building.
- Updated `WorkflowManagementFeature` to support configuring these options.
- Enhanced `WorkflowReferenceGraphBuilder` to respect configuration limits during graph construction process.
* Refactor `WorkflowReferenceGraphBuilder` to utilize target-typed new expressions for cleaner code.
* Add Workflow Reference Graph tests and scenarios
Introduced JSON files for parent-child-grandchild workflow hierarchy tests and implemented unit tests for `WorkflowReferenceGraphBuilder`. Also added component tests for workflow export and consumers endpoint validation. Updated project configuration for workflow JSON to always copy to output directory.
* Include DefinitionId in exported workflow definition filenames for uniqueness.
* Remove unused models and constants from `WorkflowReferenceGraphTests`.
* Refactor `WorkflowReferenceGraphBuilderTests`: streamline test setup with `SetupGraph`, replace repeated assertions with helper methods.
* Deterministic ZIP export and 404 test coverage for consumers endpoint (#7312)
* Initial plan
* Fix deterministic ZIP export and add 404 test for consumers endpoint
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>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two unresolved review comments addressed: ZIP export was non-deterministic across identical inputs, and the consumers endpoint lacked test coverage for the 404 path.
Changes
Deterministic ZIP output (
Export/Endpoint.cs)DefinitionIdbefore writing entries — eliminates ordering variance from DB query resultsentry.LastWriteTime = DateTimeOffset.UnixEpochon everyZipArchiveEntry— eliminates timestamp variance in ZIP headers404 test coverage (
WorkflowReferenceGraphTests.cs)ConsumersEndpoint_UnknownWorkflow_ReturnsNotFound: callsGetConsumersAsyncwith a non-existent definition ID and assertsRefit.ApiExceptionwithHttpStatusCode.NotFound✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.