Skip to content

fix: send the default tenant on tenant-scoped commands (stable/10 backport) - #487

Merged
jwulf merged 3 commits into
stable/10from
feat/issue-486
Nov 21, 2026
Merged

jwulf merged 3 commits into
stable/10from
feat/issue-486

Conversation

@jwulf

@jwulf jwulf commented Nov 21, 2026

Copy link
Copy Markdown
Member

Backport of #450 to stable/10.

  • Tenant-scoped commands (createDeployment, createProcessInstance by key/id/versionTag, publishMessage, correlateMessage, broadcastSignal, evaluateDecision by id/key, evaluateExpression, evaluateConditionals) send tenantId = CAMUNDA_TENANT_ID or "<default>" when omitted; injected into a copy of the caller's request.
  • activateJobs sends tenantIds: [<effective default>] when no ids passed and tenantFilter is not ASSIGNED.
  • Blank CAMUNDA_TENANT_ID treated as unset. Adds DEFAULT_TENANT_ID constant (additive only — no signature changes).
  • Generated code regenerated from the committed stable/8.10 bundled spec (make generate-only), in a separate commit.
  • Tests ported; suspend/resume process-definition cases dropped (main-only ops), structural rule-1 guard kept.

Checks: make lint, uv run ty check (0 errors), pytest tests/acceptance (1100 passed).

Closes #486

Backport of #450
to stable/10. Tenant-scoped commands send CAMUNDA_TENANT_ID or "<default>"
when omitted; activateJobs sends tenantIds=[default] unless tenantFilter is
ASSIGNED. Blank CAMUNDA_TENANT_ID is treated as unset. No public signature
changes; main-only suspend/resume ops are excluded.

Closes #486

Signed-off-by: Josh Wulf <josh.wulf@camunda.com>
Signed-off-by: Josh Wulf <josh.wulf@camunda.com>
@jwulf
jwulf requested a review from a team as a code owner November 21, 2026 02:49
Copilot AI balanced review requested due to automatic review settings November 21, 2026 02:49
@jwulf

jwulf commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

🤖 The changes in this PR were produced by nano-agent, an autonomous agent. Commits are authored under the operator's own git identity when one is resolvable (the human running the fleet), so they can satisfy CLA/DCO requirements; this note records that the work was generated by the agent.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The search tenant regression test can falsely pass without sending a request because exceptions are swallowed and a missing captured body defaults to {}, so it must require a captured JSON body before checking tenant fields.

1 open issue
What changed in this PR

Backports Java-compatible default-tenant handling to the stable/10 Python SDK, addressing #486 without changing public method signatures.

Changes:

  • Apply the configured tenant or <default> to tenant-scoped commands and eligible job activation requests without mutating caller data.
  • Treat blank tenant configuration as unset and refresh generated output and documentation.
  • Add regression coverage for tenant defaults, explicit overrides, activation filters, request reuse, and search behavior.
File Description
tests/​acceptance/​test_default_tenant_rule.py Adds cross-command default-tenant and request-immutability coverage.
tests/​acceptance/​test_default_tenant_ids.py Updates activation expectations and tests blank tenant configuration.
stubs/​camunda_orchestration_sdk/​runtime/​configuration_resolver.pyi Reflects the new constant and tenant validator.
runtime/​configuration_resolver.py Defines the fallback tenant and normalizes blank values.
README.md Documents the default-tenant fallback.
hooks/​post_gen/​0900_flatten_client.py Generates tenant injection, request copying, and activation-filter handling.
generated/​camunda_orchestration_sdk/​runtime/​configuration_resolver.py Incorporates the runtime configuration changes.
generated/​camunda_orchestration_sdk/​client.py Applies the generated behavior to synchronous and asynchronous clients.

Review effort: Balanced

Copilot review on #487: the search-tenant regression test passed even
when no search request was sent, because _call_sync swallows every
exception and a missing captured body defaulted to {}.

Fix the class, not the instance: every assertion on a captured request
body now fails when the request never reached the transport or the body
is not decodable JSON, instead of passing vacuously on a default.

- test_default_tenant_rule: _sent_tenant asserts the transport was hit
  and the JSON body decoded; the search test asserts a captured dict
  body before checking it contains no tenant fields.
- test_default_tenant_ids: replace captured.get("body", {}) defaults
  with direct captured["body"] lookups so a missing capture fails.

Signed-off-by: Josh Wulf <josh@magikcraft.io>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The default-tenant behavior backport has no active review issues.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues blocking the default-tenant backport.

No open issues 🎉

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the default-tenant behavior backport.

No open issues 🎉

Review effort: Balanced

@jwulf
jwulf merged commit 6822016 into stable/10 Nov 21, 2026
26 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.

2 participants