feat(data-app): add data-app update and report Storage access in detail (#737) - #740
Draft
padak wants to merge 1 commit into
Draft
feat(data-app): add data-app update and report Storage access in detail (#737)#740padak wants to merge 1 commit into
data-app update and report Storage access in detail (#737)#740padak wants to merge 1 commit into
Conversation
…etail` (#737) `data-app create` could set `runtime.workspace.enabled` and `parameters.autoSuspendAfterSeconds`; nothing could change them afterwards. For an app created in the UI, or by an older kbagent, the only CLI path was `sync init` + `sync pull` + hand-editing `_config.yml` + `sync push` -- heavy and schema-aware for a two-field change. `data-app detail` did not report Storage access either, so the deploys-green-but-reads-nothing symptom could not be diagnosed from the CLI at all. - New `data-app update --project P --app-id ID` with `--workspace/--no-workspace`, `--auto-suspend`, `--size`, `--auth`, `--git-branch`, `--branch`, `--dry-run`. Read-modify-write over the whole Storage config body: only the flags passed are touched, so secrets, the encrypted git `#password` and the storage mapping survive bit-identical. - `--workspace` is tri-state: omitting it leaves Storage access unchanged, so an `--auto-suspend` change can never silently revoke it. `--no-workspace` deletes the `runtime.workspace` key rather than writing `enabled: false`, matching what `create --no-workspace` produces. - A request whose values already match writes nothing: `changed: []`, `deploy_required: false`, no config version minted. - `--git-branch` on a Keboola-managed repo (no `parameters.dataApp.git`) fails with DATA_APP_INVALID_GIT instead of inventing a block. - `data-app detail` gains `workspace_enabled` ("Storage access: enabled/disabled" in human mode). - REST parity: `PATCH /data-apps/{project}/{app_id}`, registered in SERVE_COMMAND_MAP; permission key `data-app.update` (write). `services/data_app_service.py` is grandfathered by the file-size gate and may only shrink, so the new logic lands in a `DataAppUpdateMixin` (`services/_data_app_update.py`) together with `_load_data_app_storage_config` moved out of it; the CLI command lives in `commands/_data_app_settings.py`. Tested: 24 new unit tests (service read-modify-write, no-op, dry-run, validation; CLI flag plumbing and tri-state `--workspace`), one live E2E case toggling Storage access on a real app. `make check` green.
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.
What
Adds
kbagent data-app updateand surfaces the Storage-access state ondata-app detail.Flags:
--workspace/--no-workspace,--auto-suspend N,--size,--auth,--git-branch,--branch,--dry-run.Why
data-app createcould setruntime.workspace.enabledandparameters.autoSuspendAfterSeconds; nothing could change them afterwards. For an app created in the UI, or by an older kbagent, the only CLI path wassync init+sync pull+ hand-editing_config.yml+sync push— heavy and schema-aware for a two-field change.data-app detaildid not report Storage access either (it shows size, auto-suspend, git and secrets, notruntime.workspace), so the symptom that motivated the issue — an app that deploys, reportsstate=running, passes its health probe and then fails every Storage call — could not be diagnosed from the CLI at all.Design notes
configurationfield is a full-document overwrite, so only the fields the caller passes are touched:parameters.dataApp.secrets, the encrypted git#passwordand the storage input/output mapping all survive bit-identical. Asserted by a test.--workspaceis tri-state, not a boolean. Omitting it leaves Storage access unchanged. A flag defaulting toFalsewould silently revoke Storage access on every--auto-suspendchange.--no-workspacedeletesruntime.workspacerather than writingenabled: false— byte-identical to whatcreate --no-workspaceproduces, so the two paths cannot diverge andsync diffsees no phantom drift.changed: [],deploy_required: false, no config version minted, no Storage PUT.--git-branchis external-repo only. A Keboola-managed repo has noparameters.dataApp.gitblock (the Git Service owns the link), so it fails withDATA_APP_INVALID_GITinstead of inventing one.configVersion; the result carriesdeploy_required: trueand the exact next command.File placement
services/data_app_service.pyis grandfathered byscripts/check_file_size.pyat 1641 code lines and may only shrink, so the new logic could not land inline. It is aDataAppUpdateMixininservices/_data_app_update.py, into which_load_data_app_storage_configwas also moved (the service is now 1616). The CLI command lives incommands/_data_app_settings.py, following the existing_data_app_git.py/_data_app_runtime.pysplit socommands/data_app.pystays under its soft ceiling.Surfaces updated
Permission registry (
data-app.update= write),PATCH /data-apps/{project}/{app_id}+SERVE_COMMAND_MAP,docs/web-server-endpoints.md,CLAUDE.md,context.pyAGENT_CONTEXT,SKILL.md(regenerated),commands-reference.md,gotchas.md,data-app-workflow.md,keboola-expert.md. Version-gated asvNEXTper the release process.How it was tested
--git-branchrefusal; CLI flag plumbing including the tri-state--workspaceassertion.test_data_app_update_toggles_storage_access) that creates an app, toggles Storage access off and on against a real stack, verifiesdetailreads it back, and confirms the repeat request mints no config version.make checkgreen (lint, format, ty, skill, version, version-gates, command-sync, endpoints, changelog, error-codes, sentinel-guards, file-size, 6590 tests).Fixes #737