Skip to content

Lift legacy UserToolSource representations on read#22624

Open
mvdbeek wants to merge 1 commit intogalaxyproject:devfrom
mvdbeek:worktree-sentry-297782-unprivileged-tools-response
Open

Lift legacy UserToolSource representations on read#22624
mvdbeek wants to merge 1 commit intogalaxyproject:devfrom
mvdbeek:worktree-sentry-297782-unprivileged-tools-response

Conversation

@mvdbeek
Copy link
Copy Markdown
Member

@mvdbeek mvdbeek commented May 2, 2026

Stored DynamicTool.value rows on long-lived servers predate the YAML narrowing in ec5cfe6 and carry internal-model fields the strict schema rejects, causing 500 ResponseValidationError on GET /api/unprivileged_tools (Sentry GALAXY-TEST-588ZYT7JSX3V0).

Adds lift_user_tool_source(value) which validates against the strict UserToolSource and returns one of three statuses:

  • "ok": clean row, parsed model.
  • "lifted": extra_forbidden-only drift; offending paths are stripped and the model is re-validated. Dropped paths are reported.
  • "invalid": any other schema violation; raw dict is returned with a compact error summary so the endpoint stays up under future tightening (e.g. stricter container constraints).

UnprivilegedToolResponse.representation becomes
Union[UserToolSource, dict] with new representation_status and representation_errors fields. Status is also surfaced via Warning, X-Galaxy-Deprecated-Fields, and X-Galaxy-Schema-Errors response headers (computed per request, not part of the OpenAPI schema). The same lift is applied in /api/tools/{id}/raw_tool_source.

Frontend: UserToolPanel reads representation defensively and shows "needs update" / "schema error" badges.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@github-project-automation github-project-automation Bot moved this to Needs Review in Galaxy Dev - weeklies May 2, 2026
@github-actions github-actions Bot added this to the 26.1 milestone May 2, 2026
@mvdbeek mvdbeek force-pushed the worktree-sentry-297782-unprivileged-tools-response branch 2 times, most recently from 1c6ab18 to af2a6bf Compare May 2, 2026 12:46
Stored DynamicTool.value rows on long-lived servers predate the YAML
narrowing in ec5cfe6 and carry internal-model fields the strict
schema rejects, causing 500 ResponseValidationError on
GET /api/unprivileged_tools (Sentry GALAXY-TEST-588ZYT7JSX3V0).

Adds lift_user_tool_source(value) which validates against the strict
UserToolSource and returns one of three statuses:
  - "ok": clean row, parsed model.
  - "lifted": extra_forbidden-only drift; offending paths are stripped
    and the model is re-validated. Dropped paths are reported.
  - "invalid": any other schema violation; raw dict is returned with a
    compact error summary so the endpoint stays up under future
    tightening (e.g. stricter container constraints).

UnprivilegedToolResponse.representation becomes
Union[UserToolSource, dict] with new representation_status and
representation_errors fields. Status is also surfaced via Warning,
X-Galaxy-Deprecated-Fields, and X-Galaxy-Schema-Errors response
headers (computed per request, not part of the OpenAPI schema).
The same lift is applied in /api/tools/{id}/raw_tool_source.

Frontend: UserToolPanel reads representation defensively and shows
"needs update" / "schema error" badges.
@mvdbeek mvdbeek force-pushed the worktree-sentry-297782-unprivileged-tools-response branch from af2a6bf to 113626c Compare May 2, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

1 participant