Skip to content

refactor(service): remove the Mattermost webhook provider #5257

Done

Description

@dan-petty

Update 2026-11-26 (infra move): the Mattermost manifests are now in dan-petty/homelab.

  • The internal-connection setting and the NetworkPolicy to the roadmap Service are a follow-up issue there.
  • This issue keeps the code, the k8s/devops/roadmap-service/ manifests, the specs, the ADR lines and the documents here.

Follow-up: dan-petty/homelab#295.


Problem or Motivation

Child 15 of the ADR modernization (#5233). Code. It carries out a decision in force (0021:34; 0 uses in 7 days), so it needs no new decision.

The review of each record that this item changes:

  • ADR 0009 (keep (amended by 0021; Status History)): The router, the authentication of each provider and the seam match the code. The consumer takes only issues events since feat(release): release-please makes every release from main #1952, and Mattermost (0 uses in 7 days) goes out in its own PR. The rule becomes 'consumer events are a subset of hook events'. The router stays, not Argo Events (0021:263-274).
  • ADR 0021 (amend (Status History and two amending records)): The direction holds (owner, 2026-11-11), but only 2 of its 15 steps are built, and it grew from 3,585 to 7,472 words in 2 days. New rows go to their OpenSpec change and the step order to feat(roadmap): move Service work to Workflows and Valkey #4517. Caps become settings, cache keys fall back, and coordination keys fail closed.

Proposed Solution & Architectural Design

Remove webhooks.py:187, 255-261 and 460-463, service.py:780-789 and 1046-1078, commands/k8s/mattermost_bootstrap.py, cluster_secrets.py:407-408, env.py:164 and the k8s/README.md rows. An OpenSpec change removes the mattermost-roadmap-slash-command spec. A test proves that the Service starts while the old env is still set. Add a Status History line to 0009. A person deletes /roadmap in Mattermost. Take the item out of #4575.

Rules of the ADR process (docs/adr/README.md, #5225) that apply:

  • Use one form for a Status History line, 30 words at most: 'YYYY-MM-DD: Amended by ADR NNNN, section S | Amended by the owner decision in #N, section S | Superseded by ADR NNNN | Fact out of date: (#N) | Living detail moved to (#PR).' The PR that makes a fact of a record wrong adds the line (AGENTS.md rule 8). An agent never edits the body of an accepted record.

Keep these constraints on purpose. The review found a reason for each one:

  • ADR 0003/0017/0021, the sweep is the source of truth and 'webhooks as the only trigger' stays rejected: 25 of 100 deliveries got 403, and about 116 s are lost at each rollout.
  • ADR 0003/0009, one public path with HMAC (401 before the body is parsed), the 413 cap and a rate limit: they stay when the IP list goes.
  • ADR 0021, coordination keys fail closed (shared request window, holds, identity halt, locks): a local fallback would let N pods pass the owner's cap.
  • ADR 0009, the router and not Argo Events: Argo Events adds at least 4 pods, and a lost delivery stays lost.

Target Subsystem

src/devops_cli/server/, src/devops_cli/commands/k8s/, src/devops_cli/k8s/cluster_secrets.py, src/devops_cli/config/env.py, k8s/README.md, openspec/specs/.

Existing Tool Considered

None. The change removes code.

Acceptance Criteria

  • The Mattermost provider goes: webhooks.py:187, 255-261, 460-463, service.py:780-789, 1046-1078, commands/k8s/mattermost_bootstrap.py, cluster_secrets.py:407-408, env.py:164 and the rows of k8s/README.md.
  • An OpenSpec change removes the mattermost-roadmap-slash-command spec.
  • A test proves that the Service starts while the old environment value is still set.
  • ADR 0009 gets a Status History line. A comment takes the Mattermost step out of feat(service): make the webhook router stateless #4575.
  • Person step after the merge: delete the /roadmap slash command in Mattermost.

Dependencies

This item adds a Status History line to the ADR 0009 file of #5225.

Related

Source: #5233

Alternatives check of 2026-11-26: not-applicable.
Class: refactor, no model call.
Tool: none found.

Proposed design

Problem statement

The Service still carries a Mattermost webhook provider and a /roadmap slash command, and the dashboard, the specs and the documents still describe them. ADR 0021 in force holds the owner decision of 2026-11-11 that removes them, after 0 uses. One pull request removes the provider, the responder, the command token, the cluster secret row, the Deployment environment value, the roadmap-service-ingress Mattermost rule, the chat-command counter and its panel, the docs and the OpenSpec capability. It keeps the Mattermost alerts and deploys bootstrap, and it records the change in the Status History of ADR 0009 and ADR 0021. The live /roadmap deletion and the #4575 comment go to the follow-up #6587, after the merge.

Acceptance criteria

Requirement: Mattermost provider, /roadmap responder and chat counter removed

The Service SHALL declare no Mattermost webhook provider, no /roadmap responder and no devops_cli_service_chat_commands_total counter.

Scenario: Grep the server package and the counter name

  • WHEN The check runs ! git grep -n -I -F -i mattermost src/devops_cli/server src/devops_cli/config/constants.py and ! git grep -n -I -F devops_cli_service_chat_commands_total src/ tests/.
  • THEN Both commands exit 0 and print nothing.

Requirement: Command token removed from the settings and the secret table

The CLI SHALL declare no mattermost.command_token credential and no cluster secret entry for DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN.

Scenario: Grep the settings and the secret table

  • WHEN The check runs ! git grep -n -I -F "mattermost.command_token" src/ and ! git grep -n -I -F DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN src/.
  • THEN Both commands exit 0 and print nothing.

Requirement: Bootstrap command keeps the alerts and deploys hooks

devops k8s bootstrap-mattermost SHALL create the team, the channels and the alerts and deploys webhooks, and SHALL create no slash command.

Scenario: Grep the slash-command step and run the bootstrap tests

  • WHEN The check runs ! git grep -n -I -F _ensure_slash_command src/ and uv run devops ci test tests/commands/test_k8s_bootstrap_mattermost.py.
  • THEN Both commands exit 0, the grep prints nothing, and the tests record no mmctl command create call.

Requirement: Service starts with the old Mattermost environment value

The Service MUST start when DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN is still set in the environment.

Scenario: Create the Service with the old value

  • WHEN The check runs uv run devops ci test tests/server/test_mattermost_removed.py; the test sets DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN to a webhook URL and calls create_service_app.
  • THEN The test passes, the app declares no /webhooks/mattermost route and the settings hold no mattermost.command_token.

Requirement: Cluster manifests carry no command token and no Mattermost ingress rule

The roadmap-service Deployment MUST NOT set DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN, and roadmap-service-ingress SHALL admit no connection from the Mattermost namespace.

Scenario: Validate the k8s tree and grep the token

  • WHEN The check runs ! git grep -n -I -F DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN k8s/ and uv run devops ci --check --only k8s.
  • THEN Both commands exit 0, and the k8s row reports no failure.

Requirement: Chat-command panel and counter requirement removed

The roadmap-service dashboard SHALL hold no panel for devops_cli_service_chat_commands_total, and the roadmap-service-counters delta SHALL drop the chat-command label set.

Scenario: Grep the dashboards and lint them

  • WHEN The check runs ! git grep -n -I -F devops_cli_service_chat_commands_total k8s/ and uv run devops grafana dashboards lint k8s/devops/dashboards.
  • THEN The grep prints nothing and the lint exits 0 with no error.

Requirement: The mattermost-roadmap-slash-command capability is removed

The change SHALL remove each requirement of mattermost-roadmap-slash-command, rename mattermost-bootstrap-webhooks-and-slash-command to mattermost-bootstrap-webhooks, and drop the slash command and its token from mattermost-bootstrap through its spec deltas.

Scenario: Archive the change and validate the specs

  • WHEN The last commit runs uv run devops openspec archive <change> and uv run devops ci --check --only openspec.
  • THEN The archive prints Archived and the openspec row exits 0.

Requirement: The documents describe no Mattermost slash command

The documentation SHALL describe no /roadmap Mattermost slash command and no mattermost.command_token.

Scenario: Regenerate and check the docs

  • WHEN The check runs uv run devops docs generate, uv run devops ci --check --only docs and ! git grep -n -I -F -i /roadmap k8s/README.md docs/CLUSTER.md.
  • THEN All three commands exit 0, and the grep prints nothing.

Requirement: ADR 0009 and ADR 0021 record the change in their Status History

The pull request MUST add one Status History line to ADR 0009 and one to ADR 0021 that names #5257 as the step that deletes the Mattermost provider, and MUST NOT change either body.

Scenario: Check the ADR records

  • WHEN The check runs uv run devops ci test tests/invariants/test_adr_records.py and git grep -n -F '#5257' docs/adr/0009-*.md docs/adr/0021-*.md.
  • THEN The test passes, both records keep their body-hash, and each record holds one Status History line that cites #5257.

Requirement: Webhook router and coordination keys stay

The change MUST keep the webhook router, the HMAC check before body parsing, the 413 cap, the rate limit and the coordination keys that fail closed.

Scenario: Run the server tests

  • WHEN The check runs uv run devops ci test tests/server/.
  • THEN The tests pass.

Existing Tool Considered

The alternatives check in the issue body records not-applicable on 2026-11-26 for class refactor, with Tool: none found. The Mattermost work stays on mmctl, the official, maintained Mattermost CLI that bootstrap-mattermost runs in the pod (openspec/changes/archive/2026-10-31-2945-bootstrap-mattermost/proposal.md:52). It lacks a declarative apply: each team, channel, webhook and command is a separate mmctl call over kubectl exec, so the command keeps its own Python steps and this change deletes only their command step. The change removes code and builds no replacement, so it has no build, keep or fix cost.

Key questions

  • Which files and lines hold the Mattermost webhook provider and its /roadmap command?: The provider and the responder are in src/devops_cli/server/routes/webhooks.py, with the token check at 709-712 and the chat-command counter at 42 and 241. The token reaches src/devops_cli/server/service.py:886-900 and 1275-1314, src/devops_cli/config/env.py:201, src/devops_cli/k8s/cluster_secrets.py:726-727 and src/devops_cli/commands/k8s/mattermost_bootstrap.py:278-335. The product manifests are k8s/devops/roadmap-service/deployment.yaml:132-137 and k8s/devops/roadmap-service/networkpolicy.yaml:34-44. The counter is src/devops_cli/config/constants.py:1905 and src/devops_cli/server/counter_series.py:23,170, its panel is k8s/devops/dashboards/roadmap-service-telemetry.json:779, and its requirement is openspec/specs/roadmap-service-counters/spec.md:24. The tests are tests/server/test_mattermost_slash_command.py, tests/commands/test_k8s_bootstrap_mattermost.py, tests/telemetry/test_service_counter_series.py:209 and tests/telemetry/test_telemetry_instruments.py:34. [sources: src/devops_cli/server/routes/webhooks.py:709-712, src/devops_cli/server/routes/webhooks.py:42, src/devops_cli/server/service.py:886-900, src/devops_cli/config/env.py:201, src/devops_cli/k8s/cluster_secrets.py:726-727, src/devops_cli/commands/k8s/mattermost_bootstrap.py:278-335, k8s/devops/roadmap-service/deployment.yaml:132-137, k8s/devops/roadmap-service/networkpolicy.yaml:34-44, src/devops_cli/config/constants.py:1905, src/devops_cli/server/counter_series.py:170, k8s/devops/dashboards/roadmap-service-telemetry.json:779, openspec/specs/roadmap-service-counters/spec.md:24, tests/server/test_mattermost_slash_command.py, tests/commands/test_k8s_bootstrap_mattermost.py]
  • Which record in force authorizes the removal, and does it need a new owner decision?: ADR 0021 in force holds the owner decision of 2026-11-11: the stateless router step deletes the Mattermost provider and its /roadmap command, after 0 uses in 7 days (ADR 0021:316). The reply of 2026-11-26 records 0 uses in 30 days, so the decision still holds and needs no new owner decision. ADR 0009 names the Mattermost slash command as the only chat sender (ADR 0009:21) and its Status History already notes that the provider goes away (ADR 0009:45), so it gets a dated line. [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:316, docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md:21, docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md:45]
  • Does the change remove the whole mattermost_bootstrap.py or only its /roadmap step?: Remove only the /roadmap step of devops k8s bootstrap-mattermost: _ensure_slash_command, its mmctl command calls, the mattermost.command_token keyring store and the help text that names slash commands. Keep the team, channel and alerts/deploys webhook steps, because Alertmanager and Argo CD still post to Mattermost and the mattermost-bootstrap requirements for them stay in force. (best practice) [sources: openspec/specs/mattermost-bootstrap/spec.md:30-38, docs/CLUSTER.md:138-143, src/devops_cli/commands/k8s/mattermost_bootstrap.py:278-335, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:316]
    • Chosen: Remove only the /roadmap step. ADR 0021 names the provider and the slash command only, and the alerts and deploys bootstrap stays in force for Alertmanager and Argo CD.
    • Rejected: Delete the whole mattermost_bootstrap.py. It removes the only automation of the alerts and deploys hooks that Alertmanager and Argo CD still use, and breaks the mattermost-bootstrap requirements that stay.
  • How does the pull request record the change in ADR 0009 and ADR 0021?: Add one dated Status History line to each record and change no body text. ADR 0009's body names Mattermost's slash command as the only chat sender (0009:21) and ADR 0021's body names feat(service): make the webhook router stateless #4575 as the step that deletes the provider (0021:316); this pull request makes both wrong. Use YYYY-MM-DD: Fact out of date: the Mattermost webhook provider and its /roadmap command are removed (#5257). in 0009 and YYYY-MM-DD: Fact out of date: #5257, not #4575, deletes the Mattermost provider and its /roadmap command (#5257). in 0021, each 30 words or fewer after the date. The body-hash of each record stays. (best practice) [sources: docs/adr/README.md:54, docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md:21, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:316, tests/invariants/test_adr_records.py]
    • Chosen: One Status History line on each of ADR 0009 and ADR 0021. The ADR process gives the fixed form, and the same pull request that makes a fact of each record wrong adds the line.
    • Rejected: Only ADR 0009. It leaves ADR 0021 naming feat(service): make the webhook router stateless #4575 as the step that deletes the Mattermost provider, which this pull request makes wrong.
    • Rejected: Edit the body of ADR 0009 or ADR 0021. An agent never edits the body of an accepted record, and the invariant test fails on a changed body-hash.
    • Rejected: Write a new amending ADR. One provider is a detail, and the Status History line records it.
  • How does the change remove the mattermost-roadmap-slash-command spec?: The change folder holds a delta that removes all requirements of mattermost-roadmap-slash-command, including the requirement for the Mattermost internal connection and both network rules. It holds a RENAMED delta that takes mattermost-bootstrap-webhooks-and-slash-command to mattermost-bootstrap-webhooks, MODIFIED deltas that drop the slash command and its token from mattermost-bootstrap, and a MODIFIED delta that drops the chat-command label set from roadmap-service-counters. The last commit runs uv run devops openspec archive <change>. (best practice) [sources: CONTEXT.md, docs/SDLC.md, openspec/specs/mattermost-roadmap-slash-command/spec.md:56-60, openspec/specs/mattermost-bootstrap/spec.md:30-38, openspec/specs/roadmap-service-counters/spec.md:24]
    • Chosen: Spec deltas and archive. The archive is the only writer of openspec/specs/, and readiness refuses a pull request that writes it.
    • Rejected: Delete the spec folder by hand. A hand edit of openspec/specs/ breaks the one writer of a spec and the readiness check.
  • What of the slash-command path is outside this repository?: k8s/ holds only README.md and devops/, so k8s/mattermost/mattermost.yaml is no longer here: k8s/README.md:372 points the Mattermost rollout and its operations to k8s/README.md of dan-petty/homelab. The untrusted-internal-connection setting and the Mattermost-side egress rule go to the homelab follow-up dan-petty/homelab#295. This item keeps the code, k8s/devops/roadmap-service/ (the Deployment value and ingress rule 3 of roadmap-service-ingress), the specs, the ADR lines and the documents. [sources: k8s/README.md:372, k8s/devops/roadmap-service/networkpolicy.yaml:34-44, k8s/devops/roadmap-service/deployment.yaml:132-137, openspec/specs/mattermost-roadmap-slash-command/spec.md:56-57]
  • Where do the live /roadmap deletion and the feat(service): make the webhook router stateless #4575 comment go?: Both go to the follow-up chore(mattermost): delete the /roadmap command and update #4575 after #5257 #6587, which is filed for these two steps and waits for this item: a person deletes the /roadmap command in the live Mattermost team, and a comment takes the Mattermost step out of feat(service): make the webhook router stateless #4575. This pull request delivers the code, manifests, specs, ADR lines and documents only. The live command and the tracker comment need the merge first, so neither blocks the code change, and the live value of DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN stays in the keyring and Secret until a person removes it. (best practice) [sources: docs/CLUSTER.md:138-143, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:316, k8s/README.md:185, k8s/README.md:256]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5225

Moved to new items

#6587

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/refactor
    scope/service
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: refactor. The check makes no search and no model call for an item of this class.

    Tool: none found

    Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.

  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Owner question: Can the pull request delete the /roadmap slash command in Mattermost? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  7. added
    status/ready
    and removed
    status/new
    on Nov 21, 2026
  8. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  9. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    Note from the premise check of dan-petty/homelab#295 (2026-11-26).

    • Order: this item goes first. dan-petty/homelab#295 (the Mattermost setting and NetworkPolicy mattermost-roadmap-service) and chore(mattermost): delete the /roadmap command and update #4575 after #5257 #6587 wait for it. homelab#295 is returned as early, and its comment holds the evidence.
    • Reason: openspec/specs/mattermost-roadmap-slash-command/spec.md:56-57 is in force and requires the Mattermost setting and both network policy rules. The live team still has /roadmap, and Secret devops/devops-cli still has a value for DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN.
    • The product half of the network path stays in this item: rule 3 of roadmap-service-ingress, k8s/devops/roadmap-service/networkpolicy.yaml:34-44. k8s/mattermost/mattermost.yaml is no longer in this repository, so the pull request of this item cannot remove that setting.
    • Use in 30 days (Prometheus, the full retention): 0 deliveries of provider mattermost and 0 /roadmap commands. The decision of 2026-11-11 (ADR 0021:316) still holds.
  10. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  11. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  12. removed
    status/in-review
    on Nov 29, 2026
  13. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:17 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/servicesource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions