feat(m7-amend2): implicit lifecycle — writes drive state, no workflow UI

User: «Enlève également le workflow d'un test, quand on saisit des
informations côtés redteam cela signifie qu'il a été exécuté et donc
en attente d'une review blueteam.»

Backend (update_mission_test_fields)
- At the end of every PUT, inspect the touched-field set:
  - any red write on state in {pending, skipped, blocked} → state=executed
    + auto-stamp executed_at=now() if absent
  - any blue write on state=executed → state=reviewed_by_blue
- /transition endpoint kept for back-fill/admin use, not called from UI.

Frontend MissionTestPage
- Removed the transition-buttons header block and the `transition`
  mutation. State pill stays as a passive indicator.
- New labels: "Not started" / "Awaiting review" / "Reviewed" describe
  the implicit lifecycle, no longer exposing the state-machine concept.

E2E
- The SPA test that clicked `transition-executed` now verifies the
  implicit promotion: typing red fields and saving flips the pill from
  "Not started" → "Awaiting review", no button click required.

Spec
- §4 reword: "Cycle de vie implicite, piloté par les écritures" replaces
  the old "Workflow par test instance" bullet.

Tests
- 3 new pytest: red_command-alone implicit execute + auto-stamp,
  blue write promotes executed→reviewed, blue write on pending no-op.
- 142 pytest + 49 Playwright green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Knacky
2026-05-15 16:09:26 +02:00
parent 40114d041b
commit 28b8855e88
7 changed files with 141 additions and 70 deletions

View File

@@ -4,6 +4,37 @@ All notable changes to this project will be documented here. Format: [Keep a Cha
## [Unreleased]
### Changed (amendement 2026-05-15 bis) — explicit test workflow removed, lifecycle now driven by writes
User feedback: «Enlève également le workflow d'un test, quand on saisit
des informations côtés redteam cela signifie qu'il a été exécuté et donc
en attente d'une review blueteam.»
- **Backend `update_mission_test_fields`**: at the end of every PUT, the
service inspects the touched field set. Any red-side write on a non-
executed test (`pending` / `skipped` / `blocked`) promotes the state to
`executed`; if no `executed_at` was supplied, it auto-stamps `now()`.
Any blue-side write on an `executed` test promotes to `reviewed_by_blue`.
The `/transition` endpoint stays operational for back-fill / admin use
but is no longer the primary path.
- **`MISSION_TEST_STATE_LABEL`** rephrased to describe the implicit
lifecycle instead of the workflow: `Pending → Not started`, `Executed
→ Awaiting review`, `Reviewed_by_blue → Reviewed`, `Skipped`, `Blocked`.
- **`MissionTestPage.tsx`**: transition buttons in the header are gone.
The state pill remains as a passive indicator. The `transition`
mutation and its imports are dropped; `useMutation` is still used for
the red / blue field saves.
- **E2E**: the SPA test that previously clicked `transition-executed`
now exercises the implicit promotion — it just types in the red fields
and asserts that the state-pill flips from `Not started` to `Awaiting
review` on save.
- **Tests**: 3 new pytest cases — `test_red_writing_any_red_field_implicitly_executes_and_stamps`
(red_command alone bumps state + auto-stamps executed_at),
`test_blue_writing_any_blue_field_promotes_executed_to_reviewed`,
`test_blue_write_on_pending_does_not_auto_execute` (blue-on-pending is
a no-op — only red drives execution per the user's mental model).
- Total: **142 pytest** + 49 Playwright green.
### Fixed (post-amendement 2026-05-15) — stamping executed_at no longer needs a prior state transition
User feedback: when a red user typed `executed_at` inline on a pending test