Skip to content

Conversation

@markstory
Copy link
Member

This adds the Application, Namespace and Task objects needed to define and send tasks. I'll add the worker and scheduler separately to keep pull requests reasonably sized.

Refs STREAM-605

This adds the Application, Namespace and Task objects needed to define
and send tasks. I'll add the worker and scheduler separately to keep
pull requests reasonably sized.

Refs STREAM-605
@markstory markstory requested a review from a team as a code owner January 14, 2026 19:51
@linear
Copy link

linear bot commented Jan 14, 2026

@markstory markstory requested a review from a team January 14, 2026 19:51
Comment on lines +189 to +191
produce_future.result(timeout=10)
except Exception:
logger.exception("Failed to wait for delivery")
Copy link

Choose a reason for hiding this comment

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

Bug: When wait_for_delivery=True, exceptions during task delivery are caught and logged but not propagated to the caller, causing silent failures.
Severity: CRITICAL

Suggested Fix

Modify the except Exception block in the send_task method. When wait_for_delivery is True and an exception is caught, the exception should be re-raised. This will ensure that the caller is notified of the delivery failure and can handle it appropriately, preventing silent task loss.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: clients/python/src/taskbroker_client/registry.py#L189-L191

Potential issue: When a task is sent using `apply_async` with the
`wait_for_delivery=True` option, the system is expected to wait for confirmation that
the task was delivered. However, if the delivery to Kafka fails (e.g., due to a timeout
or connectivity issue), the resulting exception is caught, logged, and then suppressed.
The calling code receives no indication of the failure and proceeds as if the task was
successfully scheduled. This can lead to silent failures where critical tasks are
dropped without any error being surfaced to the application logic that scheduled them.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +12 to +18
class DefaultRouter(TaskRouter):
"""
Stub router that resolves all namespaces to a default topic
"""

def route_namespace(self, name: str) -> str:
return "taskbroker"
Copy link
Member Author

Choose a reason for hiding this comment

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

Sentry will continue to have a Router implementation.

Comment on lines -55 to -80
[tool.mypy]
files = ["."]
mypy_path = ["src"]
explicit_package_bases = true
# minimal strictness settings
check_untyped_defs = true
no_implicit_reexport = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
warn_redundant_casts = true
enable_error_code = ["ignore-without-code", "redundant-self"]
local_partial_types = true # compat with dmypy
disallow_any_generics = true
disallow_untyped_defs = true

# begin: missing 3rd party stubs
[[tool.mypy.overrides]]
module = [
".conftest",
"redis.*",
"rediscluster.*",
"confluent_kafka.*",
]
ignore_missing_imports = true
# end: missing 3rd party stubs
Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't required as mypy configuration is shared with integration_tests in the top level pyproject.toml file.

self,
name: str,
application: str,
producer_factory: ProducerFactory,
Copy link
Member Author

Choose a reason for hiding this comment

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

Client applications are responsible for providing a factory function that receives a topic name and returns an arroyo producer for that topic.

Copy link
Member

@evanh evanh left a comment

Choose a reason for hiding this comment

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

LGTM.

@markstory markstory merged commit aa2aedb into main Jan 19, 2026
18 checks passed
@markstory markstory deleted the feat-python-client-ns-app branch January 19, 2026 22:10
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.

3 participants