feat: add Application resource support#158
Conversation
- Regenerate controlplane client from cdrappier/application-runtime-pr2-api branch spec - Add Application models (Application, ApplicationSpec, ApplicationList) and API functions (CRUD + list revisions) - Create ApplicationInstance (async) and SyncApplicationInstance (sync) helper classes - Support create, get, list, delete, update, and create_if_not_exists operations - Export from blaxel.core.application and re-export from blaxel.core Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
✅ Linked to Linear issue ENG-2932 — status set to In Progress
Linear reference Note Posted by Linear Issue Enforcer · Tag @mendral-app with feedback. |
🔀 Component Interaction DiagramHere's a sequence diagram showing the key interactions introduced by this PR: sequenceDiagram
participant User as User Code
participant AI as ApplicationInstance<br/>(Async/Sync)
participant Config as ApplicationCreate<br/>Configuration
participant API as API Endpoint Functions<br/>(create/get/list/update/delete)
participant HTTP as HTTPX Client
participant CP as Controlplane API
Note over User, CP: CREATE Flow
User->>AI: ApplicationInstance.create(config)
AI->>Config: Normalize input (dict/config/Application)
Config-->>AI: ApplicationCreateConfiguration
AI->>AI: Build Application model (Metadata + ApplicationSpec)
AI->>API: create_application(client, body)
API->>HTTP: POST /applications
HTTP->>CP: HTTP Request
CP-->>HTTP: 200 Application / 409 Error
HTTP-->>API: Response
API-->>AI: Application or Error
AI-->>User: ApplicationInstance (wrapped)
Note over User, CP: GET Flow
User->>AI: ApplicationInstance.get(name)
AI->>API: get_application(name, client)
API->>HTTP: GET /applications/{name}
HTTP->>CP: HTTP Request
CP-->>HTTP: 200 Application / 404 Error
API-->>AI: Application or Error
AI-->>User: ApplicationInstance (wrapped)
Note over User, CP: UPDATE Flow (via Descriptor)
User->>AI: instance.update(changes)
AI->>AI: _AsyncUpdateDescriptor.__get__()
AI->>API: get_application (fetch current state)
API->>HTTP: GET /applications/{name}
HTTP-->>API: Current Application
AI->>AI: Merge changes with current state
AI->>API: update_application(name, client, merged_body)
API->>HTTP: PUT /applications/{name}
HTTP->>CP: HTTP Request
CP-->>API: Updated Application
API-->>AI: Application
AI-->>User: New ApplicationInstance
Note over User, CP: CREATE_IF_NOT_EXISTS Flow
User->>AI: ApplicationInstance.create_if_not_exists(config)
AI->>API: create_application(client, body)
API->>HTTP: POST /applications
HTTP->>CP: HTTP Request
alt Success (200)
CP-->>AI: Application
AI-->>User: ApplicationInstance
else Conflict (409)
CP-->>AI: Error (APPLICATION_ALREADY_EXISTS)
AI->>API: get_application(name, client)
API->>HTTP: GET /applications/{name}
CP-->>AI: Existing Application
AI-->>User: ApplicationInstance (existing)
end
Summary of the FlowThis PR adds full CRUD support for the Application resource, following the existing SDK patterns (similar to
Key design choices:
Note Posted by PR Sequence Diagram · Tag @mendral-app with feedback. |
🧪 Testing GuideWhat this PR addressesAdds a new Steps to exercise the new behavior
What to verify (expected behavior)
Note Posted by PR Testing Guide · Tag @mendral-app with feedback. |
The regenerated list endpoints now expect paginated {data, meta} wrappers,
but the API still returns bare arrays for older API versions. Fix:
- from_dict() in all *List models: if src_dict is a list, wrap as {"data": src_dict}
- list() methods in DriveInstance, VolumeInstance, SandboxInstance: extract .data from response
- list_executions in BlJobWrapper: extract .data from paginated response
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Check for Error responses in _delete_application_by_name and _delete_application_by_name_sync, raising ApplicationAPIError instead of silently returning Error typed as Application. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…plication-runtime-pr3-app Regenerated SDK with latest OpenAPI definitions including: - Application resource endpoints (CRUD + list revisions) - Sandbox fork/snapshot endpoints - Updated list models with cursor pagination fields Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it. |
1 similar comment
|
Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it. |
There was a problem hiding this comment.
LGTM
Both previously flagged issues (missing error handling in delete helpers) remain fixed. The new commit 27d3459 is a client regeneration adding sandbox and pagination endpoints — no new issues in the hand-written application helper code.
Tag @mendral-app with feedback or questions. View session
Fixes ENG-2932
Summary
Adds
ApplicationInstanceandSyncApplicationInstanceCRUD helpers for the new Application resource, following the same pattern asDriveInstance/VolumeInstance.Step 1 – Client regeneration: Regenerated the controlplane client from the
cdrappier/application-runtime-pr2-apibranch spec. This pulls inApplication,ApplicationSpec,ApplicationListmodels andcreate/get/list/delete/update_application+list_application_revisionsAPI functions, plus other new models from the updated spec (pagination, firewall, HIPAA, etc.).Step 2 – Application helper (
src/blaxel/core/application/):Key design choices:
ApplicationCreateConfigurationacceptsname,display_name,labels,image,region,enabledlist()handles the paginatedApplicationListresponse (extracts.data)_AsyncDeleteDescriptor/_SyncUpdateDescriptor) for class-level and instance-level callsStep 3 – Exports: Re-exported
ApplicationInstance,SyncApplicationInstance,ApplicationCreateConfiguration,ApplicationAPIErrorfromblaxel.core.Link to Devin session: https://app.devin.ai/sessions/7bcfb61fc2a0401587b0faa456cbe08d
Requested by: @drappier-charles
Note
Adds Application resource CRUD helpers (async + sync) with proper error handling, regenerates the controlplane client with pagination support, sandbox fork/snapshot endpoints, and handles bare-array backward compatibility for list endpoints.
Written by Mendral for commit 27d3459.