Skip to content

feat(ci): Journey Impact declaration, enforced at merge (#2350) - #2408

Merged
dolho merged 2 commits into
devfrom
feature/2350-journey-impact-gate
Aug 27, 2026
Merged

dolho merged 2 commits into
devfrom
feature/2350-journey-impact-gate

Conversation

@dolho

@dolho dolho commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

Gate G1 of the journey-coverage deck. Every epic and user-facing feature declares what it does to the promise list, and the declaration is enforced at merge:

Journey Impact: new: J11
Journey Impact: extends: J03
Journey Impact: none: <why this touches no promise>

The declaration is cheap; the gate is the load-bearing part. Ownership alone collapses into "PM nags, Eng defers", and an intake field on its own is worse than nothing — everything is none: inside a month and the field reads as compliance. So the burden sits on the new: path: declaring a new promise obliges the same PR to carry a skeleton for it. That is what stops none: being the cheap escape — choosing it becomes a visible claim, in writing, next to a diff a reviewer can check it against.

Related Issue

Related to #2350

Journey Impact

Journey Impact: none: CI/process gate, no user-facing promise

What fails, what passes

Input Verdict
none (bare) REJECTED — AC 4
new: J11 with no skeleton naming J11 REJECTED
epic referenced by this PR declares new: J11, PR carries nothing REJECTED
new: J11 + strict=True xfail naming J11 under tests/journeys/ passes — AC 3
extends: J03 passes (that promise already has a harness)
none: <reason> passes
no declaration at all passes, with a loud note

That last row is deliberate: adopting the field must not red-X every in-flight PR and dependabot bump on day one. Tightening it is a follow-up once the templates have been in use.

Two design points

The skeleton is bound to the declared id. Without that, new: J11 is satisfied by any edit anywhere in the journey tier — including an unrelated tweak to an existing journey — which hands the obligation straight back to the theatre the gate exists to prevent. The id must appear in the skeleton's path or body.

The match deliberately does not use \b. Ids are routinely embedded underscore-delimited (test_j07_journey.py) and _ is a word character, so \bJ07\b never matches the very filename the naming convention produces — it would have rejected correctly-named skeletons. It delimits on letters and digits instead, so J07 still rejects J071 and XJ07.

The decision is a pure function, in scripts/ci/journey_impact.py, not a workflow shell body — a rule that only runs in CI is a rule nobody can test. 26 unit tests cover the parser and the decision; removing the id binding fails three of them (mutation-checked).

Security

A PR body is attacker-authored text, so it reaches the checker through env: and never through ${{ }} inside a run: — pinned by a test that greps every run: body in the workflow.

Acceptance criteria

  • Epic and PR templates carry the Journey Impact field
  • A PR under an epic declaring new: cannot merge without a journey skeleton present
  • A strict=True xfail asserting the journey's invariants satisfies the gate
  • none: <reason> requires a reason string — a bare none fails
  • The check reports which declaration it read and why it passed or failed

Verification

26 passed   tests/unit/test_2350_journey_impact.py
32 passed   + test_1891_python_version_parity.py (new workflow's pin)

End-to-end against a real diff (the commit that added the journey tier):

$ PR_BODY="Journey Impact: new: J01" BASE_SHA=571bb964^ HEAD_SHA=571bb964 \
    python3 scripts/ci/check_journey_impact.py
PR declares Journey Impact: 'new: J01'
PASSED — skeleton present for J01 (…)

and the rejection path:

$ PR_BODY="Journey Impact: new: J11" … 
REJECTED — this PR declares `new: J11`, which obliges this PR to carry a
journey skeleton under tests/journeys/. None found in 0 changed file(s).
A `strict=True` xfail naming J11 is enough:
    @pytest.mark.xfail(strict=True, reason='J11 not built yet')
    def test_j11_promise(): ...

Notes for the reviewer

Type of Change

  • CI / process

🤖 Generated with Claude Code

Gate G1 of the journey-coverage deck. Every epic and user-facing feature
declares what it does to the promise list:

    Journey Impact: new: J11
    Journey Impact: extends: J03
    Journey Impact: none: <why this touches no promise>

The declaration is cheap; the GATE is the load-bearing part. Ownership alone
collapses into "PM nags, Eng defers", and an intake field on its own is worse
than nothing — everything is `none:` inside a month and the field reads as
compliance. So the burden sits on the `new:` path: declaring a new promise
obliges the same PR to carry a skeleton for it. That is what stops `none:`
being the cheap escape — choosing it becomes a visible claim, in writing,
next to a diff a reviewer can check it against.

What fails: a malformed declaration (a bare `none` included, AC 4), and a
`new:` declaration — on the PR or on an epic it references — with no matching
skeleton in the diff. A `strict=True` xfail satisfies it (AC 3); `strict` is
what makes it a claim rather than a shrug, since it fails the build the day
the behaviour starts working.

Two design points worth stating, because both are the difference between a
gate and gate-shaped theatre:

- The skeleton is bound to the DECLARED id. Without that, `new: J11` is
  satisfied by any edit anywhere in the journey tier, including an unrelated
  tweak to an existing journey. The id must appear in the skeleton's path or
  body. The match deliberately does not use `\b`: ids are routinely embedded
  underscore-delimited (`test_j07_journey.py`) and `_` is a word character, so
  `\bJ07\b` never matches the very filename the convention produces. It
  delimits on letters and digits instead, so J07 still rejects J071 and XJ07.

- The decision is a pure function in scripts/ci/journey_impact.py, not a
  workflow shell body. A rule that only runs in CI is a rule nobody can test;
  26 unit tests cover it, and dropping the id binding fails three of them.

An absent declaration PASSES with a loud note. That is deliberate: adopting
the field must not red-X every in-flight PR and dependabot bump on day one.
Tightening it is a follow-up once the templates have been in use.

The PR body is attacker-authored, so it reaches the checker through `env:`
and never through `${{ }}` inside a `run:` — pinned by a test that greps the
workflow's run bodies.

Residual, matching #2336: turning this into a *required* status check needs
repo-admin settings and cannot be done from a PR.

Related to #2350

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment thread scripts/ci/journey_impact.py Fixed
…pair (#2350)

CodeQL py/bad-tag-filter, high: `<!--.*?-->` cannot match a comment spanning
newlines. Not exploitable here — `_DECL_RE` is line-bounded, so `raw` is always
one line — but the pair form was also wrong on this input in a way the fix
removes: an UNCLOSED comment was left in the text, so

    Journey Impact: none: fine <!-- todo

read as the reason "fine <!-- todo". Everything from `<!--` on a single line is
comment, so truncating there is both more correct and not a tag filter at all.

Related to #2350

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@obasilakis obasilakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving.

CI is fully green (22 checks) and the one thread — CodeQL py/bad-tag-filter on the pair-matching regex — is genuinely fixed in a6b1a7da: raw.split("<!--", 1)[0].strip() also closes the unclosed-<!-- case the alert documented.

One non-blocking note for the merge: the body says "Related to #2350" with no closing keyword, so #2350 won't auto-close.

@dolho
dolho merged commit 4e676b1 into dev Aug 27, 2026
22 checks passed
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