Skip to content

Review flow changes in CI

diteko gate answers one question for a pull request: did this change break how a flow behaves? It runs in your pipeline after the flows are deployed to a test Connect instance (after terraform apply or cdk deploy), and judges each flow against the suite Diteko evolved for it.

Before you start:

  • Each flow is a Diteko project linked to its flow in the test instance, with a suite: imported from Connect and evolved at least once.
  • The server is 0.4 or later.
  • A key for CI. Without live tests, a WRITE key. With live tests, a PUBLISH_LIVE key with an expiry and a small daily live limit (Keys and scopes).

For each flow, in order:

  1. Imports the deployed flow, so Diteko holds what is in the instance.
  2. Checks it, free: flow validation and grammar validation. These run for every flow.
  3. Works out what changed since the flow the suite was evolved from. An unchanged flow stops here.
  4. Dry run, free: converts the tests the change affects to Connect’s format and reports any Connect would reject.
  5. Live run, only with --live: runs the affected tests on the test instance. Connect bills it.

The tests a change affects are those whose route through the flow passes through a block that was added, removed or changed. The same deployed flow gets the same verdict on every run: the gate compares with the suite’s own flow, not with whatever Diteko imported last.

When a change is intended, its tests fail until you evolve a new suite from the new flow. The summary says which flows need it.

Terminal window
pip install "diteko>=0.12"
export DITEKO_URL=https://diteko.internal.example.com
export DITEKO_API_KEY=… # from your CI's secret store
diteko gate --flow arn:aws:connect:af-south-1:123456789012:instance/…/contact-flow/…
Flag Meaning
--flow ID A Connect flow id or ARN in the test instance. Repeat it for more flows.
--all Every Diteko project linked to a Connect flow.
--live Also run the affected tests on Connect.
--max-executions N The most live tests the gate may start, across all flows. Needed with --live. A test that fails, or that Connect could not start, is re-run once, so Connect may run up to twice as many executions; a key’s daily limit counts them all.
--top N At most N tests per flow, in rank order.
--always Test every flow and every test, changed or not.
--timeout SECONDS How long to wait for each Connect run (default 1800).
--out DIR Where the reports go (default diteko-gate/).
Code Meaning
0 Every flow passed, or no flow changed.
1 A flow failed: a validation error, a test Connect would reject, a test that failed or was inconclusive.
2 Stopped by a budget: --max-executions, the key’s daily live limit, or a timeout.
3 Configuration: no DITEKO_URL, a key without the scope needed, a server older than 0.4, a flow the instance does not have, a flow with no suite.

With several flows, the worst result wins, in the order 3, 1, 2, 0.

  • diteko-gate.json: the full record, per flow. It includes the blocks changed, each check, the tests run with their verdicts, and flowContentSha256, the content the live tests ran against. Its schema field is the format’s version.
  • junit.xml: one test suite per flow, for any CI system’s test view.
  • summary.md: a short table for the job summary or a pull request comment. With GITHUB_STEP_SUMMARY set, the gate appends it there.

When live tests fail, diteko triage says why, for each one. Run it after the gate, in the same job. It reads the gate’s report and needs only a READ key:

Terminal window
diteko triage # reads diteko-gate/diteko-gate.json, writes diteko-triage.json and triage.md beside it
Verdict Meaning What to do
flow_change The test failed at a block this change touched, or after going through one. Fix the flow, or evolve a new suite if intended.
test_at_fault It failed outside the change, and it relies on a value it made up (a card number as “1”). Evolve a new suite, or give the test real values.
environment Connect could not start it, or it failed at a block that depends on the test instance. Check the instance and re-run.
inconclusive Nothing decides it. Read the execution records.

Each verdict lists its evidence: where the test failed, whether the change touched that block, the flow’s diagnostics there (RUNTIME_REFERENCE, LIBRARY_PROMPT, FOREIGN_INSTANCE) and any values the test made up. Rules decide; no model is called. Triage never changes the gate’s result, and it exits 0 whenever it writes its report (3 for configuration). --max-tests N caps the tests it reads (default 20). Triage needs diteko 0.11 or later. A failure after a changed block (a test that pressed a key the change rewired, and failed at the next prompt) needs diteko 0.12 and server 0.5 (API 1.7), which sends each test’s route; on an older server those failures are inconclusive.

Live tests check each prompt with Connect’s similarity match, so a small rewording usually still passes live. The gate’s static check is what catches it: the block shows as changed in the report.

The Action is in the public diteko-selfhost repository. Name the job diteko/change-review, then require that check in your branch protection.

jobs:
change-review:
name: diteko/change-review
runs-on: ubuntu-latest
environment: connect-test
permissions:
id-token: write # for the AWS role your deploy step assumes
contents: read
steps:
- uses: actions/checkout@v4
# … deploy the flows to the test instance (terraform apply, cdk deploy) …
- uses: Lehlohonolo-Sehako/diteko-selfhost/gate@v0.5.1
with:
diteko-url: ${{ vars.DITEKO_URL }}
api-key: ${{ secrets.DITEKO_API_KEY }}
flows: |
arn:aws:connect:af-south-1:123456789012:instance/…/contact-flow/…
live: true
max-executions: 20
triage: true

The Action uploads the reports as the diteko-gate artifact, and sets the outputs result and report. With triage: true, it runs diteko triage when the gate fails and adds its summary to the job’s. The gate only talks to Diteko, so the AWS credentials stay with your deploy step.

version: 0.2
env:
secrets-manager:
DITEKO_API_KEY: diteko/ci:api-key
variables:
DITEKO_URL: https://diteko.internal.example.com
phases:
install:
commands:
- pip install "diteko>=0.12"
build:
commands:
# … deploy the flows to the test instance …
- diteko gate --all --live --max-executions 20 || { code=$?; [ "$code" = 1 ] && diteko triage; exit "$code"; }
reports:
diteko:
files: [diteko-gate/junit.xml]
file-format: JUNITXML
change-review:
image: python:3.12
needs: [deploy-test]
script:
- pip install "diteko>=0.12"
- diteko gate --all --live --max-executions 20 || { code=$?; [ "$code" = 1 ] && diteko triage; exit "$code"; }
artifacts:
when: always
paths: [diteko-gate/]
reports:
junit: diteko-gate/junit.xml

Set DITEKO_URL as a CI/CD variable and DITEKO_API_KEY as a masked one.