Skip to content

Commit 2b186cb

Browse files
committed
bundle: address genie_space PR review comments
Apply the unresolved self-review comments on PR #5282: - Permissions use object type "genie" (endpoint /permissions/genie/{id}) rather than "genie/spaces" (permissions.go, all_test.go, and the testserver object-type map). - parent_path is a normal, updatable field now that the Genie GET API returns it (without the /Workspace prefix) and the update API accepts it: * DoRead re-adds the /Workspace prefix via the shared ensureWorkspacePrefix (mirrors ResourceDashboard) instead of clearing the field. * DoUpdate sends parent_path so the backend can move the space. * Removed parent_path from recreate_on_changes and ignore_remote_changes. * The testserver strips the /Workspace prefix on write to match the real API, and `generate genie-space` re-adds it so the generated config keeps the conventional form. * Renamed the parent_path_recreate acceptance test to parent_path_update: changing parent_path now plans an update, not a recreate. - serialized_space uses reason: etag_based (matching dashboards) since drift is detected via etag. Also switches isMissingGenieParentPathError to errors.AsType[T] (forbidigo rule from the SDK bump on main) and lets testifylint rewrite the genie assertions in state_load_test.go to assert.Empty. Co-authored-by: Isaac
1 parent e5d49dd commit 2b186cb

18 files changed

Lines changed: 72 additions & 65 deletions

File tree

acceptance/bundle/resources/genie_spaces/inline/out.plan.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"remote_state": {
1010
"description": "Inline serialized_space test",
1111
"etag": "1",
12+
"parent_path": "/Workspace/Users/[USERNAME]",
1213
"serialized_space": "{\"config\":{\"sample_questions\":[{\"id\":\"sq-001\",\"question\":[\"What is the total revenue?\"]}]},\"data_sources\":{\"tables\":[{\"column_configs\":[{\"column_name\":\"amount\",\"get_example_values\":true}],\"identifier\":\"main.sales.orders\"}]},\"version\":1}",
1314
"space_id": "[GENIE_SPACE_ID]",
1415
"title": "Sales Analytics Inline Genie",
@@ -20,12 +21,6 @@
2021
"reason": "custom",
2122
"old": "1",
2223
"remote": "1"
23-
},
24-
"parent_path": {
25-
"action": "skip",
26-
"reason": "input_only",
27-
"old": "/Workspace/Users/[USERNAME]",
28-
"new": "/Workspace/Users/[USERNAME]"
2924
}
3025
}
3126
}

acceptance/bundle/resources/genie_spaces/parent_path_recreate/output.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

acceptance/bundle/resources/genie_spaces/parent_path_recreate/databricks.yml.tmpl renamed to acceptance/bundle/resources/genie_spaces/parent_path_update/databricks.yml.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
bundle:
2-
name: recreate-genie-space-$UNIQUE_NAME
2+
name: update-genie-space-$UNIQUE_NAME
33

44
resources:
55
genie_spaces:
6-
recreate_target:
7-
title: "Recreate Target"
6+
update_target:
7+
title: "Update Target"
88
warehouse_id: "test-warehouse-id"
99
parent_path: PARENT_PATH_PLACEHOLDER
1010
serialized_space: "{}"

acceptance/bundle/resources/genie_spaces/parent_path_recreate/out.test.toml renamed to acceptance/bundle/resources/genie_spaces/parent_path_update/out.test.toml

File renamed without changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
>>> [CLI] bundle deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-genie-space-[UNIQUE_NAME]/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
=== Plan after changing parent_path should show update
9+
>>> [CLI] bundle plan
10+
update genie_spaces.update_target
11+
12+
Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
13+
14+
>>> [CLI] bundle destroy --auto-approve
15+
The following resources will be deleted:
16+
delete resources.genie_spaces.update_target
17+
18+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/update-genie-space-[UNIQUE_NAME]/default
19+
20+
Deleting files...
21+
Destroy complete!

acceptance/bundle/resources/genie_spaces/parent_path_recreate/script renamed to acceptance/bundle/resources/genie_spaces/parent_path_update/script

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ trap cleanup EXIT
77
envsubst < databricks.yml.tmpl | sed "s|PARENT_PATH_PLACEHOLDER|/Users/$CURRENT_USER_NAME/genie-old|" > databricks.yml
88
trace $CLI bundle deploy
99

10-
# Change parent_path. parent_path is recreate_on_changes in resources.yml,
11-
# so the plan should show a recreate (delete + create) rather than an update.
10+
# Change parent_path. The Genie update API moves the space to the new parent,
11+
# so the plan should show an update rather than a recreate (delete + create).
1212
envsubst < databricks.yml.tmpl | sed "s|PARENT_PATH_PLACEHOLDER|/Users/$CURRENT_USER_NAME/genie-new|" > databricks.yml
13-
title "Plan after changing parent_path should show recreate"
13+
title "Plan after changing parent_path should show update"
1414
trace $CLI bundle plan

acceptance/bundle/resources/genie_spaces/parent_path_recreate/test.toml renamed to acceptance/bundle/resources/genie_spaces/parent_path_update/test.toml

File renamed without changes.

acceptance/bundle/resources/genie_spaces/simple/out.plan.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"remote_state": {
1010
"description": "AI assistant for sales data analysis",
1111
"etag": "1",
12+
"parent_path": "/Workspace/Users/[USERNAME]",
1213
"serialized_space": "{\n \"benchmarks\": {\n \"questions\": [\n {\n \"answer\": [\n {\n \"content\": [\n \"SELECT\\n\",\n \" name,\\n\",\n \" country\\n\",\n \"FROM main.default.countries\\n\",\n \"ORDER BY name\"\n ],\n \"format\": \"SQL\"\n }\n ],\n \"id\": \"[NUMID]\",\n \"question\": [\n \"Show all names and countries\"\n ]\n }\n ]\n },\n \"config\": {\n \"sample_questions\": [\n {\n \"id\": \"[NUMID]\",\n \"question\": [\n \"List the names and countries\"\n ]\n },\n {\n \"id\": \"[NUMID]\",\n \"question\": [\n \"Which names are in Canada?\"\n ]\n }\n ]\n },\n \"data_sources\": {\n \"tables\": [\n {\n \"column_configs\": [\n {\n \"column_name\": \"country\",\n \"enable_entity_matching\": true,\n \"enable_format_assistance\": true\n },\n {\n \"column_name\": \"name\",\n \"enable_entity_matching\": true,\n \"enable_format_assistance\": true\n }\n ],\n \"identifier\": \"main.default.countries\"\n }\n ]\n },\n \"instructions\": {\n \"example_question_sqls\": [\n {\n \"id\": \"[NUMID]\",\n \"question\": [\n \"List the names and countries\"\n ],\n \"sql\": [\n \"SELECT\\n\",\n \" name,\\n\",\n \" country\\n\",\n \"FROM main.default.countries\\n\",\n \"ORDER BY name\"\n ]\n }\n ],\n \"text_instructions\": [\n {\n \"content\": [\n \"This genie space answers simple questions about people and their countries.\\n\",\n \"Use only the main.default.countries table.\\n\",\n \"Prefer returning the name and country columns directly.\"\n ],\n \"id\": \"[NUMID]\"\n }\n ]\n },\n \"version\": 2\n}\n",
1314
"space_id": "[GENIE_SPACE_ID]",
1415
"title": "Sales Analytics Genie",
@@ -20,12 +21,6 @@
2021
"reason": "custom",
2122
"old": "1",
2223
"remote": "1"
23-
},
24-
"parent_path": {
25-
"action": "skip",
26-
"reason": "input_only",
27-
"old": "/Workspace/Users/[USERNAME]",
28-
"new": "/Workspace/Users/[USERNAME]"
2924
}
3025
}
3126
}

acceptance/bundle/resources/permissions/genie_spaces/current_can_manage/out.plan.direct.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
]
4545
},
4646
"vars": {
47-
"object_id": "/genie/spaces/${resources.genie_spaces.foo.id}"
47+
"object_id": "/genie/${resources.genie_spaces.foo.id}"
4848
}
4949
}
5050
}

acceptance/bundle/resources/permissions/genie_spaces/current_can_manage/out.requests.deploy.direct.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"method": "PUT",
3-
"path": "/api/2.0/permissions/genie/spaces/[FOO_ID]",
3+
"path": "/api/2.0/permissions/genie/[FOO_ID]",
44
"body": {
55
"access_control_list": [
66
{

0 commit comments

Comments
 (0)