Change log¶
0.10.0 (2024-09-26)¶
Backwards-incompatible changes¶
SquarebotSlackMessageValue.useris now nullable. It will benullif the message is abot_messagesubtype.
New features¶
Added
SquarebotSlackMessageValue.bot_idto capture the ID of the app that send a bot message.Support for Slack block actions interactions. These interactions happen when a user interacts with a message’s interactive elements (e.g., buttons, menus). These Slack payloads are parsed into
SlackBlockActionsPayloadobjects and published to a block action Kafka topic ($SQUAREBOT_TOPIC_BLOCK_ACTIONS) withSquarebotSlackBlockActionsKeykey andSquarebotSlackBlockActionsValuevalue models.Support for Slack view submission interactions. These interactions happen when a modal is submitted. These Slack payloads are parsed into
SlackViewSubmissionPayloadobjects and published to a view submission Kafka topic ($SQUAREBOT_TOPIC_VIEW_SUBMISSION) withSquarebotSlackViewSubmissionKeykey andSquarebotSlackViewSubmissionValuevalue models. The value model doesn’t yet fully parse the view into Pydantic models; clients will need to inspect the JSON object to get the submitted state of the model. Once more Pydantic modeling of Slack views and Block Kit blocks and elements is implemented, we can update the value model to provide more fully typed messages.Publish AsyncAPI documentation to the
/asyncapiendpoint. This documentation site is generated automatically through Faststream.
Bug fixes¶
Fix setting the
is_botproperty ofSquarebotSlackMessageValueto account for messages without thebot_messagesubtype, but which still have abot_idset.Improved the Slack message verification so that it now handles both JSON-formatted posts and url-encoded form posts. This change is necessary because Slack sends JSON-formatted posts for messages and url-encoded form posts for interactions. The verification now works for both types of posts.
0.9.0 (2024-07-25)¶
Backwards-incompatible changes¶
SquarebotSlackMessageValueno longer includes abot_idfield. Instead, theuserfield is set to the bot’s ID and a newis_botfield indicates if theuserfield is a bot or user ID.
New features¶
Add support for Slack messages with
subtypeofbot_message. This is implemented in the Slack message modelSlackMessageEventContentas a newsubtypefield that now takes aSlackMessageSubtypeenum. The Kafka representation of this message,SquarebotSlackMessageValuehas been updated to now set theuserattribute to either the user’s ID or the bot’s ID as appropriate. A new flag,is_botindicates if theuserfield reflects a user or bot (app integration) identifier.SlackMessageEventContent, a part of theSlackkMessageEventmodel, now has support forattachments. Slack attachments are deprecated for Block Kit, but are still widely used by app integrations. Theattachmentsfield is a list ofSlackMessageAttachmentobjects. These attachments can have text content or individual fields that have titles and values.The
SquarebotSlackMessageValueKafka message model’stextfield now includes the combined content of the message and its attachments. This makes it easy for consumers to process message content without needing to check for attachments and Block Kit fields. For consumers that are sensitive to the exact structure of the message, theslack_eventfield is still available, which is the original JSON representation of the Slack message, which can be parsed into aSlackMessageEventobject.
Other changes¶
Adopt
ruff-shared.tomlfrom lsst/templatesThe noxfile now uses
uvas the backend for pip and pip-compile tasks.Added a new weekly GitHub Actions CI workflow to validate that the app will run with future versions of dependencies.
0.8.0 (2024-02-28)¶
Backwards-incompatible changes¶
Squarebot now publishes messages in JSON, rather than Avro. Consumers should use the Pydantic models published in the
rubin-squarebotPyPI package to deserialize messages.The
rubin-squarebotPyPI package now uses therubin.squarebotPython namespace (previouslyrubinobs.square.squarebot). Consumers should use therubin.squarebot.models.kafka.SquarebotSlackMessageValuePydantic model to deserialize Squarebot messages for Slack channel message traffic (orrubin.squarebot.models.kafka.SquarebotSlackMessageValuefor the app mention topic).The codebase now uses Pydantic 2.
New features¶
Squarebot now uses FastStream to publish messages. This approach drops the Confluent Schema Registry integration because messages are now published in JSON from Pydantic models, and those Pydantic models are versioned and published through the
rubin-squarebotPyPI package.New fields in the
SquarebotSlackMessageValuePydantic model:thread_ts, useful for identify a threaded message and replying to its thread.bot_id, the ID of the bot that sent the message (if applicable). This is useful for identifying bot messages and ignoring them in some cases.
Bug fixes¶
Fix type annotations related in
channel_typeinrubin.squarebot.models.kafka.SquarebotSlackMessageValue. We now assure that the channel type is not Null here. However thechannel_typefield is now set to null/None in theSquarebotSlackAppMentionValuemodel.Fixed the
nox -s initcommand so that it will install into the current Python environment (previously it still installing into the environment managed bynox).
Other changes¶
A Redoc-based OpenAPI documentation page for the REST API is now included in the Sphinx documentation.
Switched to nox for running tests and repository tasks. Nox now replaces the two tox configurations for the client and server. Nox also replaces the
Makefilefor repository tasks:nox -s venv-initinitializes a Python venv virtual environment and installs the application into it. Alternatively,nox -s initcan be used to initialize the application in the current Python environment (likemake init).nox -s update-depsupdates the pinned dependencies as well as the pre-commit hooks (replacingmake update-deps).
New nox integration with scriv for change log management:
nox -s scriv-createcreates a change log fragment andnox -s scriv-collect X.Y.Zcollects change log fragments into CHANGELOG.md for a release.Adopt the lsst-sqre/build-and-push-to-ghcr@v1 action.
Tests require a local Kafka broker. The easiest way to run a Kafka broker is with Docker Compose and the
kafka-compose.yamlconfiguration file in this repository. The Docker compose set up also deploys Kafdrop so you can view the messages produced during testing.The codebase is now linted and formatted with Ruff.
0.7.0 (2023-05-19)¶
Backwards-incompatible changes¶
sqrbot-jr is now Squarebot. It’s docker image is now published at
ghcr.io/lsst-sqre/squarebot. The app is also deployed through a Helm chart in lsst-sqre/phalanx, rather than as a Kustomize manifest. See New features for more details.Avro schemas for messages
Slack interaction events are currently unsupported; only Slack messages are published to Kafka.
New features¶
Squarebot is rebuilt for the modern SQuaRE app architecture: FastAPI, deployed with Helm through Phalanx.
Squarebot uses Pydantic for modelling Avro-encoded Kafka messages. This allows for end-to-end type checking from the HTTP handlers to the messages published to Kafka.
The
lsst-sqre/squarebotrepository is now a monorepo that contains the Squarebot service and a client library (rubin-squareboton PyPI). The client library contains Pydantic models for the Avro-encoded messages published to Kafka by Squarebot. See SQR-075 for details on the monorepo architecture and SQR-076 background on how Pydantic is used for Kafka message modelling.
0.6.0 (2019-12-02)¶
The event topics (for messages) have keys that contain the Slack Team ID and the channel ID. This ensures that messages in a given channel are processed sequentially.
The interaction topics (i.e., a dialogue submission) have keys that contain the Slack Team ID and the ID of the user that triggered the interaction.
Schemas now use the
codes.lsst.roundtable.sqrbotnamespace.The message schema is no longer dynamically generated with a separate wrapper schema. This significantly simplifies the loading of the message schema.
Updated avro-python3 (a test dependency) to 1.9.1.
0.5.0 (2019-11-29)¶
This release focuses on improving the deployment and configuration of SQuaRE Bot Jr.
SQuaRE Bot Jr. can now be deployed through Kustomize. The base is located at
/manifests/base. This means that you can incorporate this application into a specific Kustomize-based application (such as one deployed by Argo CD) with a URL such asgithub.com/lsst-sqre/sqrbot-jr.git//manifests/base?ref=0.5.0. There is a separate template for the Secret resource expected by the deployment at/manifests/secret.template.yaml.Topics names can now be configured directly. See the environment variables:
SQRBOTJR_TOPIC_APP_MENTIONSQRBOTJR_TOPIC_MESSAGE_CHANNELSSQRBOTJR_TOPIC_MESSAGE_IMSQRBOTJR_TOPIC_MESSAGE_GROUPSSQRBOTJR_TOPIC_MESSAGE_MPIMSQRBOTJR_TOPIC_INTERACTION
This granular configuration allows you to mix-and-match production and development topics.
The old “staging version” configuration is now the
TEMPLATEBOT_SUBJECT_SUFFIXenvironment variable. This configuration is used solely as a suffix on the fully-qualified name of a schema when determining its subject name at the Schema Registry. Previously it also impacted topic names. Use a subject suffix when trying out new Avro schemas to avoid polluting the production subject in the registry.SQuaRE Bot Jr can now connect to Kafka brokers through SSL. Set the
KAFKA_PROTOCOLenvironment variable toSSL. Then set these environment variables to the paths of specific TLS certificates and keys:KAFKA_CLUSTER_CA(the Kafka cluster’s CA certificate)KAFKA_CLIENT_CA(client CA certificate)KAFKA_CLIENT_CERT(client certificate)KAFKA_CLIENT_KEY(client key)
Individual features can be enabled or disabled:
SQRBOTJR_ENABLE_SCHEMAS: set to"0"to disable registering new schemas on start up. This needs to be1if the producers are enabled.SQRBOTJR_ENABLE_PRODUCERS: set to"0"to disable the Kafka producers. SQuaRE Bot Jr can still receive events from Slack though its HTTP endpoints, it just won’t pass them on to Kafka.SQRBOTJR_ENABLE_TOPIC_CONFIG: set to"0"to disable configuring topics if they do not already exist. It makes sense to disable topic configuration if a separate process is used to configure topics, such as Strimzi’s TopicOperator.
0.4.0 (2019-05-03)¶
There is a new configuration environment variable, SQRBOTJR_RETENTION_MINUTES, which configures how long a Slack messages are retained in Kafka topics.
The default is 30 minutes so that consumers can query recent history for context, but brokers will still not have too much data that could be potentially exposed.
0.3.1 (2019-03-15)¶
The com.slack.dialog_submission_v1 schema now permits the value from a field to be null.
This is true if a Slack dialog field is optional and the user does not set a value.
0.3.0 (2019-02-21)¶
SQuaRE Bot Jr now serializes the messages from user actions that are send to SQuaRE Bot Jr’s Request URL. The supported interactions are:
block_actions(a user pressed a button or selected a menu item on a message)dialog_submission(a user submitted a Slack dialog)dialog_cancellation(a user cancelled a Slack dialog)
Note that the Avro schema for
block_actionscurrently only supportsbuttonandstatic_selectactions.Avro schemas are now validated using the official Avro package,
avro-python3.The Kubernetes deployment includes a
SQRBOTJR_TOKENsecret that other apps in api.lsst.codes can use to send messages to Slack as SQuaRE Bot Jr through Slack’s Web API.
0.2.0 (2019-02-15)¶
This release adds the ability to serialize message events into Avro from the Slack Events API and produce Kafka messages to matching topics.
0.1.0 (2019-01-07)¶
This is a slack bot that will eventually replace the current SQuaRE Bot and be oriented around passing Kafka messages to downstream microservices (SQuaRE Events). Main initial features:
Sets up package and documentation site.
Docker build in CI.
Demonstrates running an aiohttp.web application with structlog logging and environment-based configuration.
Respond to the Slack URL challenge.
Implements Slack message verification based on the signing secret.