-
Notifications
You must be signed in to change notification settings - Fork 256
feat(luminork): add bulk component operations endpoints #7776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jhelwig
wants to merge
9
commits into
main
Choose a base branch
from
jhelwig/luminork-bulk-components
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Dependency Review✅ No vulnerabilities or OpenSSF Scorecard issues found.Scanned FilesNone |
3bc0055 to
d176963
Compare
Add error variant for wrapping component operation errors with index context during bulk operations. The variant delegates HTTP status to the underlying error while enhancing the message with the failing item index. This enables agents to identify which item in a bulk request caused a failure while maintaining proper error semantics.
Create operations.rs module with create_component_core and update_component_core functions that contain all business logic and transactional operations (audit logs, WsEvents). These functions deliberately exclude HTTP layer concerns (commits, PostHog tracking) to enable reuse across single and bulk handlers. The core functions handle: - Schema resolution and variant selection - Component creation/updating with proper audit logging - Attribute and secret management - Management relationship setup - WsEvent emission for updates This separation enables shared logic between single-item and bulk component operations while maintaining a single source of truth for business logic. Also made resolve_secret_id pub(super) in update_component.rs to support reuse in operations module.
Refactor create_component handler to delegate business logic to operations::create_component_core while keeping HTTP layer concerns (validation, PostHog tracking, commit) in the handler. This establishes the pattern for sharing logic between single-item and bulk operations while maintaining clear separation of concerns.
Refactor update_component handler to delegate business logic to operations::update_component_core while keeping HTTP layer concerns (validation, PostHog tracking, commit) in the handler. Completes the refactoring pattern for sharing logic between single-item and bulk operations.
Implement POST /components/create_many endpoint for efficient batch component creation via MCP tools. Features: - Processes multiple creation requests in single transaction - Lazy caching of component list (only fetches if managed_by used) - Stop-on-first-error with index context for agent debugging - Returns results in same order as request for correlation - All-or-nothing commit semantics Enables AI agents to minimize API round trips when creating multiple components.
Implement PUT /components/update_many endpoint for efficient batch component updates via MCP tools. Features: - Processes multiple update requests in single transaction - Stop-on-first-error with index context for agent debugging - Returns results in same order as request for correlation - All-or-nothing commit semantics - Supports all single-update features (name, resource_id, secrets, attributes) Enables AI agents to efficiently update multiple components in one request.
Implement DELETE /components/delete_many endpoint for efficient batch component soft-deletion via MCP tools. Features: - Soft-deletes (marks for deletion) multiple components - Fetches shared data once (head_components, socket maps, base context) - Maintains socket maps across deletions for efficiency - Returns status per component (marked_for_deletion, still_exists_on_head, deleted) - Stop-on-first-error with index context - All-or-nothing commit semantics Enables AI agents to efficiently delete multiple components in one request.
Implement POST /components/erase_many endpoint for efficient batch component hard-deletion via MCP tools. Features: - Hard-deletes (immediate removal) multiple components - Fetches shared data once (head_components, socket maps, base context) - Writes audit log per component erasure (transactional) - Returns erased component IDs in request order - Stop-on-first-error with index context - All-or-nothing commit semantics Enables AI agents to efficiently erase multiple components in one request without queueing delete actions.
Add routes for all four bulk component operations: - POST /create_many - Bulk component creation - PUT /update_many - Bulk component updates - DELETE /delete_many - Bulk component soft-deletion - POST /erase_many - Bulk component hard-deletion Completes the routing layer for bulk component operations, making all endpoints accessible via the API.
d176963 to
4b15071
Compare
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.
Problem
The Luminork API currently requires separate HTTP requests for each component operation (create, update, delete, erase). When users need to perform operations on multiple components—such as provisioning infrastructure with dozens of resources, bulk updating configuration, or cleaning up test environments—this creates significant overhead:
This becomes particularly problematic for:
Impact
Users working with multiple components face:
This particularly affects:
Solution
This PR adds four new bulk operation endpoints to the Luminork V1 API:
Implementation approach:
After this change, users can perform bulk operations with:
Design Rationale
Why fail-fast vs. partial success?
Why lazy-fetch component list?
Why same route prefix (`/components/*_many`)?
Deployment Notes
API changes:
Monitoring:
Performance characteristics:
Compatibility