Skip to content

feat(roadmap): a /roadmap slash command in mattermost shows each repository's roadmap service state, answered in-cluster through the service's webhook router #1395

Description

@dan-petty

Refreshed plan (2026-10-17, unblocking review)

This section supersedes any text below that conflicts with it.

Decisions

Scope

Delivery

  • One PR, size M, with Fixes #1395: the router's form content type, responder mode and AuthorizationToken; per-lane last-round state and the status method; the commands and counter; the Mattermost setting and both policy changes; tests; the guide. It merges with roadmap-service still at replicas: 0.

Acceptance criteria
These replace the body's matching criteria. Every other criterion stands, including the 401 handling, the token kept out of every log record, cluster exposure, the Ingress pin to tunnel providers, the NetworkPolicy and setting changes with their tests, and the no-network, no-#1307-patch, under-1-s test rules.

  • AuthorizationToken. This item adds the router's AuthorizationToken(scheme) verifier as feat(service): one webhook router verifies each provider its own way, parses a typed payload and delivers each event only to the consumers subscribed to it #1386's receiver design describes (get_authorization_scheme_param, scheme match, secrets.compare_digest), and the mattermost provider uses it with scheme Token, reading the secret option mattermost.command_token (keyring mattermost_command_token, env DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN, an optional entry in the devops/devops-cli row).
  • The last round, per lane. Each RepoWorker (one per repository and lane) records its last round's start, end and result. One read-only ServiceManager method returns, for every repository and lane, running or idle, pending triggers, and the last round or none. The responder reads only that method. Tested through the public methods, with a fake job per lane.
  • Commands. The text is split with shlex.split. status, or no text, gives one line per repository in service.repos and per lane: running or idle; pending triggers; the last round's start and end (UTC) and result, or "no round yet". status <owner/name> gives that repository's lanes; an unknown name gets the list of known ones. Anything else gets a usage line. No GitHub request is made. The reply is ephemeral, and its texts live in src/devops_cli/lang/en/messages.py, each one line (AGENTS.md:187).
  • No schedule. The mattermost provider declares a responder and no consumer or schedule (D3).
  • The hold stays. k8s/devops/roadmap-service/deployment.yaml:12 keeps replicas: 0, and its test (tests/test_k8s_roadmap_service.py:49) passes unchanged.
  • Tests also cover two lanes of one repository reported on separate lines, one running and one idle.
  • Pending a person: once the deployment hold lifts (D1), feat(k8s): mattermost team edition runs under argo cd from the mattermost operator, on a cloudnativepg database and a protected volume, at https://mattermost.<domain> through the tunnel #1391's Mattermost runs and the Service runs a release with this item, create /roadmap, set mattermost.command_token and push devops/devops-cli as the guide says, then run checks (a)-(d); that secret push and (b)'s restart are steps D1 keeps forbidden until then.

Current references (main 3dd7fa6)

  • RepoWorker, one per repository and lane: src/devops_cli/server/service.py:130-307; its _execute_batch, which records only counters and the start gauge: :235-280; workers keyed (repo, lane): :333-337.
  • Queue-depth gauge set to 1 and to 0: src/devops_cli/server/service.py:175 and :232.
  • Lane jobs: SERVICE_JOBS at src/devops_cli/roadmap/run.py:1035-1042; lane names at src/devops_cli/config/constants.py:1070-1072.
  • Project gauges cleared and rewritten per repository: src/devops_cli/github/metrics.py:646, in _record_workflow_and_milestone_metrics (:628-657), called through src/devops_cli/roadmap/run.py:635.
  • Router today: one route, POST /webhooks/github (src/devops_cli/server/routes/webhooks.py:188), application/json only with 415 (:93-100); the body's :35-50, :52-69, :72-90 and :184 still hold.
  • roadmap-service ingress policy: k8s/devops/roadmap-service/networkpolicy.yaml:15-33; Ingress path at k8s/devops/roadmap-service/ingress.yaml:17, pinned at tests/test_k8s_roadmap_service.py:158.
  • The one-line rule for lang/en/ texts is AGENTS.md:187, not :440. The AGENTS.md:252-265 kubectl block no longer exists (AGENTS.md has 220 lines); that reference is dropped.
  • Suspension rule: AGENTS.md:147-151. Guide section: k8s/README.md:361, with its suspension note at :363.
  • Nothing for Mattermost exists yet under src/, k8s/, tests/ or docs/; feat(k8s): mattermost team edition runs under argo cd from the mattermost operator, on a cloudnativepg database and a protected volume, at https://mattermost.<domain> through the tunnel #1391 adds mattermost to TARGET_NAMESPACES (tests/test_k8s_network_policies.py:34).

Dependencies and order


Problem

Checked on 2026-10-08: release/v0.2.29 at 910b823; Mattermost's developer docs.

  • Seeing the Service's state needs kubectl or Grafana.
    • For each repository, a person wants to know whether its worker is running a round, its queue, and its last round's start, end and result.
    • The running state and the queue live in RepoWorker (_is_active and the pending counts, src/devops_cli/server/service.py:63-82). The last round's result is kept nowhere: _execute_batch only increments the cumulative devops_cli_service_jobs_total{repo, result} and sets the start gauge (:154-200).
    • AGENTS.md:252-265 gives several kubectl commands for the same check.
  • Milestone progress per repository isn't available either. The milestone gauges have no repo label, and each repository's metrics job clears and rewrites them (reg.clear_metric(PROJECT_ITEMS_TOTAL.name), src/devops_cli/github/metrics.py:640-651, called from src/devops_cli/roadmap/run.py:479-482). With eight repositories, /metrics holds only whichever ran last. So this command doesn't report milestone progress.
  • Only GitHub can reach the Service from outside.
    • Its one public route is POST /webhooks/github, which is HMAC-verified (src/devops_cli/server/routes/webhooks.py:35-50, :188).
    • The Ingress exposes only that path (k8s/devops/roadmap-service/ingress.yaml), and ADR 0003 keeps every other route private.
    • Its ingress policy admits only Traefik and namespace monitoring, on 8000 (k8s/devops/roadmap-service/networkpolicy.yaml:15-33).
  • How a Mattermost slash command works (docs, "Custom slash commands").
    • Mattermost POSTs application/x-www-form-urlencoded with token, user_name, text, command and response_url, and sends the token again as Authorization: Token <token>.
    • The reply is JSON with response_type (ephemeral by default, or in_channel) and text. Work longer than 3 s replies later through response_url.
    • response_url is built on the site URL, https://mattermost.<domain>, which sits behind Access. So the Service can only answer in the request.
    • Mattermost won't call a private address unless its host is in ServiceSettings.AllowedUntrustedInternalConnections. It matches hostnames before resolving them.
  • The inbound pieces are GitHub's alone today. The body cap is _read_and_cap_body (webhooks.py:72-90), the duplicate cache is DeliveryLRUCache (:52-69), and the delivery counters are incremented in create_webhook_router (from :184). feat(service): one webhook router verifies each provider its own way, parses a typed payload and delivers each event only to the consumers subscribed to it #1386 makes them one receiver for every provider.

Acceptance criteria

  • A mattermost provider on feat(service): one webhook router verifies each provider its own way, parses a typed payload and delivers each event only to the consumers subscribed to it #1386, with cluster exposure, so its route is POST /webhooks/mattermost and no Ingress routes it.

  • A synchronous responder. This item adds the router's responder mode: a provider may declare a responder instead of consumers. The router runs its shared steps (drain, content type, cap, verify, parse, log, count), calls the responder with the validated payload, and returns its JSON reply. A responder reads only in-process state and makes no request.

  • The last round, per worker. RepoWorker records its last round's start, end and result, and exposes them with its running state and queue depth through one read-only method. Tested through the worker's public methods.

  • Commands. The text is split with shlex.split.

    • status, or no text, gives one line per repository in service.repos, from the roadmap consumer's workers:
      • running or idle;
      • the queue depth;
      • the last round's start and end (UTC) and result, or "no round yet".
    • No GitHub request is made.
    • status <owner/name> gives the same for one repository. An unknown name gets the list of known ones.
    • Anything else gets a usage line.
    • The reply is ephemeral. Its texts live in src/devops_cli/lang/en/messages.py, each one line (AGENTS.md:440).
  • Metrics. devops_cli_service_chat_commands_total{command, result}, beside the router's delivery counter.

  • Mattermost side.

    • The Mattermost object's mattermostEnv gains MM_SERVICESETTINGS_ALLOWEDUNTRUSTEDINTERNALCONNECTIONS=roadmap-service.devops.svc.cluster.local, with that host only.
    • The mattermost perimeter gains a policy selecting app: mattermost that allows egress to namespace devops on 8000, as a namespace-only peer with ports:. The database pods get no such egress.
    • roadmap-service's ingress policy admits only Mattermost's pods on 8000: one peer with namespace mattermost and pod label app: mattermost.
    • tests/test_k8s_network_policies.py and tests/test_k8s_roadmap_service.py assert all three.
  • Tests. A FastAPI TestClient over create_service_app, with a fake job, covers:

    • the real header shape Authorization: Token <token>, a wrong token, a missing header and a Bearer header;
    • a JSON body (415) and a form body;
    • each command, including a repository that has had no round;
    • 401 for every request when the option is unset.

    No test reaches the network, no test patches a devops-cli name (test(cli): tests double only process edges and mirror the source tree #1307), and each call phase stays under 1 s.

  • Guide. The "Roadmap service" section of k8s/README.md covers:

    • creating the slash command /roadmap: POST to http://roadmap-service.devops.svc.cluster.local:8000/webhooks/mattermost, with autocomplete on;
    • uv run devops config set mattermost.command_token;
    • uv run devops k8s push-secrets --only devops/devops-cli --context <context>.
  • uv run devops pr check-readiness passes.

  • uv run devops ci passes within its 5-minute budget.

Pending a person, after merge, after #1391 and once the Service runs a release with this item:

  • (a) /roadmap in any channel replies within 3 s, only to the caller, with one line per repository.
  • (b) After kubectl -n devops rollout restart deploy/roadmap-service, /roadmap replies again once /readyz answers 200.
  • (c) From outside the cluster, curl -s -o /dev/null -w '%{http_code}\n' -X POST https://hooks.<domain>/webhooks/mattermost prints none of the route's own codes (200, 401, 415): Traefik's 404 or an Access redirect both pass.
  • (d) devops_cli_service_webhook_deliveries_total{provider="mattermost"} counts the commands from (a) and (b).

Key questions

Strategic alignment

Proposed design

Problem statement

A person needs to see the state of each repository's roadmap Service lanes from Mattermost, without kubectl or Grafana. Today, the Service exposes only the GitHub webhook route, and the last round's result is not recorded. This item adds a /roadmap slash command that reads in-process state and replies with one line per repository and lane.

Acceptance criteria

  • Criterion 1: The router's AuthorizationToken(scheme) verifier exists and the mattermost provider uses it with scheme Token, reading the secret option mattermost.command_token.
    Verification: A test sends Authorization: Token and gets 200; a wrong token, a Bearer header, and a missing header each get 401 with one WARNING that names no token value. With the option unset, every request gets 401 and startup logs one WARNING naming the setting.
  • Criterion 2: Each RepoWorker records its last round's start, end and result. One read-only ServiceManager method returns, for every repository and lane, running or idle, pending triggers, and the last round or none. The responder reads only that method.
    Verification: A test through the public methods with a fake job per lane confirms the method returns per-lane state. A test with two lanes of one repository reports them on separate lines, one running and one idle.
  • Criterion 3: The text is split with shlex.split. status or no text gives one line per repository and lane. status gives that repository's lanes. An unknown name gets the list of known ones. Anything else gets a usage line. No GitHub request is made. The reply is ephemeral and its texts live in src/devops_cli/lang/en/messages.py, each one line.
    Verification: TestClient tests cover each command shape, the unknown-repo reply, the usage line, and assert no HTTP call to GitHub. The messages.py entries each hold one line (AGENTS.md:187).
  • Criterion 4: The mattermost provider declares a responder and no consumer or schedule.
    Verification: The provider declaration in the router shows a responder and no schedule field. No cron or poll entry references the mattermost provider.
  • Criterion 5: k8s/devops/roadmap-service/deployment.yaml:12 keeps replicas: 0 and its test passes unchanged.
    Verification: Run tests/test_k8s_roadmap_service.py:49 and confirm it passes. Inspect the YAML and confirm the value is 0.
  • Criterion 6: The mattermost provider has cluster exposure, its route is POST /webhooks/mattermost, and no Ingress routes it. Its content type is application/x-www-form-urlencoded; every other provider stays on application/json; anything else gets 415.
    Verification: The router exposure test pins the Ingress to tunnel providers only. A JSON body to the mattermost route gets 415. A form body gets 200.
  • Criterion 7: The router's responder mode runs shared steps (drain, content type, cap, verify, parse, log, count), calls the responder with the validated payload, and returns its JSON reply. A responder reads only in-process state and makes no request.
    Verification: The responder function signature takes the validated payload and returns a dict. No outbound HTTP call appears in the responder code path.
  • Criterion 8: The counter devops_cli_service_chat_commands_total{command, result} is incremented beside the router's delivery counter.
    Verification: A test asserts the counter increments after a command and after a usage reply.
  • Criterion 9: The Mattermost object's mattermostEnv gains MM_SERVICESETTINGS_ALLOWEDUNTRUSTEDINTERNALCONNECTIONS=roadmap-service.devops.svc.cluster.local. The mattermost perimeter gains a policy selecting app: mattermost that allows egress to namespace devops on 8000. roadmap-service's ingress policy admits only Mattermost's pods on 8000.
    Verification: tests/test_k8s_network_policies.py and tests/test_k8s_roadmap_service.py assert all three policies.
  • Criterion 10: TestClient over create_service_app covers the real header shape, wrong token, missing header, Bearer header, JSON body (415), form body, each command, a repository with no round, and 401 when the option is unset. No test reaches the network, no test patches a devops-cli name, and each call phase stays under 1 s.
    Verification: Run the new test module. Confirm no socket or requests import in the test. Confirm no devops-cli name is patched. Confirm each test's wall time is under 1 s.
  • Criterion 11: The Roadmap service section of k8s/README.md covers creating the slash command, setting the token, and pushing the secret.
    Verification: Read k8s/README.md:361 and confirm the three steps are present with the correct endpoint, command and push command.
  • Criterion 12: uv run devops pr check-readiness passes.
    Verification: Run the command and confirm exit code 0.
  • Criterion 13: uv run devops ci passes within its 5-minute budget.
    Verification: Run the command and confirm all checks pass within 300 s.

Key questions

Open questions

  • The Service acts as the machine account (ADR 0002). A chat user who triggers a write through it would make it unclear who acted.
  • A poll on demand would save at most one 300 s tick.
  • Outgoing webhooks fire on trigger words, and only in public channels.
  • A slash command is explicit, works in direct messages, and replies only to its caller.
  • Both need a build and a deployment inside Mattermost, and v11 dropped manually installed plugins.
  • A slash command is configuration plus one provider.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#1391

Activity

  1. added
    type/feature
    scope/k8s
    scope/security
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. It improves operator visibility into service state but does not fix a defect, security gap, or blocking issue.
    • Effort: High. It requires a new provider on the shared router, a synchronous responder mode, token verification, per-provider content-type handling, network-policy and ingress changes, and depends on #1386 (and possibly #1387).
  3. added
    status/blocked
    on Oct 11, 2026
  4. dan-petty commented on Oct 11, 2026

    @dan-petty
    OwnerAuthor

    Blocked by #1562: the roadmap Service's machine account is suspended, and the Service is held at 0 replicas. This item develops the Service or can only be checked on it, so it waits until the account is reinstated or the jobs act as a GitHub App.


    Generated by Claude Code

  5. dan-petty commented on Oct 26, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Priority: P2-Medium. The item is important for user experience but not critical or urgent.
    • Value: High. Users will benefit from seeing roadmap service status directly in Mattermost.
    • Effort: Medium. The work requires building a new command and integrating with the service's webhook router.
    • Possible duplicate: feat(roadmap): the roadmap service posts each release cut, ship and start to mattermost's releases channel #1394, which may ask for the same change. The model names a /roadmap slash command in mattermost shows each repository's roadmap service state as the change that both ask for. Both items add a /roadmap slash command in mattermost that shows roadmap service state. A person closes one of the two if that is so.
  6. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Refine cannot set this item to Ready at d509dba until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • The Service acts as the machine account (ADR 0002). A chat user who triggers a write through it would make it unclear who acted.
    • A poll on demand would save at most one 300 s tick.
    • Outgoing webhooks fire on trigger words, and only in public channels.
    • A slash command is explicit, works in direct messages, and replies only to its caller.
    • Both need a build and a deployment inside Mattermost, and v11 dropped manually installed plugins.
    • A slash command is configuration plus one provider.
  7. added
    priority/p2-medium
    status/new
    effort/medium
    value/high
    status/in-progress
    status/in-review
    and removed
    status/blocked
    status/new
    status/in-progress
    on Oct 28, 2026
  8. removed
    status/in-review
    on Oct 31, 2026
  9. added a commit that references this issue on Oct 31, 2026
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/k8sscope/securitytype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions