feat: replace sandboxes-api with editor-service sessions API#88
Conversation
Code reviewFound 2 issues:
Same pattern in:
cli-utils/src/Keboola/Console/Command/EditorServiceClient.php Lines 24 to 28 in 8fe9a50 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
ondrajodas
left a comment
There was a problem hiding this comment.
1 - je to pokaždé jiný use-case, takže v pohodě
2 - to je pravda no, že tímto budeme mazat jen SQL worksapces
|
ad 2. no to není pravda ne? tam byly podmínky Takže to mazalo jen DB workspaces, ne? |
|
no ale když vezmeš celý kus kódu: tak je to mazalo... konkrétně na řádku 116 |
|
A kuš, tak to jsem přehlídl! Tak zpátky do výroby |
|
@ondrajodas Je to nakonec celkem dost předělaný - snažil jsem se to spíš udělat tak, aby to dávalo nějakej smysl než nutně přesně tak jak to bylo předtím :D |
ondrajodas
left a comment
There was a problem hiding this comment.
asi to bude v pohodě, jen drobnosti
| // First call moves the configuration to trash, second call permanently purges it. | ||
| $storageComponents->deleteConfiguration('keboola.sandboxes', $app->getConfigId()); | ||
| $storageComponents->deleteConfiguration('keboola.sandboxes', $app->getConfigId()); |
| )); | ||
| continue; | ||
| } | ||
| if ($exception->getCode() !== 404) { |
There was a problem hiding this comment.
dřív tu byl check jestli existuje token a teď se kontroluje jestli je uživatel v projektu?
asi ok, ale zůstanou tu WSs které mají neplatný token
There was a problem hiding this comment.
Upravil jsem popis a doplnil tam comment aby to bylo jasnější, editor je vázáný na uživatele (a jinak není v UI vidět), sandbox na token
https://linear.app/keboola/issue/AJDA-1942
Description
Replaces all usages of the sandboxes-api PHP client with the editor-service sessions API (SQL workspaces) and the sandboxes-service-api-client (Python/R sandboxes), as the sandboxes API is being turned off. Introduces a lightweight
EditorServiceClientwith list and delete endpoints, adds Python/R sandbox deletion via Job Queue jobs, and removes the now-obsoleteDeleteProjectSandboxescommand.Ownership model
The two resource types use different identity anchors:
userId, which is stable for the entire lifetime of the user in the system. A session is ownerless whenuserIdis no longer present among any active project token'sadmin.id.creatorToken.id, which is re-issued every time a user leaves and re-enters a project (the old token is deleted, a new one issued). A config is ownerless when itscreatorToken.idno longer exists inlistTokens(). A user who rejoins the project keeps their editor sessions but loses their old sandbox configs — this is intentional and matches the previous sandboxes-api behavior.Job-queue deletion fallback
The normal deletion path enqueues a
keboola.sandboxesjob withtask=delete; the job deletes the app on success. If job creation fails, the app may already be in a partially-deleted state, so the catch block callsdeleteApp()+ double-deleteConfiguration()to finish cleanup directly rather than leaving things inconsistent.Release Notes
Change Type
Refactoring / internal improvement — migrates from sandboxes-api to editor-service and sandbox-service APIs; adds Python/R sandbox handling to ownerless workspace cleanup commands.
Justification
The sandboxes API is being turned off. SQL workspace sessions are now listed via the editor-service and deleted by removing the associated storage configuration (double-call pattern to purge from trash). Python/R sandboxes are listed via the sandbox-service API and deleted via a Job Queue job of
keboola.sandboxes.Plans for Customer Communication
No customer-facing changes; these are internal maintenance CLI commands.
Impact Analysis
Low risk. Affects three commands (
DeleteOwnerlessWorkspaces,DeleteOrganizationOwnerlessWorkspaces,MassDeleteProjectWorkspaces) and removes one (DeleteProjectSandboxes). No breaking changes to command interfaces. Adds dependency onkeboola/sandboxes-service-api-clientandkeboola/service-client.composer.jsoncurrently referenceskeboola/sandboxes-service-api-client: dev-odin/AJDA-1942(the upstream branch that adds thetypesfilter toAppsApiClient::listApps()). This must be replaced with a stable tagged release (^1.8.0) before merging. Tracked in keboola/sandboxes-service-api-php-client.Deployment Plan
Standard CI/CD continuous deployment across all stacks.
Rollback Plan
Standard git revert if issues detected post-deployment.
Post-Release Support Plan
No follow-up actions needed.