Skip to content

test(ipam): cover deleting the default namespace with its name in the id field - #11636

Draft
ogenstad wants to merge 2 commits into
stablefrom
nisse/IFC-3635
Draft

ogenstad wants to merge 2 commits into
stablefrom
nisse/IFC-3635

Conversation

@ogenstad

@ogenstad ogenstad commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

This pull request was written by nisse, an AI agent, and opened with the GitHub account of the person who runs it. That person reviews it before marking it ready for review.

Why

Before #11583, a user who could delete namespaces could delete the default IP namespace by sending its name in the id field:

mutation { IpamNamespaceDelete(data: { id: "default" }) { ok } }

The old check compared the text in id with the UUID of the default namespace. find_object then looked up "default" with the default filter of IpamNamespace (name__value), found the default namespace and deleted it.

#11583 moved the check into _delete_obj, which compares the UUID of the node that the lookup returns, so stable already blocks this request. No test covered this request, and the changelog did not mention it.

Closes #11633

What changed

  • test_protected_default_ipnamespace and test_delete_regular_ipnamespace now also send the namespace name in id, on the default branch and on a user branch. Deleting the default namespace this way must return HTTP 422 with "Cannot delete default IPAM namespace" and leave the namespace in place. Deleting another namespace this way must delete it.
  • The test cases use a NamespaceLookup enum (id, hfid, name-as-id) instead of the by_hfid boolean. The existing test IDs (by-id, by-hfid, by-id-user-branch, by-hfid-user-branch) do not change.
  • changelog/11633.fixed.md tells users that releases before this fix deleted the default namespace when a request sent its name as id.
  • Application code does not change. The fix reaches develop when stable is merged into it, because develop still has the old check in mutate_delete.

How to review

  • backend/tests/component/graphql/mutations/test_ipam.py: the case list and the _delete_ipnamespace helper.
  • The wording of the changelog fragment.

How to test

uv run pytest backend/tests/component/graphql/mutations/test_ipam.py -k ipnamespace

With the mutate_delete check from before #11583 put back temporarily, by-name-as-id and by-name-as-id-user-branch fail (ok: true). On this branch, all cases pass.

Checklist

  • Tests added/updated
  • Changelog entry added (uv run towncrier create ...)
  • External docs updated (if user-facing or ops-facing change)
  • Internal .md docs updated (internal knowledge and AI code tools knowledge)
  • I have reviewed AI generated content

🤖 Generated with Claude Code

Jira: IFC-3635

View guided diff

… id field

A request to IpamNamespaceDelete that sent "default" as id deleted the
default namespace before the protection check moved to the node that the
lookup returns. Add that request to the namespace delete cases, on the
default branch and on a user branch, and add a changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the group/backend API server, GraphQL, task worker (Prefect), database, Python code label Nov 17, 2026
…eck rejects

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codspeed

codspeed Bot commented Nov 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 18 untouched benchmarks


Comparing nisse/IFC-3635 (a8d2df0) with stable (e1126cc)

Open in CodSpeed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/backend API server, GraphQL, task worker (Prefect), database, Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: deleting the default IP namespace with its name in the id field deletes it

1 participant