Skip to content

Gate dataset-level Galaxy delete/purge (follow-up to #338)#345

Merged
dannon merged 2 commits into
galaxyproject:mainfrom
dannon:fix/338-dataset-purge-gate
Jun 20, 2026
Merged

Gate dataset-level Galaxy delete/purge (follow-up to #338)#345
dannon merged 2 commits into
galaxyproject:mainfrom
dannon:fix/338-dataset-purge-gate

Conversation

@dannon

@dannon dannon commented Jun 20, 2026

Copy link
Copy Markdown
Member

Follow-up to #338 (merged in #344).

#344 gated whole-history delete/purge but deliberately scoped dataset-level deletes out -- the raw-curl guardrail skipped the /contents/ sub-path so it couldn't mislabel a dataset delete as "entire history". A dataset purge is still irreversible data loss, just a smaller blast radius, so this extends the same classifier to it.

What changed

isGalaxyDestructiveCurl now classifies a curl/wget DELETE against /api/histories/{id}/contents/{dsid}: a plain delete reads as dataset-delete (recoverable soft-delete), and a purge (?purge=true in the query or the request body) as dataset-purge (irreversible), each with honest dataset-scoped wording. IDs are surfaced only when literal (a $VAR still matches but isn't echoed as a fake id).

No gate/policy/web changes

Both tool_call gates already route any destructive op to the same confirmation by category (galaxy:destructive), so this is just a new shape + wording in the shared classifier -- the classifier was built for exactly this kind of extension.

Scope

Covers the raw-curl path, which is the only dataset-delete vector today -- there's no MCP dataset-delete tool yet (#228). When one ships, it should get a single entry in the same catalog. Collection deletes and /api/datasets/{id} are not covered here.

Tests

Classifier unit tests for dataset delete/purge (query + body forms), shell-variable ids, and dataset-scoped wording (asserting it does NOT say "entire history" for a dataset). Full suite green; root + app typecheck clean.

dannon added 2 commits June 20, 2026 15:11
…t#338)

galaxyproject#338 added the confirmation gate for whole-history delete/purge but
deliberately scoped dataset-level deletes out -- the curl guardrail skipped the
/contents/ sub-path so it wouldn't mislabel a dataset delete as "entire
history". A dataset purge is still irreversible data loss, just smaller, so this
extends the same classifier to catch a curl/wget DELETE against
/api/histories/{id}/contents/{dsid}: a plain delete reads as a recoverable
soft-delete, a purge (query ?purge=true or request body) as irreversible, each
with dataset-scoped wording instead of the whole-history text.

No gate/policy changes were needed -- both gates already route any destructive
op to the same confirm by category, so this is just a new shape plus wording in
the shared classifier. There's still no MCP dataset-delete tool (that's galaxyproject#228);
when one lands it should get an entry in the same catalog.
A review pass flagged gaps in the dataset gate's coverage and honesty, fixed here:

- Also catch the singleton DELETE /api/datasets/{id} and batch /api/datasets
  routes, not just /api/histories/{id}/contents/{id}.
- Treat the purge values Galaxy actually accepts as truthy (1/yes/on, not only
  "true"), and treat an unknowable value -- a shell variable, or a body read
  from a file we can't inspect -- as a purge, so an irreversible purge is never
  described as "recoverable". An explicit purge=false stays a soft delete.
- Check the most-severe target first, so a whole-history delete in a command
  that also touches a dataset URL isn't concealed behind the dataset warning.
- Handle the modern typed contents routes: /contents/datasets/{id} extracts the
  real id (not the literal "datasets"), and /contents/dataset_collections/{id}
  is classified as a collection -- with wording that it removes all of its
  datasets -- instead of a single dataset.
@dannon dannon marked this pull request as ready for review June 20, 2026 19:30
@dannon dannon merged commit 3e59d16 into galaxyproject:main Jun 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant