Skip to content

Delete a namespace and everything it owns, like PHP - #678

Merged
rmcdaniel merged 2 commits into
mainfrom
rust-325-namespace-delete
Oct 23, 2026
Merged

rmcdaniel merged 2 commits into
mainfrom
rust-325-namespace-delete

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Native now serves DELETE /api/namespaces/{namespace}, which dw namespace:delete and the published SDK's deleteNamespace call. It follows published PHP's NamespaceController::destroy over NamespaceLifecycleCleanup.

Behavior

  • One transaction deletes every row the namespace owns, in PHP's order. Each table is matched by the run, instance or namespace columns the verified schema has, as PHP's column checks select them; run summaries, for instance, go by instance.
  • The response is 200 {name, status: "deleted", deleted}, with each table's non-zero count under PHP's keys.
  • Native also clears its own poll receipts and worker incarnations for the namespace. PHP has no such tables, so they are not reported.
  • A missing namespace answers PHP's 404 namespace_not_found (Namespace [name] not found.).
  • Deleting needs an admin, as updating does.
  • Explicit refusal. Native cannot delete external payload objects yet. A namespace that still references any, in the registry or in its runs' payload columns, refuses with PHP's 503 external_payload_storage_driver_unavailable and changes nothing.

Fixture first. The new reviewed namespace-delete fixture uses the unchanged published PHP SDK. The namespace holds one search attribute definition and one started, unclaimed run. The fixture checks:

  • the exact counts: one command, two history events, one task, one definition, one run summary, one run and one instance;
  • the 404 on read and on a second raw delete;
  • the SDK's typed ServerException 404 for the SDK's own second delete;
  • that a run in another namespace remains, and the deleted run's workflow ID starts again.

PHP fills its timeline, timer and lineage projections asynchronously, so those counts may be absent or positive. Embedded declares HTTP namespaces inapplicable.

Evidence

  • The probe ran locally against the frozen published PHP 2.5.14 image on SQLite, and checkNamespaceDelete accepted the observation. Those counts are the fixture's expected values.
  • ServerParityNamespaceDeleteContractTest.mjs passes 18/18: the PHP observation, counted projections and embedded pass, and 15 mutations are refused.
  • The native tests delete a namespace with exactly PHP's counts and refuse while external payloads remain, on SQLite, PostgreSQL and MySQL.
  • The full SQLite suite with --all-targets passes: 228 unit tests and 396 execution tests.
  • Shared Server fixtures will run it against published PHP, embedded and native here.

Refs #325.

DELETE /api/namespaces/{namespace} (dw namespace:delete, the SDK's
deleteNamespace) follows PHP's NamespaceController::destroy over
NamespaceLifecycleCleanup. One transaction deletes the namespace's rows
in PHP's order, matching each table by the run, instance or namespace
columns the verified schema has, and reports each table's non-zero
count under PHP's keys. Native also clears its own poll receipts and
worker incarnations for the namespace. A missing namespace answers PHP's
404 namespace_not_found; deleting needs an admin, like updating.

Native does not delete external payload objects yet, so a namespace that
still references one refuses with PHP's 503
external_payload_storage_driver_unavailable before changing anything.

The new reviewed namespace-delete fixture runs through the unchanged
published PHP SDK: one search attribute definition and one started run,
the exact counts published PHP 2.5.14 reports, the 404s afterwards, the
SDK's typed refusal of a second delete, an untouched run elsewhere and
the freed workflow ID. PHP's asynchronously filled timeline, timer and
lineage projections may be counted. Embedded has no HTTP namespaces.
Every runtime module repeated the same fifteen-line bound list on its
Store impl, which Sonar counts as duplicated new code. store_methods!
holds the list; namespace cleanup uses it.
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Merged into the #675 train at 1448737bb. Re-checked locally against the new PHP 2.11.1 reference: the namespace-delete fixture passes on PHP, embedded (inapplicable) and native, and the three-way comparison passes. Sonar's duplication gate now passes after the store_methods! change. This PR closes when the train lands.

@rmcdaniel
rmcdaniel merged commit 1448737 into main Oct 23, 2026
21 of 27 checks passed
@rmcdaniel
rmcdaniel deleted the rust-325-namespace-delete branch October 23, 2026 13:31
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