fix: small correctness/security cleanups in experimental skill scripts#534
Open
jamesbroadhead wants to merge 1 commit into
Open
Conversation
Batch of small fixes surfaced by a parallel GPT 5.4 + Gemini 3.1 Pro
review. None of these are introduced by recent changes; they are
pre-existing issues that ought to land regardless.
databricks-agent-bricks/scripts/mas_manager.py:
- `_delete` now tolerates empty / non-JSON DELETE response bodies
instead of raising JSONDecodeError on success.
- `add_examples_batch` short-circuits on empty input (ThreadPoolExecutor
rejects max_workers=0).
- `_build_agent_list` validates `uc_function_name` has 3 dotted parts
and rejects missing `endpoint_name` with a clear error, instead of
IndexError / `{"name": null}` on the API.
- `main()` uses a `_parse_json_arg` helper that exits cleanly on
malformed JSON CLI args, replacing raw `json.loads` tracebacks.
databricks-execution-compute/scripts/compute.py:
- `manage-cluster --action get` now keys off the SDK's `NotFound`
exception type instead of substring-matching "does not exist" in the
message. Also returns `success: false` for the DELETED state, so
callers gating on `success` don't treat a missing cluster as a
successful lookup.
databricks-app-python/examples/llm_config.py:
- OAuth error no longer interpolates the full token-endpoint payload
(which can contain `id_token` / refresh material). Logs the present
key names instead.
- DATABRICKS_MODEL validation error drops the `response.text[:300]`
echo so server bodies don't end up in operator-visible error text.
databricks-app-python/examples/fm-minimal-chat.py:
- Docstring + `app.yaml` examples reference the actual filename
(`fm-minimal-chat.py`), not `2-minimal-chat-app.py`.
databricks-app-python/examples/fm-parallel-calls.py:
- Guard `Speedup` division on `total_time > 0` to avoid
ZeroDivisionError on fast paths.
- Convert the trailing standalone triple-quoted string (dead code) to
real `#` comments.
databricks-python-sdk/examples/5-serving-and-vector-search.py:
- Replace the `[0.1, 0.2, 0.3, ...]` literal-Ellipsis vector with a
named placeholder + comment explaining it's a stand-in.
This pull request was AI-assisted by Isaac.
Co-authored-by: Isaac
2 tasks
Author
|
Hi @calreynolds — could you take a look at this when you have a moment? Small set of fixes from a code review. Companion PR for — this comment was written by Claude |
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.
Summary
Batch of small, contained fixes surfaced by a parallel GPT 5.4 + Gemini 3.1 Pro code review. None of these are introduced by recent changes — they are pre-existing issues that ought to land regardless. Each fix is local and review-by-eye.
databricks-agent-bricks/scripts/mas_manager.py_deletenow tolerates empty / non-JSON DELETE response bodies (was raisingJSONDecodeErroron successful deletes).add_examples_batchshort-circuits on empty input (ThreadPoolExecutorrejectsmax_workers=0)._build_agent_listvalidatesuc_function_namehas 3 dotted parts (wasIndexErroron malformed) and rejects missingendpoint_namewith a clear error (was sending{"name": null}to the API).main()uses a_parse_json_arghelper that exits cleanly on malformed JSON CLI args, replacing rawjson.loadstracebacks.databricks-execution-compute/scripts/compute.pymanage-cluster --action getnow keys off the SDK's typedNotFoundexception instead of substring-matching"does not exist"in the message. Also flipssuccesstofalsefor the DELETED state so callers gating onsuccessdon't treat a missing cluster as a successful lookup.databricks-app-python/examples/llm_config.py(security)payload(which can containid_token/ refresh material). Logs the present key names instead.DATABRICKS_MODELvalidation error drops theresponse.text[:300]echo so server bodies don't end up in operator-visible error text.databricks-app-python/examples/fm-minimal-chat.pyapp.yamlexamples reference the actual filename (fm-minimal-chat.py), not2-minimal-chat-app.py.databricks-app-python/examples/fm-parallel-calls.pySpeedupdivision ontotal_time > 0to avoidZeroDivisionErroron fast paths.#comments.databricks-python-sdk/examples/5-serving-and-vector-search.py[0.1, 0.2, 0.3, ...]literal-Ellipsisvector with a named placeholder + comment explaining it's a stand-in (the literal would fail server-side if copied).Companion PR
Equivalent PR for
main(smaller —mas_manager.pyandcompute.pydon't exist underdatabricks-skills/on main): https://github.com/databricks-solutions/ai-dev-kit/pull/new/ace-review-fixes-main (will be opened next)Test plan
python3 -m py_compileon all six modified filesmas_manager.py delete_masagainst a real workspace (DELETE response.json fix)This pull request and its description were written by Isaac.