flow-workflows 0.106.0 → 0.107.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/codex/CORE.md +52 -2
- package/adapters/codex/skills/flow-bug-ship/SKILL.md +3 -0
- package/adapters/codex/skills/flow-bug-validate/SKILL.md +1 -1
- package/adapters/codex/skills/flow-feat-build/SKILL.md +6 -3
- package/adapters/codex/skills/flow-feat-ship/SKILL.md +8 -4
- package/adapters/codex/skills/flow-feat-validate/SKILL.md +5 -2
- package/adapters/codex/skills/flow-work-green/SKILL.md +11 -7
- package/adapters/codex/skills/flow-work-respond/SKILL.md +6 -1
- package/adapters/gemini/CORE.md +52 -2
- package/adapters/gemini/commands/flow/bug/ship.toml +3 -0
- package/adapters/gemini/commands/flow/bug/validate.toml +1 -1
- package/adapters/gemini/commands/flow/feat/build.toml +6 -3
- package/adapters/gemini/commands/flow/feat/ship.toml +8 -4
- package/adapters/gemini/commands/flow/feat/validate.toml +5 -2
- package/adapters/gemini/commands/flow/work/green.toml +11 -7
- package/adapters/gemini/commands/flow/work/respond.toml +6 -1
- package/adapters/hermes/CORE.md +52 -2
- package/adapters/hermes/skills/flow-bug-ship/SKILL.md +3 -0
- package/adapters/hermes/skills/flow-bug-validate/SKILL.md +1 -1
- package/adapters/hermes/skills/flow-feat-build/SKILL.md +6 -3
- package/adapters/hermes/skills/flow-feat-ship/SKILL.md +8 -4
- package/adapters/hermes/skills/flow-feat-validate/SKILL.md +5 -2
- package/adapters/hermes/skills/flow-work-green/SKILL.md +11 -7
- package/adapters/hermes/skills/flow-work-respond/SKILL.md +6 -1
- package/adapters/opencode/CORE.md +52 -2
- package/adapters/opencode/commands/flow-bug-ship.md +3 -0
- package/adapters/opencode/commands/flow-bug-validate.md +1 -1
- package/adapters/opencode/commands/flow-feat-build.md +6 -3
- package/adapters/opencode/commands/flow-feat-ship.md +8 -4
- package/adapters/opencode/commands/flow-feat-validate.md +5 -2
- package/adapters/opencode/commands/flow-work-green.md +11 -7
- package/adapters/opencode/commands/flow-work-respond.md +6 -1
- package/package.json +1 -1
- package/plugins/flow/.claude-plugin/plugin.json +1 -1
- package/plugins/flow/CHANGELOG.md +21 -0
package/adapters/codex/CORE.md
CHANGED
|
@@ -17,7 +17,7 @@ Every `$flow-*` command assumes these rules. They are stated once, here, so a co
|
|
|
17
17
|
carries what is specific to its phase. Read this once per session; a command that says "load
|
|
18
18
|
`flow-core`" means this file.
|
|
19
19
|
|
|
20
|
-
**This file belongs to flow `0.
|
|
20
|
+
**This file belongs to flow `0.107.0`.** Compare it once, at the start of the session, against
|
|
21
21
|
`version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
|
|
22
22
|
is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
|
|
23
23
|
— which is exactly what happens when a branch or a release candidate is loaded over an installed
|
|
@@ -449,7 +449,7 @@ person asking for changes, a ticket that already has code — is `$flow-work-run
|
|
|
449
449
|
| Writing a DB schema change, index or migration — in any phase, a review's own fixes included — or applying one (`validate`) | question `migration`, before the first line of it is written or run — except in `respond` and `green`, where it is blocked: a schema change agreed after the MR/PR exists goes back through `build`. Writing one whose every object `approved-schema.md` lists is not asked (§2, a schema approved with the study) |
|
|
450
450
|
| `review` with blockers or high-severity findings | question `high_findings` |
|
|
451
451
|
| `validate` with a criterion `unproven` | blocked — the phase does not advance and does not chain |
|
|
452
|
-
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed — never delete, skip or loosen a test*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `$flow-feat-build` (`$flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker. A round that did not lower the count, or a third round still red → blocked, naming the tests still red
|
|
452
|
+
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. **Before either record below, the cause is looked for** (§11, a red test outside the change): a test that would take the base exception or the flake record and whose cause §11 identifies is not excused — it goes to the repair rounds below, its step naming the cause, and counts in their `<n>`; only a test whose cause is not identified takes a record, and **a pass that sends any test to a repair round writes no record at all** — the others are measured again at the next validate, so the pass has one ending. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry — unless §11 finds the fragility in the test itself (it counts ticks the diff's extra load now delays): then the test is the step, fixed as §11 says. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed, or — for a test §11 found fragile — make it assert on the result it meant to prove; never delete, skip, retry or loosen a test, and never lengthen a timeout*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `$flow-feat-build` (`$flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker; a fragile test rewritten to assert on the same result, as §11 allows, is not loosened. A round that did not lower the count, or a third round still red → blocked, naming the tests still red, the count each round left and, for each, what a person does next |
|
|
453
453
|
| A product decision (§7 `decision`) | question `decision` |
|
|
454
454
|
| Clarifying questions on the ticket (`start`) | question `clarify` — after the branch and the work folder exist, with the questions also written to `01-context.md` |
|
|
455
455
|
| An unanswered high-severity challenge (`design`, `investigate`) | question `design_challenge` / `investigation_challenge` |
|
|
@@ -1432,3 +1432,53 @@ before and after:
|
|
|
1432
1432
|
|
|
1433
1433
|
Bugs do not link: a bug repairs something already delivered, and the roadmap tracks what is still to
|
|
1434
1434
|
deliver. A bug that *is* a roadmap item is started as a feature.
|
|
1435
|
+
|
|
1436
|
+
## 11. A red test outside the change — find the cause before it is excused
|
|
1437
|
+
|
|
1438
|
+
A test this diff did not touch goes red, and every path flow has for it — the base exception and the
|
|
1439
|
+
flake record of `validate` (§2.1), a rerun in `green`, "not reproduced" in `respond` — hands it to a
|
|
1440
|
+
person. When flow can see why the test is red, handing it over is the wrong answer: the MR/PR has to
|
|
1441
|
+
go green to merge, so the fix is in scope whether or not the diff touched that test.
|
|
1442
|
+
|
|
1443
|
+
**Look for the cause first.** Read the test and the code it drives, and name the mechanism. Typical
|
|
1444
|
+
causes in the test: it asserts on **how many times** something ran (timer ticks, calls, retries)
|
|
1445
|
+
inside a wall-clock window instead of on what came out — when the count *is* the behaviour (retries, calls made), the count stays and the clock is what gets fixed (a fake or injected time source); it depends on the order tests run in; it
|
|
1446
|
+
reads state another test left behind (a shared fixture, a global, a file, a port); it sleeps and
|
|
1447
|
+
hopes. Typical causes in the code: a race, an await missing, a resource not released.
|
|
1448
|
+
|
|
1449
|
+
**Identified means evidence, not a story.** A cause is identified only when the diagnosis names it at
|
|
1450
|
+
`file:line` **and** either (a) a forced reproduction turns the test red on purpose — stall the timer,
|
|
1451
|
+
reorder the run, leave the shared state dirty, load the machine — or (b) the mechanism is in the
|
|
1452
|
+
assertion itself, plain to read (it counts ticks in a time window, it expects an order nobody
|
|
1453
|
+
guarantees). A plausible guess with neither is **not identified**, and is never acted on.
|
|
1454
|
+
|
|
1455
|
+
**Identified → a repair step in this MR/PR**, aimed where the cause is:
|
|
1456
|
+
|
|
1457
|
+
- **In the test** → the test is rewritten to prove the **same behaviour by its result**, not by its
|
|
1458
|
+
timing or its order. That is not loosening it: the assertion keeps its subject and gets a sturdier
|
|
1459
|
+
witness. Never delete, skip, retry or loosen it, and never lengthen a timeout or a sleep — each one
|
|
1460
|
+
hides the cause instead of removing it. Where (a) applied, the forced reproduction passes after the
|
|
1461
|
+
fix.
|
|
1462
|
+
- **In the code** → the step fixes the code; the test stays as it is.
|
|
1463
|
+
- **Proved by the whole suite**, never by `quality.test_one` alone — an order- or load-dependent test already passes on its own — plus the forced reproduction where (a) applied.
|
|
1464
|
+
- A fragile test in a file this diff touches is repaired the same way: it never had the exception to lose.
|
|
1465
|
+
- **Its own commit** — `Fix fragile test <name>: <cause in one line>` — never folded into another
|
|
1466
|
+
step's or round's commit, so a reviewer reads it alone.
|
|
1467
|
+
- **The MR/PR body says so**, under `## Also fixed`: `` `<test>` — <cause>; <what changed> `` —
|
|
1468
|
+
written by `ship` for a repair made before it (`$flow-feat-ship`, `$flow-bug-ship`); a repair made
|
|
1469
|
+
by `green` or `respond` on an MR/PR already open adds the line itself: to `publish-body.md` in
|
|
1470
|
+
`unattended`, otherwise to the MR/PR description with the push, shown at the push gate.
|
|
1471
|
+
|
|
1472
|
+
**Not identified → the path that already exists** (the base exception, the flake record, a rerun,
|
|
1473
|
+
`blocked`), and whatever that path leaves red says, in the slot it already has — the stop's
|
|
1474
|
+
`I need:`, the `blocked` reason, the "what to do" of a line under `## Not verified — needs a human` —
|
|
1475
|
+
**what the person does next**, in one plain line: *rerun CI; if `<test>` fails again, its cause is
|
|
1476
|
+
not in this change — open a ticket for it*, never only that the test is red.
|
|
1477
|
+
|
|
1478
|
+
**A CI failure that does not reproduce here** (`green`, or a CI log a person pasted into a review
|
|
1479
|
+
thread for `respond`) is diagnosed the same way, from its log and the test's code: a fragility
|
|
1480
|
+
identified → fix it as above and push it, even though it would not go red locally. Neither
|
|
1481
|
+
reproduced nor identified → change nothing for it and say so. In `unattended` that run ends with
|
|
1482
|
+
its usual closing order when it changed code (`publish`: the push reruns CI anyway); when it changed
|
|
1483
|
+
nothing, it ends `blocked`, its one-line reason starting `rerun CI: <job>[, <job>…]` — not
|
|
1484
|
+
reproduced, no cause found — so the orchestrator knows a rerun is all that is left.
|
|
@@ -91,6 +91,9 @@ Template (in this order):
|
|
|
91
91
|
<bullets from the "What is NOT touched" section of the Brief. Important so the reviewer knows the fix is minimal.>
|
|
92
92
|
<then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — the neighbouring bug, the similar-risk pattern, the prevention action — with its ticket id when one exists. Omit the block when there are none.>
|
|
93
93
|
|
|
94
|
+
## Also fixed
|
|
95
|
+
<only when a test outside this fix went red and was repaired because its cause was identified (flow-core §11): one line each, `` `<test>` — <cause>; <what changed> ``. Omit the section otherwise.>
|
|
96
|
+
|
|
94
97
|
## Evidence
|
|
95
98
|
<only if `.claude/work/<TICKET>/evidence/` has files and `quality.evidence` is not `off`. The **before** is what `03-investigation.md` captured when the failure was reproduced — the one moment it exists — and the **after** is §2.5 of `05-validation.md`. A bug fix is the change where a before/after pair carries the most: it *is* the argument. Same upload rules as `$flow-feat-ship`. Omit when there is nothing.>
|
|
96
99
|
|
|
@@ -97,7 +97,7 @@ this is the same gate as a red test.
|
|
|
97
97
|
|
|
98
98
|
## 5. Close
|
|
99
99
|
|
|
100
|
-
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides:
|
|
100
|
+
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides — and before any test is excused there, its cause is looked for (flow-core §11): identified → a repair step, its own commit, never an exception or a flake record. Every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `$flow-bug-fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red and, for each, what a person does next. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
|
|
101
101
|
- Green → `phase = "validate"`, add to `phases_done`; in the same write record `validated_sha` = `git rev-parse HEAD` — the tree the regression test passed on, which `$flow-bug-ship §0` reads. Suggest `$flow-bug-review`.
|
|
102
102
|
- **Other bugs detected become `followups[]` entries** (flow-core §7) when they clear its bar — a reproducible symptom with someone who suffers it, not «this looks fragile» — per the output template.
|
|
103
103
|
- **Stage what the validation taught** (`knowledge.stage` set; silence by default): a mutation that stayed green, a disguise the scenario wore, a fixture that could not produce the case — findings about how this codebase is tested, not about this diff. Same rule and evidence line as the review's Close.
|
|
@@ -94,9 +94,12 @@ there → it is a question like any other.
|
|
|
94
94
|
Chained from a review's `high_findings` *Fix them* → the findings are unticked steps at the end of
|
|
95
95
|
this MR/PR's plan: build them in order, then chain into `$flow-feat-review`. Chained from a red
|
|
96
96
|
suite at validate (flow-core §2.1) → the same, under the plan's latest `### Red suite at validate
|
|
97
|
-
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code
|
|
98
|
-
assertion this MR/PR's design changed —
|
|
99
|
-
|
|
97
|
+
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code, by an
|
|
98
|
+
assertion this MR/PR's design changed, or — a step naming a fragile test's cause (flow-core §11) —
|
|
99
|
+
by making it assert on the result it meant to prove, in its own commit `Fix fragile test <name>:
|
|
100
|
+
<cause>`; never by deleting, skipping, retrying or loosening it, or by a longer timeout. Run each
|
|
101
|
+
step's test with `quality.test_one` before ticking it — and a §11 step with the whole suite plus its
|
|
102
|
+
forced reproduction, since an order- or load-dependent test already passes on its own.
|
|
100
103
|
|
|
101
104
|
**The brief travels inside the question** (flow-core §3): the user reads it in the prompt they are answering, never by opening `05-implementation.md`. Write the file, run whatever you need, and *then* open the gate — **nothing runs between the brief and the question**, because a tool call after it is what lets a terminal fold the brief into one collapsed line, and the gate is answered blind. Options:
|
|
102
105
|
- **Yes, proceed** → start building.
|
|
@@ -68,10 +68,14 @@ place it would ask:
|
|
|
68
68
|
|
|
69
69
|
**In every mode**, criteria `07-validation.md` marks `not-verified-unattended` go into the body under
|
|
70
70
|
`## Not verified — needs a human`, with what to do for each — and so do the tests the suite left red
|
|
71
|
-
because they also fail on the base (`unattended:validate-red-base`): each name,
|
|
72
|
-
where it failed too — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
73
|
-
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches `` — and the review findings an orchestrator's answer accepted unfixed
|
|
74
|
-
(`06-review.md` "Answered (unattended)"), one line each.
|
|
71
|
+
because they also fail on the base (`unattended:validate-red-base`): each name, the base sha
|
|
72
|
+
where it failed too, and what the person does next (flow-core §11) — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
73
|
+
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches; rerun CI, and if it fails again open a ticket for it `` — and the review findings an orchestrator's answer accepted unfixed
|
|
74
|
+
(`06-review.md` "Answered (unattended)"), one line each. A test outside the change that this
|
|
75
|
+
MR/PR repaired because its cause was identified (flow-core §11) — a repair step of a validate round,
|
|
76
|
+
or of `green`/`respond` — goes under `## Also fixed`, one line each:
|
|
77
|
+
`` `<test>` — <cause>; <what changed> ``, so the reviewer sees why a test this change did not need
|
|
78
|
+
was touched. The §3 preview shows that section like
|
|
75
79
|
any other, and the person reading it is the check the run could not do. Entries of
|
|
76
80
|
`auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
|
|
77
81
|
`mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
|
|
@@ -233,13 +233,16 @@ Write `.claude/work/<TICKET>/07-validation.md`:
|
|
|
233
233
|
failing tests on the base the way they went red on HEAD — the whole suite, three runs on each side
|
|
234
234
|
for a test that is red in the suite and green on its own — and write each name, its result there,
|
|
235
235
|
the run counts and the base sha under "Suite results" in `07-validation.md`. Calling a failure "pre-existing" without that run is not the
|
|
236
|
-
exception — it is a red suite.
|
|
236
|
+
exception — it is a red suite. **Before a test takes the exception or the flake record, its cause
|
|
237
|
+
is looked for** (flow-core §11, a red test outside the change): identified → it is not excused, it
|
|
238
|
+
becomes a step of the repair round below, named with its cause, fixed in its own commit and listed
|
|
239
|
+
under `## Also fixed` by `ship`. Tests red once in HEAD's three runs, never on the base, outside the
|
|
237
240
|
files this diff touches, green on their own and proving no criterion are suspect flakes: when every test red in HEAD's three runs is one,
|
|
238
241
|
five more whole-suite runs on HEAD decide — nothing red in them → `unattended:validate-flaky`, the
|
|
239
242
|
counts under "Suite results", and the phase advances. Short of it, the red suite gets a repair round (the same row):
|
|
240
243
|
the failing tests become unticked steps of this MR/PR's plan, `phase = build`, and the run
|
|
241
244
|
chains into `$flow-feat-build`, then review and this phase again. Rounds go on while each lowers
|
|
242
245
|
the red count, three at most; one that does not, or a third still red → `blocked`, naming the
|
|
243
|
-
tests still red.
|
|
246
|
+
tests still red and, for each, what a person does next.
|
|
244
247
|
|
|
245
248
|
In `guided`/`auto` this is, together with the brief in `$flow-feat-build §2`, **the only stop of the whole MR/PR** — everything between them ran without a person. It carries the **full stop header** and the body answers, in this order: what is green, what this MR/PR proves and what it does not, and what shipping it takes. Assume the user has read none of the build and review.
|
|
@@ -43,7 +43,7 @@ Read `~/.claude/flow/CORE.codex.md` first (shared rules: `FLOW.md` step 0, model
|
|
|
43
43
|
2. Creating/switching a branch, or DB schema changes/migrations, if a fix requires them.
|
|
44
44
|
3. **Re-triggering a pipeline or job on the remote** (CI resources; outward action).
|
|
45
45
|
4. **Integrating the base branch** — any `git merge`/`git rebase` of `git.default_base` into the branch, and any history rewrite or force-push it implies (§5.C).
|
|
46
|
-
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides.
|
|
46
|
+
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides. A fragile test rewritten to assert on the same result, as flow-core §11 allows, is not loosening it.
|
|
47
47
|
|
|
48
48
|
**In `unattended`** (flow-core §2.1) — launched by `$flow-work-run` on `why = pipeline` or
|
|
49
49
|
`why = conflict` — this command never touches the forge. Gate 5 holds exactly as written; the
|
|
@@ -57,8 +57,10 @@ others resolve this way:
|
|
|
57
57
|
conflicts with `base`, which the orchestrator left in the checkout as `origin/<base>` at
|
|
58
58
|
`base_sha`. That is the only blocker of the round — category C, nothing to triage. `origin/<base>`
|
|
59
59
|
missing or not at `base_sha` → `blocked`: the run would merge a base nobody named.
|
|
60
|
-
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) →
|
|
61
|
-
|
|
60
|
+
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → when the round
|
|
61
|
+
changed no code, `blocked` with the evidence and a one-line reason starting `rerun CI: <job>[,
|
|
62
|
+
<job>…]` (flow-core §11): the run has no rerun order, and the orchestrator owns reruns and the
|
|
63
|
+
red-round limit; when the round changed code, its `publish` reruns CI anyway.
|
|
62
64
|
**C** (conflict, behind base) on `why = pipeline`, and anything needing a rebase or force-push →
|
|
63
65
|
`blocked`: the orchestrator brings the base in, and relaunches with `why = conflict` when it
|
|
64
66
|
conflicts. A **human** blocker → `blocked`, naming who. **S** → fixed within
|
|
@@ -138,12 +140,14 @@ Categories:
|
|
|
138
140
|
| **L — lint / style / format** | formatter or linter job red | mechanical auto-fix with `quality.style_fix` (or the repo's formatter) |
|
|
139
141
|
| **T — test failure** | a unit/integration/functional/frontend test failed | **root-cause fix**: real regression → fix the code; behavior changed *on purpose* → update the test to the new contract (justified from the design) |
|
|
140
142
|
| **Y — type / build / compile** | type-check (`static_analysis`) or build broke | fix the code/types |
|
|
141
|
-
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
143
|
+
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) **whose cause in the test or the code was looked for and not identified** (flow-core §11) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
142
144
|
| **S — quality gate / scope** | coverage threshold, security scan, a lint rule newly hitting legacy code | judgment call: fix within scope, or defer/config with justification — never touch unrelated code just to appease a gate without confirming |
|
|
143
145
|
| **C — conflict / branch behind base** | the branch conflicts with `git.default_base`, or the host requires it updated before merging | integrate the base into the branch and **resolve each conflict on its merits** (§5.C) — hard gate before touching git history |
|
|
144
146
|
| **H — human blocker** | draft/WIP, approvals missing, unresolved review threads, a required reviewer or check that only a person can clear | **not this command's job**: name it, say exactly what is needed and from whom, and route it (threads → `$flow-work-respond`; draft → offer to mark ready; approvals → the reviewers). Never work around it |
|
|
145
147
|
|
|
146
|
-
**
|
|
148
|
+
**A test this diff did not touch is still this command's.** A red test that looks flaky is diagnosed before it is called K (flow-core §11): read its log tail and its code; a fragility identified there — it counts timer ticks, depends on order, reads another test's leftovers — or a cause in the code is **T**, fixed in this round even when it does not go red locally, in its own commit `Fix fragile test <name>: <cause>`, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Only a cause not identified stays K.
|
|
149
|
+
|
|
150
|
+
**Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks (a flow-core §11 rewrite onto the same result is not weakening), never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
|
|
147
151
|
|
|
148
152
|
Present a **triage table**: `blocker → kind → category → probable cause (log or merge verdict) → proposed action`, **C** and **H** rows first (a conflict makes the pipeline result provisional — CI reruns on a different tree after integrating the base). In `manual`, let the user re-categorize any row (especially T-vs-K) before proceeding.
|
|
149
153
|
|
|
@@ -166,9 +170,9 @@ Only **base-integration**, **auto-fix** and **code-fix**:
|
|
|
166
170
|
|
|
167
171
|
- **Design-invalidation first.** A test failure that shows the *design* was wrong → do not patch the test into agreement; update `03-design.md` **before** editing; if large, route back through `$flow-feat-build` / `$flow-bug-fix`.
|
|
168
172
|
- **Delegate the edits** to the expert sub-agents (FLOW.md `agents`); the conductor stays on judgment. Repo conventions plus the **comment discipline** of `$flow-feat-build` — comments only for a non-obvious *why*, never a ticket ID or "for MR #N".
|
|
169
|
-
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote.
|
|
173
|
+
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote. A fragile test fixed by flow-core §11 is checked with its forced reproduction when there is one, then pushed the same way.
|
|
170
174
|
- **Re-run the review gate for non-trivial code-fixes.** More than a mechanical tweak → `quality.review_skill` (or built-in `code-review` if empty) on this round's diff before pushing. Pass the diagnosis as context, never as a scope exclusion (*"the cause was X"*, not *"skip X"*). High-severity findings block the push until addressed.
|
|
171
|
-
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). The push is a hard gate in **every** mode.
|
|
175
|
+
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). A fragile-test repair (flow-core §11) is split into its own commit in every mode, and the round's summary names it as *also fixes fragile test `<name>`: <cause>*. The push is a hard gate in **every** mode.
|
|
172
176
|
|
|
173
177
|
### 5.C Integrate the base and resolve conflicts (category C)
|
|
174
178
|
|
|
@@ -101,7 +101,10 @@ back through it, and the hard gates above resolve this way:
|
|
|
101
101
|
- **The one closing order**, after the WIP commit (flow-core §2.1): code changed this round →
|
|
102
102
|
`publish` with the work's `publish-title.md` / `publish-body.md` (updated when the round changed
|
|
103
103
|
what they say, and naming any thread whose reply failed) and no `--part/--of` — the MR/PR is
|
|
104
|
-
already open (flow-core §2.1) — so the commits the replies name reach the branch
|
|
104
|
+
already open (flow-core §2.1) — so the commits the replies name reach the branch (and the push reruns CI, so a
|
|
105
|
+
failure nobody could explain needs nothing more); no code changed, every reply went out and a
|
|
106
|
+
thread carried a CI failure neither reproduced nor explained (§3) → `blocked`, its one-line reason
|
|
107
|
+
starting `rerun CI: <job>[, <job>…]` (flow-core §11); no code changed and every reply went
|
|
105
108
|
out → `done`, the summary listing the threads answered; no code changed and a reply failed →
|
|
106
109
|
`blocked`, naming those threads.
|
|
107
110
|
|
|
@@ -150,6 +153,8 @@ Categories:
|
|
|
150
153
|
| **F — obsolete/done** | Already addressed, or no longer applies | reply pointing to where |
|
|
151
154
|
| **G — data / performance objection** | The reviewer says a query is slow, unbounded, unindexed, or proposes a different query | **measure first** (§4.G), then reply with the plan |
|
|
152
155
|
|
|
156
|
+
**A thread that carries a CI failure** — a person pasted a failing job's log or a red test's output — is a **C** about that test, not an **A** to answer: reproduce it with `quality.test_one`; red → fix it on its merits, through flow-core §11 when the test is outside this diff. Not red here → diagnose it from the pasted log and the test's code (flow-core §11): a fragility identified (it counts timer ticks, depends on order, reads another test's leftovers) or a cause in the code → fix it in its own commit `Fix fragile test <name>: <cause>`, and the reply names that commit and the cause, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Neither → change nothing for it; the reply says it did not reproduce, that no cause was found in the test or the code, and what the person does next (*rerun CI; if it fails again, …*) — never a bare "not reproduced".
|
|
157
|
+
|
|
153
158
|
Present a **triage table** to the user: `thread → location → category → proposed action → one-line rationale` — the map for the rest of the command. In `manual` mode, let the user re-categorize any row before proceeding.
|
|
154
159
|
|
|
155
160
|
## 4. Agree the response per thread (the debate)
|
package/adapters/gemini/CORE.md
CHANGED
|
@@ -16,7 +16,7 @@ Every `/flow:*` command assumes these rules. They are stated once, here, so a co
|
|
|
16
16
|
carries what is specific to its phase. Read this once per session; a command that says "load
|
|
17
17
|
`flow-core`" means this file.
|
|
18
18
|
|
|
19
|
-
**This file belongs to flow `0.
|
|
19
|
+
**This file belongs to flow `0.107.0`.** Compare it once, at the start of the session, against
|
|
20
20
|
`version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
|
|
21
21
|
is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
|
|
22
22
|
— which is exactly what happens when a branch or a release candidate is loaded over an installed
|
|
@@ -448,7 +448,7 @@ person asking for changes, a ticket that already has code — is `/flow:work:run
|
|
|
448
448
|
| Writing a DB schema change, index or migration — in any phase, a review's own fixes included — or applying one (`validate`) | question `migration`, before the first line of it is written or run — except in `respond` and `green`, where it is blocked: a schema change agreed after the MR/PR exists goes back through `build`. Writing one whose every object `approved-schema.md` lists is not asked (§2, a schema approved with the study) |
|
|
449
449
|
| `review` with blockers or high-severity findings | question `high_findings` |
|
|
450
450
|
| `validate` with a criterion `unproven` | blocked — the phase does not advance and does not chain |
|
|
451
|
-
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed — never delete, skip or loosen a test*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow:feat:build` (`/flow:bug:fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker. A round that did not lower the count, or a third round still red → blocked, naming the tests still red
|
|
451
|
+
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. **Before either record below, the cause is looked for** (§11, a red test outside the change): a test that would take the base exception or the flake record and whose cause §11 identifies is not excused — it goes to the repair rounds below, its step naming the cause, and counts in their `<n>`; only a test whose cause is not identified takes a record, and **a pass that sends any test to a repair round writes no record at all** — the others are measured again at the next validate, so the pass has one ending. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry — unless §11 finds the fragility in the test itself (it counts ticks the diff's extra load now delays): then the test is the step, fixed as §11 says. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed, or — for a test §11 found fragile — make it assert on the result it meant to prove; never delete, skip, retry or loosen a test, and never lengthen a timeout*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow:feat:build` (`/flow:bug:fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker; a fragile test rewritten to assert on the same result, as §11 allows, is not loosened. A round that did not lower the count, or a third round still red → blocked, naming the tests still red, the count each round left and, for each, what a person does next |
|
|
452
452
|
| A product decision (§7 `decision`) | question `decision` |
|
|
453
453
|
| Clarifying questions on the ticket (`start`) | question `clarify` — after the branch and the work folder exist, with the questions also written to `01-context.md` |
|
|
454
454
|
| An unanswered high-severity challenge (`design`, `investigate`) | question `design_challenge` / `investigation_challenge` |
|
|
@@ -1431,3 +1431,53 @@ before and after:
|
|
|
1431
1431
|
|
|
1432
1432
|
Bugs do not link: a bug repairs something already delivered, and the roadmap tracks what is still to
|
|
1433
1433
|
deliver. A bug that *is* a roadmap item is started as a feature.
|
|
1434
|
+
|
|
1435
|
+
## 11. A red test outside the change — find the cause before it is excused
|
|
1436
|
+
|
|
1437
|
+
A test this diff did not touch goes red, and every path flow has for it — the base exception and the
|
|
1438
|
+
flake record of `validate` (§2.1), a rerun in `green`, "not reproduced" in `respond` — hands it to a
|
|
1439
|
+
person. When flow can see why the test is red, handing it over is the wrong answer: the MR/PR has to
|
|
1440
|
+
go green to merge, so the fix is in scope whether or not the diff touched that test.
|
|
1441
|
+
|
|
1442
|
+
**Look for the cause first.** Read the test and the code it drives, and name the mechanism. Typical
|
|
1443
|
+
causes in the test: it asserts on **how many times** something ran (timer ticks, calls, retries)
|
|
1444
|
+
inside a wall-clock window instead of on what came out — when the count *is* the behaviour (retries, calls made), the count stays and the clock is what gets fixed (a fake or injected time source); it depends on the order tests run in; it
|
|
1445
|
+
reads state another test left behind (a shared fixture, a global, a file, a port); it sleeps and
|
|
1446
|
+
hopes. Typical causes in the code: a race, an await missing, a resource not released.
|
|
1447
|
+
|
|
1448
|
+
**Identified means evidence, not a story.** A cause is identified only when the diagnosis names it at
|
|
1449
|
+
`file:line` **and** either (a) a forced reproduction turns the test red on purpose — stall the timer,
|
|
1450
|
+
reorder the run, leave the shared state dirty, load the machine — or (b) the mechanism is in the
|
|
1451
|
+
assertion itself, plain to read (it counts ticks in a time window, it expects an order nobody
|
|
1452
|
+
guarantees). A plausible guess with neither is **not identified**, and is never acted on.
|
|
1453
|
+
|
|
1454
|
+
**Identified → a repair step in this MR/PR**, aimed where the cause is:
|
|
1455
|
+
|
|
1456
|
+
- **In the test** → the test is rewritten to prove the **same behaviour by its result**, not by its
|
|
1457
|
+
timing or its order. That is not loosening it: the assertion keeps its subject and gets a sturdier
|
|
1458
|
+
witness. Never delete, skip, retry or loosen it, and never lengthen a timeout or a sleep — each one
|
|
1459
|
+
hides the cause instead of removing it. Where (a) applied, the forced reproduction passes after the
|
|
1460
|
+
fix.
|
|
1461
|
+
- **In the code** → the step fixes the code; the test stays as it is.
|
|
1462
|
+
- **Proved by the whole suite**, never by `quality.test_one` alone — an order- or load-dependent test already passes on its own — plus the forced reproduction where (a) applied.
|
|
1463
|
+
- A fragile test in a file this diff touches is repaired the same way: it never had the exception to lose.
|
|
1464
|
+
- **Its own commit** — `Fix fragile test <name>: <cause in one line>` — never folded into another
|
|
1465
|
+
step's or round's commit, so a reviewer reads it alone.
|
|
1466
|
+
- **The MR/PR body says so**, under `## Also fixed`: `` `<test>` — <cause>; <what changed> `` —
|
|
1467
|
+
written by `ship` for a repair made before it (`/flow:feat:ship`, `/flow:bug:ship`); a repair made
|
|
1468
|
+
by `green` or `respond` on an MR/PR already open adds the line itself: to `publish-body.md` in
|
|
1469
|
+
`unattended`, otherwise to the MR/PR description with the push, shown at the push gate.
|
|
1470
|
+
|
|
1471
|
+
**Not identified → the path that already exists** (the base exception, the flake record, a rerun,
|
|
1472
|
+
`blocked`), and whatever that path leaves red says, in the slot it already has — the stop's
|
|
1473
|
+
`I need:`, the `blocked` reason, the "what to do" of a line under `## Not verified — needs a human` —
|
|
1474
|
+
**what the person does next**, in one plain line: *rerun CI; if `<test>` fails again, its cause is
|
|
1475
|
+
not in this change — open a ticket for it*, never only that the test is red.
|
|
1476
|
+
|
|
1477
|
+
**A CI failure that does not reproduce here** (`green`, or a CI log a person pasted into a review
|
|
1478
|
+
thread for `respond`) is diagnosed the same way, from its log and the test's code: a fragility
|
|
1479
|
+
identified → fix it as above and push it, even though it would not go red locally. Neither
|
|
1480
|
+
reproduced nor identified → change nothing for it and say so. In `unattended` that run ends with
|
|
1481
|
+
its usual closing order when it changed code (`publish`: the push reruns CI anyway); when it changed
|
|
1482
|
+
nothing, it ends `blocked`, its one-line reason starting `rerun CI: <job>[, <job>…]` — not
|
|
1483
|
+
reproduced, no cause found — so the orchestrator knows a rerun is all that is left.
|
|
@@ -87,6 +87,9 @@ Template (in this order):
|
|
|
87
87
|
<bullets from the "What is NOT touched" section of the Brief. Important so the reviewer knows the fix is minimal.>
|
|
88
88
|
<then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — the neighbouring bug, the similar-risk pattern, the prevention action — with its ticket id when one exists. Omit the block when there are none.>
|
|
89
89
|
|
|
90
|
+
## Also fixed
|
|
91
|
+
<only when a test outside this fix went red and was repaired because its cause was identified (flow-core §11): one line each, `` `<test>` — <cause>; <what changed> ``. Omit the section otherwise.>
|
|
92
|
+
|
|
90
93
|
## Evidence
|
|
91
94
|
<only if `.claude/work/<TICKET>/evidence/` has files and `quality.evidence` is not `off`. The **before** is what `03-investigation.md` captured when the failure was reproduced — the one moment it exists — and the **after** is §2.5 of `05-validation.md`. A bug fix is the change where a before/after pair carries the most: it *is* the argument. Same upload rules as `/flow:feat:ship`. Omit when there is nothing.>
|
|
92
95
|
|
|
@@ -93,7 +93,7 @@ this is the same gate as a red test.
|
|
|
93
93
|
|
|
94
94
|
## 5. Close
|
|
95
95
|
|
|
96
|
-
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides:
|
|
96
|
+
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides — and before any test is excused there, its cause is looked for (flow-core §11): identified → a repair step, its own commit, never an exception or a flake record. Every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `/flow:bug:fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red and, for each, what a person does next. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
|
|
97
97
|
- Green → `phase = "validate"`, add to `phases_done`; in the same write record `validated_sha` = `git rev-parse HEAD` — the tree the regression test passed on, which `/flow:bug:ship §0` reads. Suggest `/flow:bug:review`.
|
|
98
98
|
- **Other bugs detected become `followups[]` entries** (flow-core §7) when they clear its bar — a reproducible symptom with someone who suffers it, not «this looks fragile» — per the output template.
|
|
99
99
|
- **Stage what the validation taught** (`knowledge.stage` set; silence by default): a mutation that stayed green, a disguise the scenario wore, a fixture that could not produce the case — findings about how this codebase is tested, not about this diff. Same rule and evidence line as the review's Close.
|
|
@@ -90,9 +90,12 @@ there → it is a question like any other.
|
|
|
90
90
|
Chained from a review's `high_findings` *Fix them* → the findings are unticked steps at the end of
|
|
91
91
|
this MR/PR's plan: build them in order, then chain into `/flow:feat:review`. Chained from a red
|
|
92
92
|
suite at validate (flow-core §2.1) → the same, under the plan's latest `### Red suite at validate
|
|
93
|
-
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code
|
|
94
|
-
assertion this MR/PR's design changed —
|
|
95
|
-
|
|
93
|
+
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code, by an
|
|
94
|
+
assertion this MR/PR's design changed, or — a step naming a fragile test's cause (flow-core §11) —
|
|
95
|
+
by making it assert on the result it meant to prove, in its own commit `Fix fragile test <name>:
|
|
96
|
+
<cause>`; never by deleting, skipping, retrying or loosening it, or by a longer timeout. Run each
|
|
97
|
+
step's test with `quality.test_one` before ticking it — and a §11 step with the whole suite plus its
|
|
98
|
+
forced reproduction, since an order- or load-dependent test already passes on its own.
|
|
96
99
|
|
|
97
100
|
**The brief travels inside the question** (flow-core §3): the user reads it in the prompt they are answering, never by opening `05-implementation.md`. Write the file, run whatever you need, and *then* open the gate — **nothing runs between the brief and the question**, because a tool call after it is what lets a terminal fold the brief into one collapsed line, and the gate is answered blind. Options:
|
|
98
101
|
- **Yes, proceed** → start building.
|
|
@@ -64,10 +64,14 @@ place it would ask:
|
|
|
64
64
|
|
|
65
65
|
**In every mode**, criteria `07-validation.md` marks `not-verified-unattended` go into the body under
|
|
66
66
|
`## Not verified — needs a human`, with what to do for each — and so do the tests the suite left red
|
|
67
|
-
because they also fail on the base (`unattended:validate-red-base`): each name,
|
|
68
|
-
where it failed too — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
69
|
-
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches `` — and the review findings an orchestrator's answer accepted unfixed
|
|
70
|
-
(`06-review.md` "Answered (unattended)"), one line each.
|
|
67
|
+
because they also fail on the base (`unattended:validate-red-base`): each name, the base sha
|
|
68
|
+
where it failed too, and what the person does next (flow-core §11) — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
69
|
+
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches; rerun CI, and if it fails again open a ticket for it `` — and the review findings an orchestrator's answer accepted unfixed
|
|
70
|
+
(`06-review.md` "Answered (unattended)"), one line each. A test outside the change that this
|
|
71
|
+
MR/PR repaired because its cause was identified (flow-core §11) — a repair step of a validate round,
|
|
72
|
+
or of `green`/`respond` — goes under `## Also fixed`, one line each:
|
|
73
|
+
`` `<test>` — <cause>; <what changed> ``, so the reviewer sees why a test this change did not need
|
|
74
|
+
was touched. The §3 preview shows that section like
|
|
71
75
|
any other, and the person reading it is the check the run could not do. Entries of
|
|
72
76
|
`auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
|
|
73
77
|
`mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
|
|
@@ -229,14 +229,17 @@ Write `.claude/work/<TICKET>/07-validation.md`:
|
|
|
229
229
|
failing tests on the base the way they went red on HEAD — the whole suite, three runs on each side
|
|
230
230
|
for a test that is red in the suite and green on its own — and write each name, its result there,
|
|
231
231
|
the run counts and the base sha under "Suite results" in `07-validation.md`. Calling a failure "pre-existing" without that run is not the
|
|
232
|
-
exception — it is a red suite.
|
|
232
|
+
exception — it is a red suite. **Before a test takes the exception or the flake record, its cause
|
|
233
|
+
is looked for** (flow-core §11, a red test outside the change): identified → it is not excused, it
|
|
234
|
+
becomes a step of the repair round below, named with its cause, fixed in its own commit and listed
|
|
235
|
+
under `## Also fixed` by `ship`. Tests red once in HEAD's three runs, never on the base, outside the
|
|
233
236
|
files this diff touches, green on their own and proving no criterion are suspect flakes: when every test red in HEAD's three runs is one,
|
|
234
237
|
five more whole-suite runs on HEAD decide — nothing red in them → `unattended:validate-flaky`, the
|
|
235
238
|
counts under "Suite results", and the phase advances. Short of it, the red suite gets a repair round (the same row):
|
|
236
239
|
the failing tests become unticked steps of this MR/PR's plan, `phase = build`, and the run
|
|
237
240
|
chains into `/flow:feat:build`, then review and this phase again. Rounds go on while each lowers
|
|
238
241
|
the red count, three at most; one that does not, or a third still red → `blocked`, naming the
|
|
239
|
-
tests still red.
|
|
242
|
+
tests still red and, for each, what a person does next.
|
|
240
243
|
|
|
241
244
|
In `guided`/`auto` this is, together with the brief in `/flow:feat:build §2`, **the only stop of the whole MR/PR** — everything between them ran without a person. It carries the **full stop header** and the body answers, in this order: what is green, what this MR/PR proves and what it does not, and what shipping it takes. Assume the user has read none of the build and review.
|
|
242
245
|
"""
|
|
@@ -39,7 +39,7 @@ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, mode
|
|
|
39
39
|
2. Creating/switching a branch, or DB schema changes/migrations, if a fix requires them.
|
|
40
40
|
3. **Re-triggering a pipeline or job on the remote** (CI resources; outward action).
|
|
41
41
|
4. **Integrating the base branch** — any `git merge`/`git rebase` of `git.default_base` into the branch, and any history rewrite or force-push it implies (§5.C).
|
|
42
|
-
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides.
|
|
42
|
+
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides. A fragile test rewritten to assert on the same result, as flow-core §11 allows, is not loosening it.
|
|
43
43
|
|
|
44
44
|
**In `unattended`** (flow-core §2.1) — launched by `/flow:work:run` on `why = pipeline` or
|
|
45
45
|
`why = conflict` — this command never touches the forge. Gate 5 holds exactly as written; the
|
|
@@ -53,8 +53,10 @@ others resolve this way:
|
|
|
53
53
|
conflicts with `base`, which the orchestrator left in the checkout as `origin/<base>` at
|
|
54
54
|
`base_sha`. That is the only blocker of the round — category C, nothing to triage. `origin/<base>`
|
|
55
55
|
missing or not at `base_sha` → `blocked`: the run would merge a base nobody named.
|
|
56
|
-
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) →
|
|
57
|
-
|
|
56
|
+
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → when the round
|
|
57
|
+
changed no code, `blocked` with the evidence and a one-line reason starting `rerun CI: <job>[,
|
|
58
|
+
<job>…]` (flow-core §11): the run has no rerun order, and the orchestrator owns reruns and the
|
|
59
|
+
red-round limit; when the round changed code, its `publish` reruns CI anyway.
|
|
58
60
|
**C** (conflict, behind base) on `why = pipeline`, and anything needing a rebase or force-push →
|
|
59
61
|
`blocked`: the orchestrator brings the base in, and relaunches with `why = conflict` when it
|
|
60
62
|
conflicts. A **human** blocker → `blocked`, naming who. **S** → fixed within
|
|
@@ -134,12 +136,14 @@ Categories:
|
|
|
134
136
|
| **L — lint / style / format** | formatter or linter job red | mechanical auto-fix with `quality.style_fix` (or the repo's formatter) |
|
|
135
137
|
| **T — test failure** | a unit/integration/functional/frontend test failed | **root-cause fix**: real regression → fix the code; behavior changed *on purpose* → update the test to the new contract (justified from the design) |
|
|
136
138
|
| **Y — type / build / compile** | type-check (`static_analysis`) or build broke | fix the code/types |
|
|
137
|
-
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
139
|
+
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) **whose cause in the test or the code was looked for and not identified** (flow-core §11) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
138
140
|
| **S — quality gate / scope** | coverage threshold, security scan, a lint rule newly hitting legacy code | judgment call: fix within scope, or defer/config with justification — never touch unrelated code just to appease a gate without confirming |
|
|
139
141
|
| **C — conflict / branch behind base** | the branch conflicts with `git.default_base`, or the host requires it updated before merging | integrate the base into the branch and **resolve each conflict on its merits** (§5.C) — hard gate before touching git history |
|
|
140
142
|
| **H — human blocker** | draft/WIP, approvals missing, unresolved review threads, a required reviewer or check that only a person can clear | **not this command's job**: name it, say exactly what is needed and from whom, and route it (threads → `/flow:work:respond`; draft → offer to mark ready; approvals → the reviewers). Never work around it |
|
|
141
143
|
|
|
142
|
-
**
|
|
144
|
+
**A test this diff did not touch is still this command's.** A red test that looks flaky is diagnosed before it is called K (flow-core §11): read its log tail and its code; a fragility identified there — it counts timer ticks, depends on order, reads another test's leftovers — or a cause in the code is **T**, fixed in this round even when it does not go red locally, in its own commit `Fix fragile test <name>: <cause>`, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Only a cause not identified stays K.
|
|
145
|
+
|
|
146
|
+
**Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks (a flow-core §11 rewrite onto the same result is not weakening), never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
|
|
143
147
|
|
|
144
148
|
Present a **triage table**: `blocker → kind → category → probable cause (log or merge verdict) → proposed action`, **C** and **H** rows first (a conflict makes the pipeline result provisional — CI reruns on a different tree after integrating the base). In `manual`, let the user re-categorize any row (especially T-vs-K) before proceeding.
|
|
145
149
|
|
|
@@ -162,9 +166,9 @@ Only **base-integration**, **auto-fix** and **code-fix**:
|
|
|
162
166
|
|
|
163
167
|
- **Design-invalidation first.** A test failure that shows the *design* was wrong → do not patch the test into agreement; update `03-design.md` **before** editing; if large, route back through `/flow:feat:build` / `/flow:bug:fix`.
|
|
164
168
|
- **Delegate the edits** to the expert sub-agents (FLOW.md `agents`); the conductor stays on judgment. Repo conventions plus the **comment discipline** of `/flow:feat:build` — comments only for a non-obvious *why*, never a ticket ID or "for MR #N".
|
|
165
|
-
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote.
|
|
169
|
+
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote. A fragile test fixed by flow-core §11 is checked with its forced reproduction when there is one, then pushed the same way.
|
|
166
170
|
- **Re-run the review gate for non-trivial code-fixes.** More than a mechanical tweak → `quality.review_skill` (or built-in `code-review` if empty) on this round's diff before pushing. Pass the diagnosis as context, never as a scope exclusion (*"the cause was X"*, not *"skip X"*). High-severity findings block the push until addressed.
|
|
167
|
-
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). The push is a hard gate in **every** mode.
|
|
171
|
+
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). A fragile-test repair (flow-core §11) is split into its own commit in every mode, and the round's summary names it as *also fixes fragile test `<name>`: <cause>*. The push is a hard gate in **every** mode.
|
|
168
172
|
|
|
169
173
|
### 5.C Integrate the base and resolve conflicts (category C)
|
|
170
174
|
|
|
@@ -97,7 +97,10 @@ back through it, and the hard gates above resolve this way:
|
|
|
97
97
|
- **The one closing order**, after the WIP commit (flow-core §2.1): code changed this round →
|
|
98
98
|
`publish` with the work's `publish-title.md` / `publish-body.md` (updated when the round changed
|
|
99
99
|
what they say, and naming any thread whose reply failed) and no `--part/--of` — the MR/PR is
|
|
100
|
-
already open (flow-core §2.1) — so the commits the replies name reach the branch
|
|
100
|
+
already open (flow-core §2.1) — so the commits the replies name reach the branch (and the push reruns CI, so a
|
|
101
|
+
failure nobody could explain needs nothing more); no code changed, every reply went out and a
|
|
102
|
+
thread carried a CI failure neither reproduced nor explained (§3) → `blocked`, its one-line reason
|
|
103
|
+
starting `rerun CI: <job>[, <job>…]` (flow-core §11); no code changed and every reply went
|
|
101
104
|
out → `done`, the summary listing the threads answered; no code changed and a reply failed →
|
|
102
105
|
`blocked`, naming those threads.
|
|
103
106
|
|
|
@@ -146,6 +149,8 @@ Categories:
|
|
|
146
149
|
| **F — obsolete/done** | Already addressed, or no longer applies | reply pointing to where |
|
|
147
150
|
| **G — data / performance objection** | The reviewer says a query is slow, unbounded, unindexed, or proposes a different query | **measure first** (§4.G), then reply with the plan |
|
|
148
151
|
|
|
152
|
+
**A thread that carries a CI failure** — a person pasted a failing job's log or a red test's output — is a **C** about that test, not an **A** to answer: reproduce it with `quality.test_one`; red → fix it on its merits, through flow-core §11 when the test is outside this diff. Not red here → diagnose it from the pasted log and the test's code (flow-core §11): a fragility identified (it counts timer ticks, depends on order, reads another test's leftovers) or a cause in the code → fix it in its own commit `Fix fragile test <name>: <cause>`, and the reply names that commit and the cause, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Neither → change nothing for it; the reply says it did not reproduce, that no cause was found in the test or the code, and what the person does next (*rerun CI; if it fails again, …*) — never a bare "not reproduced".
|
|
153
|
+
|
|
149
154
|
Present a **triage table** to the user: `thread → location → category → proposed action → one-line rationale` — the map for the rest of the command. In `manual` mode, let the user re-categorize any row before proceeding.
|
|
150
155
|
|
|
151
156
|
## 4. Agree the response per thread (the debate)
|
package/adapters/hermes/CORE.md
CHANGED
|
@@ -17,7 +17,7 @@ Every `/flow-*` command assumes these rules. They are stated once, here, so a co
|
|
|
17
17
|
carries what is specific to its phase. Read this once per session; a command that says "load
|
|
18
18
|
`flow-core`" means this file.
|
|
19
19
|
|
|
20
|
-
**This file belongs to flow `0.
|
|
20
|
+
**This file belongs to flow `0.107.0`.** Compare it once, at the start of the session, against
|
|
21
21
|
`version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
|
|
22
22
|
is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
|
|
23
23
|
— which is exactly what happens when a branch or a release candidate is loaded over an installed
|
|
@@ -449,7 +449,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
|
|
|
449
449
|
| Writing a DB schema change, index or migration — in any phase, a review's own fixes included — or applying one (`validate`) | question `migration`, before the first line of it is written or run — except in `respond` and `green`, where it is blocked: a schema change agreed after the MR/PR exists goes back through `build`. Writing one whose every object `approved-schema.md` lists is not asked (§2, a schema approved with the study) |
|
|
450
450
|
| `review` with blockers or high-severity findings | question `high_findings` |
|
|
451
451
|
| `validate` with a criterion `unproven` | blocked — the phase does not advance and does not chain |
|
|
452
|
-
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed — never delete, skip or loosen a test*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker. A round that did not lower the count, or a third round still red → blocked, naming the tests still red
|
|
452
|
+
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. **Before either record below, the cause is looked for** (§11, a red test outside the change): a test that would take the base exception or the flake record and whose cause §11 identifies is not excused — it goes to the repair rounds below, its step naming the cause, and counts in their `<n>`; only a test whose cause is not identified takes a record, and **a pass that sends any test to a repair round writes no record at all** — the others are measured again at the next validate, so the pass has one ending. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry — unless §11 finds the fragility in the test itself (it counts ticks the diff's extra load now delays): then the test is the step, fixed as §11 says. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed, or — for a test §11 found fragile — make it assert on the result it meant to prove; never delete, skip, retry or loosen a test, and never lengthen a timeout*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker; a fragile test rewritten to assert on the same result, as §11 allows, is not loosened. A round that did not lower the count, or a third round still red → blocked, naming the tests still red, the count each round left and, for each, what a person does next |
|
|
453
453
|
| A product decision (§7 `decision`) | question `decision` |
|
|
454
454
|
| Clarifying questions on the ticket (`start`) | question `clarify` — after the branch and the work folder exist, with the questions also written to `01-context.md` |
|
|
455
455
|
| An unanswered high-severity challenge (`design`, `investigate`) | question `design_challenge` / `investigation_challenge` |
|
|
@@ -1432,3 +1432,53 @@ before and after:
|
|
|
1432
1432
|
|
|
1433
1433
|
Bugs do not link: a bug repairs something already delivered, and the roadmap tracks what is still to
|
|
1434
1434
|
deliver. A bug that *is* a roadmap item is started as a feature.
|
|
1435
|
+
|
|
1436
|
+
## 11. A red test outside the change — find the cause before it is excused
|
|
1437
|
+
|
|
1438
|
+
A test this diff did not touch goes red, and every path flow has for it — the base exception and the
|
|
1439
|
+
flake record of `validate` (§2.1), a rerun in `green`, "not reproduced" in `respond` — hands it to a
|
|
1440
|
+
person. When flow can see why the test is red, handing it over is the wrong answer: the MR/PR has to
|
|
1441
|
+
go green to merge, so the fix is in scope whether or not the diff touched that test.
|
|
1442
|
+
|
|
1443
|
+
**Look for the cause first.** Read the test and the code it drives, and name the mechanism. Typical
|
|
1444
|
+
causes in the test: it asserts on **how many times** something ran (timer ticks, calls, retries)
|
|
1445
|
+
inside a wall-clock window instead of on what came out — when the count *is* the behaviour (retries, calls made), the count stays and the clock is what gets fixed (a fake or injected time source); it depends on the order tests run in; it
|
|
1446
|
+
reads state another test left behind (a shared fixture, a global, a file, a port); it sleeps and
|
|
1447
|
+
hopes. Typical causes in the code: a race, an await missing, a resource not released.
|
|
1448
|
+
|
|
1449
|
+
**Identified means evidence, not a story.** A cause is identified only when the diagnosis names it at
|
|
1450
|
+
`file:line` **and** either (a) a forced reproduction turns the test red on purpose — stall the timer,
|
|
1451
|
+
reorder the run, leave the shared state dirty, load the machine — or (b) the mechanism is in the
|
|
1452
|
+
assertion itself, plain to read (it counts ticks in a time window, it expects an order nobody
|
|
1453
|
+
guarantees). A plausible guess with neither is **not identified**, and is never acted on.
|
|
1454
|
+
|
|
1455
|
+
**Identified → a repair step in this MR/PR**, aimed where the cause is:
|
|
1456
|
+
|
|
1457
|
+
- **In the test** → the test is rewritten to prove the **same behaviour by its result**, not by its
|
|
1458
|
+
timing or its order. That is not loosening it: the assertion keeps its subject and gets a sturdier
|
|
1459
|
+
witness. Never delete, skip, retry or loosen it, and never lengthen a timeout or a sleep — each one
|
|
1460
|
+
hides the cause instead of removing it. Where (a) applied, the forced reproduction passes after the
|
|
1461
|
+
fix.
|
|
1462
|
+
- **In the code** → the step fixes the code; the test stays as it is.
|
|
1463
|
+
- **Proved by the whole suite**, never by `quality.test_one` alone — an order- or load-dependent test already passes on its own — plus the forced reproduction where (a) applied.
|
|
1464
|
+
- A fragile test in a file this diff touches is repaired the same way: it never had the exception to lose.
|
|
1465
|
+
- **Its own commit** — `Fix fragile test <name>: <cause in one line>` — never folded into another
|
|
1466
|
+
step's or round's commit, so a reviewer reads it alone.
|
|
1467
|
+
- **The MR/PR body says so**, under `## Also fixed`: `` `<test>` — <cause>; <what changed> `` —
|
|
1468
|
+
written by `ship` for a repair made before it (`/flow-feat-ship`, `/flow-bug-ship`); a repair made
|
|
1469
|
+
by `green` or `respond` on an MR/PR already open adds the line itself: to `publish-body.md` in
|
|
1470
|
+
`unattended`, otherwise to the MR/PR description with the push, shown at the push gate.
|
|
1471
|
+
|
|
1472
|
+
**Not identified → the path that already exists** (the base exception, the flake record, a rerun,
|
|
1473
|
+
`blocked`), and whatever that path leaves red says, in the slot it already has — the stop's
|
|
1474
|
+
`I need:`, the `blocked` reason, the "what to do" of a line under `## Not verified — needs a human` —
|
|
1475
|
+
**what the person does next**, in one plain line: *rerun CI; if `<test>` fails again, its cause is
|
|
1476
|
+
not in this change — open a ticket for it*, never only that the test is red.
|
|
1477
|
+
|
|
1478
|
+
**A CI failure that does not reproduce here** (`green`, or a CI log a person pasted into a review
|
|
1479
|
+
thread for `respond`) is diagnosed the same way, from its log and the test's code: a fragility
|
|
1480
|
+
identified → fix it as above and push it, even though it would not go red locally. Neither
|
|
1481
|
+
reproduced nor identified → change nothing for it and say so. In `unattended` that run ends with
|
|
1482
|
+
its usual closing order when it changed code (`publish`: the push reruns CI anyway); when it changed
|
|
1483
|
+
nothing, it ends `blocked`, its one-line reason starting `rerun CI: <job>[, <job>…]` — not
|
|
1484
|
+
reproduced, no cause found — so the orchestrator knows a rerun is all that is left.
|
|
@@ -91,6 +91,9 @@ Template (in this order):
|
|
|
91
91
|
<bullets from the "What is NOT touched" section of the Brief. Important so the reviewer knows the fix is minimal.>
|
|
92
92
|
<then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — the neighbouring bug, the similar-risk pattern, the prevention action — with its ticket id when one exists. Omit the block when there are none.>
|
|
93
93
|
|
|
94
|
+
## Also fixed
|
|
95
|
+
<only when a test outside this fix went red and was repaired because its cause was identified (flow-core §11): one line each, `` `<test>` — <cause>; <what changed> ``. Omit the section otherwise.>
|
|
96
|
+
|
|
94
97
|
## Evidence
|
|
95
98
|
<only if `.claude/work/<TICKET>/evidence/` has files and `quality.evidence` is not `off`. The **before** is what `03-investigation.md` captured when the failure was reproduced — the one moment it exists — and the **after** is §2.5 of `05-validation.md`. A bug fix is the change where a before/after pair carries the most: it *is* the argument. Same upload rules as `/flow-feat-ship`. Omit when there is nothing.>
|
|
96
99
|
|
|
@@ -97,7 +97,7 @@ this is the same gate as a red test.
|
|
|
97
97
|
|
|
98
98
|
## 5. Close
|
|
99
99
|
|
|
100
|
-
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides:
|
|
100
|
+
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides — and before any test is excused there, its cause is looked for (flow-core §11): identified → a repair step, its own commit, never an exception or a flake record. Every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `/flow-bug-fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red and, for each, what a person does next. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
|
|
101
101
|
- Green → `phase = "validate"`, add to `phases_done`; in the same write record `validated_sha` = `git rev-parse HEAD` — the tree the regression test passed on, which `/flow-bug-ship §0` reads. Suggest `/flow-bug-review`.
|
|
102
102
|
- **Other bugs detected become `followups[]` entries** (flow-core §7) when they clear its bar — a reproducible symptom with someone who suffers it, not «this looks fragile» — per the output template.
|
|
103
103
|
- **Stage what the validation taught** (`knowledge.stage` set; silence by default): a mutation that stayed green, a disguise the scenario wore, a fixture that could not produce the case — findings about how this codebase is tested, not about this diff. Same rule and evidence line as the review's Close.
|
|
@@ -94,9 +94,12 @@ there → it is a question like any other.
|
|
|
94
94
|
Chained from a review's `high_findings` *Fix them* → the findings are unticked steps at the end of
|
|
95
95
|
this MR/PR's plan: build them in order, then chain into `/flow-feat-review`. Chained from a red
|
|
96
96
|
suite at validate (flow-core §2.1) → the same, under the plan's latest `### Red suite at validate
|
|
97
|
-
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code
|
|
98
|
-
assertion this MR/PR's design changed —
|
|
99
|
-
|
|
97
|
+
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code, by an
|
|
98
|
+
assertion this MR/PR's design changed, or — a step naming a fragile test's cause (flow-core §11) —
|
|
99
|
+
by making it assert on the result it meant to prove, in its own commit `Fix fragile test <name>:
|
|
100
|
+
<cause>`; never by deleting, skipping, retrying or loosening it, or by a longer timeout. Run each
|
|
101
|
+
step's test with `quality.test_one` before ticking it — and a §11 step with the whole suite plus its
|
|
102
|
+
forced reproduction, since an order- or load-dependent test already passes on its own.
|
|
100
103
|
|
|
101
104
|
**The brief travels inside the question** (flow-core §3): the user reads it in the prompt they are answering, never by opening `05-implementation.md`. Write the file, run whatever you need, and *then* open the gate — **nothing runs between the brief and the question**, because a tool call after it is what lets a terminal fold the brief into one collapsed line, and the gate is answered blind. Options:
|
|
102
105
|
- **Yes, proceed** → start building.
|
|
@@ -68,10 +68,14 @@ place it would ask:
|
|
|
68
68
|
|
|
69
69
|
**In every mode**, criteria `07-validation.md` marks `not-verified-unattended` go into the body under
|
|
70
70
|
`## Not verified — needs a human`, with what to do for each — and so do the tests the suite left red
|
|
71
|
-
because they also fail on the base (`unattended:validate-red-base`): each name,
|
|
72
|
-
where it failed too — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
73
|
-
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches `` — and the review findings an orchestrator's answer accepted unfixed
|
|
74
|
-
(`06-review.md` "Answered (unattended)"), one line each.
|
|
71
|
+
because they also fail on the base (`unattended:validate-red-base`): each name, the base sha
|
|
72
|
+
where it failed too, and what the person does next (flow-core §11) — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
73
|
+
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches; rerun CI, and if it fails again open a ticket for it `` — and the review findings an orchestrator's answer accepted unfixed
|
|
74
|
+
(`06-review.md` "Answered (unattended)"), one line each. A test outside the change that this
|
|
75
|
+
MR/PR repaired because its cause was identified (flow-core §11) — a repair step of a validate round,
|
|
76
|
+
or of `green`/`respond` — goes under `## Also fixed`, one line each:
|
|
77
|
+
`` `<test>` — <cause>; <what changed> ``, so the reviewer sees why a test this change did not need
|
|
78
|
+
was touched. The §3 preview shows that section like
|
|
75
79
|
any other, and the person reading it is the check the run could not do. Entries of
|
|
76
80
|
`auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
|
|
77
81
|
`mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
|
|
@@ -233,13 +233,16 @@ Write `.claude/work/<TICKET>/07-validation.md`:
|
|
|
233
233
|
failing tests on the base the way they went red on HEAD — the whole suite, three runs on each side
|
|
234
234
|
for a test that is red in the suite and green on its own — and write each name, its result there,
|
|
235
235
|
the run counts and the base sha under "Suite results" in `07-validation.md`. Calling a failure "pre-existing" without that run is not the
|
|
236
|
-
exception — it is a red suite.
|
|
236
|
+
exception — it is a red suite. **Before a test takes the exception or the flake record, its cause
|
|
237
|
+
is looked for** (flow-core §11, a red test outside the change): identified → it is not excused, it
|
|
238
|
+
becomes a step of the repair round below, named with its cause, fixed in its own commit and listed
|
|
239
|
+
under `## Also fixed` by `ship`. Tests red once in HEAD's three runs, never on the base, outside the
|
|
237
240
|
files this diff touches, green on their own and proving no criterion are suspect flakes: when every test red in HEAD's three runs is one,
|
|
238
241
|
five more whole-suite runs on HEAD decide — nothing red in them → `unattended:validate-flaky`, the
|
|
239
242
|
counts under "Suite results", and the phase advances. Short of it, the red suite gets a repair round (the same row):
|
|
240
243
|
the failing tests become unticked steps of this MR/PR's plan, `phase = build`, and the run
|
|
241
244
|
chains into `/flow-feat-build`, then review and this phase again. Rounds go on while each lowers
|
|
242
245
|
the red count, three at most; one that does not, or a third still red → `blocked`, naming the
|
|
243
|
-
tests still red.
|
|
246
|
+
tests still red and, for each, what a person does next.
|
|
244
247
|
|
|
245
248
|
In `guided`/`auto` this is, together with the brief in `/flow-feat-build §2`, **the only stop of the whole MR/PR** — everything between them ran without a person. It carries the **full stop header** and the body answers, in this order: what is green, what this MR/PR proves and what it does not, and what shipping it takes. Assume the user has read none of the build and review.
|
|
@@ -43,7 +43,7 @@ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, mode
|
|
|
43
43
|
2. Creating/switching a branch, or DB schema changes/migrations, if a fix requires them.
|
|
44
44
|
3. **Re-triggering a pipeline or job on the remote** (CI resources; outward action).
|
|
45
45
|
4. **Integrating the base branch** — any `git merge`/`git rebase` of `git.default_base` into the branch, and any history rewrite or force-push it implies (§5.C).
|
|
46
|
-
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides.
|
|
46
|
+
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides. A fragile test rewritten to assert on the same result, as flow-core §11 allows, is not loosening it.
|
|
47
47
|
|
|
48
48
|
**In `unattended`** (flow-core §2.1) — launched by `/flow-work-run` on `why = pipeline` or
|
|
49
49
|
`why = conflict` — this command never touches the forge. Gate 5 holds exactly as written; the
|
|
@@ -57,8 +57,10 @@ others resolve this way:
|
|
|
57
57
|
conflicts with `base`, which the orchestrator left in the checkout as `origin/<base>` at
|
|
58
58
|
`base_sha`. That is the only blocker of the round — category C, nothing to triage. `origin/<base>`
|
|
59
59
|
missing or not at `base_sha` → `blocked`: the run would merge a base nobody named.
|
|
60
|
-
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) →
|
|
61
|
-
|
|
60
|
+
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → when the round
|
|
61
|
+
changed no code, `blocked` with the evidence and a one-line reason starting `rerun CI: <job>[,
|
|
62
|
+
<job>…]` (flow-core §11): the run has no rerun order, and the orchestrator owns reruns and the
|
|
63
|
+
red-round limit; when the round changed code, its `publish` reruns CI anyway.
|
|
62
64
|
**C** (conflict, behind base) on `why = pipeline`, and anything needing a rebase or force-push →
|
|
63
65
|
`blocked`: the orchestrator brings the base in, and relaunches with `why = conflict` when it
|
|
64
66
|
conflicts. A **human** blocker → `blocked`, naming who. **S** → fixed within
|
|
@@ -138,12 +140,14 @@ Categories:
|
|
|
138
140
|
| **L — lint / style / format** | formatter or linter job red | mechanical auto-fix with `quality.style_fix` (or the repo's formatter) |
|
|
139
141
|
| **T — test failure** | a unit/integration/functional/frontend test failed | **root-cause fix**: real regression → fix the code; behavior changed *on purpose* → update the test to the new contract (justified from the design) |
|
|
140
142
|
| **Y — type / build / compile** | type-check (`static_analysis`) or build broke | fix the code/types |
|
|
141
|
-
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
143
|
+
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) **whose cause in the test or the code was looked for and not identified** (flow-core §11) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
142
144
|
| **S — quality gate / scope** | coverage threshold, security scan, a lint rule newly hitting legacy code | judgment call: fix within scope, or defer/config with justification — never touch unrelated code just to appease a gate without confirming |
|
|
143
145
|
| **C — conflict / branch behind base** | the branch conflicts with `git.default_base`, or the host requires it updated before merging | integrate the base into the branch and **resolve each conflict on its merits** (§5.C) — hard gate before touching git history |
|
|
144
146
|
| **H — human blocker** | draft/WIP, approvals missing, unresolved review threads, a required reviewer or check that only a person can clear | **not this command's job**: name it, say exactly what is needed and from whom, and route it (threads → `/flow-work-respond`; draft → offer to mark ready; approvals → the reviewers). Never work around it |
|
|
145
147
|
|
|
146
|
-
**
|
|
148
|
+
**A test this diff did not touch is still this command's.** A red test that looks flaky is diagnosed before it is called K (flow-core §11): read its log tail and its code; a fragility identified there — it counts timer ticks, depends on order, reads another test's leftovers — or a cause in the code is **T**, fixed in this round even when it does not go red locally, in its own commit `Fix fragile test <name>: <cause>`, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Only a cause not identified stays K.
|
|
149
|
+
|
|
150
|
+
**Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks (a flow-core §11 rewrite onto the same result is not weakening), never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
|
|
147
151
|
|
|
148
152
|
Present a **triage table**: `blocker → kind → category → probable cause (log or merge verdict) → proposed action`, **C** and **H** rows first (a conflict makes the pipeline result provisional — CI reruns on a different tree after integrating the base). In `manual`, let the user re-categorize any row (especially T-vs-K) before proceeding.
|
|
149
153
|
|
|
@@ -166,9 +170,9 @@ Only **base-integration**, **auto-fix** and **code-fix**:
|
|
|
166
170
|
|
|
167
171
|
- **Design-invalidation first.** A test failure that shows the *design* was wrong → do not patch the test into agreement; update `03-design.md` **before** editing; if large, route back through `/flow-feat-build` / `/flow-bug-fix`.
|
|
168
172
|
- **Delegate the edits** to the expert sub-agents (FLOW.md `agents`); the conductor stays on judgment. Repo conventions plus the **comment discipline** of `/flow-feat-build` — comments only for a non-obvious *why*, never a ticket ID or "for MR #N".
|
|
169
|
-
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote.
|
|
173
|
+
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote. A fragile test fixed by flow-core §11 is checked with its forced reproduction when there is one, then pushed the same way.
|
|
170
174
|
- **Re-run the review gate for non-trivial code-fixes.** More than a mechanical tweak → `quality.review_skill` (or built-in `code-review` if empty) on this round's diff before pushing. Pass the diagnosis as context, never as a scope exclusion (*"the cause was X"*, not *"skip X"*). High-severity findings block the push until addressed.
|
|
171
|
-
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). The push is a hard gate in **every** mode.
|
|
175
|
+
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). A fragile-test repair (flow-core §11) is split into its own commit in every mode, and the round's summary names it as *also fixes fragile test `<name>`: <cause>*. The push is a hard gate in **every** mode.
|
|
172
176
|
|
|
173
177
|
### 5.C Integrate the base and resolve conflicts (category C)
|
|
174
178
|
|
|
@@ -101,7 +101,10 @@ back through it, and the hard gates above resolve this way:
|
|
|
101
101
|
- **The one closing order**, after the WIP commit (flow-core §2.1): code changed this round →
|
|
102
102
|
`publish` with the work's `publish-title.md` / `publish-body.md` (updated when the round changed
|
|
103
103
|
what they say, and naming any thread whose reply failed) and no `--part/--of` — the MR/PR is
|
|
104
|
-
already open (flow-core §2.1) — so the commits the replies name reach the branch
|
|
104
|
+
already open (flow-core §2.1) — so the commits the replies name reach the branch (and the push reruns CI, so a
|
|
105
|
+
failure nobody could explain needs nothing more); no code changed, every reply went out and a
|
|
106
|
+
thread carried a CI failure neither reproduced nor explained (§3) → `blocked`, its one-line reason
|
|
107
|
+
starting `rerun CI: <job>[, <job>…]` (flow-core §11); no code changed and every reply went
|
|
105
108
|
out → `done`, the summary listing the threads answered; no code changed and a reply failed →
|
|
106
109
|
`blocked`, naming those threads.
|
|
107
110
|
|
|
@@ -150,6 +153,8 @@ Categories:
|
|
|
150
153
|
| **F — obsolete/done** | Already addressed, or no longer applies | reply pointing to where |
|
|
151
154
|
| **G — data / performance objection** | The reviewer says a query is slow, unbounded, unindexed, or proposes a different query | **measure first** (§4.G), then reply with the plan |
|
|
152
155
|
|
|
156
|
+
**A thread that carries a CI failure** — a person pasted a failing job's log or a red test's output — is a **C** about that test, not an **A** to answer: reproduce it with `quality.test_one`; red → fix it on its merits, through flow-core §11 when the test is outside this diff. Not red here → diagnose it from the pasted log and the test's code (flow-core §11): a fragility identified (it counts timer ticks, depends on order, reads another test's leftovers) or a cause in the code → fix it in its own commit `Fix fragile test <name>: <cause>`, and the reply names that commit and the cause, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Neither → change nothing for it; the reply says it did not reproduce, that no cause was found in the test or the code, and what the person does next (*rerun CI; if it fails again, …*) — never a bare "not reproduced".
|
|
157
|
+
|
|
153
158
|
Present a **triage table** to the user: `thread → location → category → proposed action → one-line rationale` — the map for the rest of the command. In `manual` mode, let the user re-categorize any row before proceeding.
|
|
154
159
|
|
|
155
160
|
## 4. Agree the response per thread (the debate)
|
|
@@ -16,7 +16,7 @@ Every `/flow-*` command assumes these rules. They are stated once, here, so a co
|
|
|
16
16
|
carries what is specific to its phase. Read this once per session; a command that says "load
|
|
17
17
|
`flow-core`" means this file.
|
|
18
18
|
|
|
19
|
-
**This file belongs to flow `0.
|
|
19
|
+
**This file belongs to flow `0.107.0`.** Compare it once, at the start of the session, against
|
|
20
20
|
`version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
|
|
21
21
|
is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
|
|
22
22
|
— which is exactly what happens when a branch or a release candidate is loaded over an installed
|
|
@@ -448,7 +448,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
|
|
|
448
448
|
| Writing a DB schema change, index or migration — in any phase, a review's own fixes included — or applying one (`validate`) | question `migration`, before the first line of it is written or run — except in `respond` and `green`, where it is blocked: a schema change agreed after the MR/PR exists goes back through `build`. Writing one whose every object `approved-schema.md` lists is not asked (§2, a schema approved with the study) |
|
|
449
449
|
| `review` with blockers or high-severity findings | question `high_findings` |
|
|
450
450
|
| `validate` with a criterion `unproven` | blocked — the phase does not advance and does not chain |
|
|
451
|
-
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed — never delete, skip or loosen a test*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker. A round that did not lower the count, or a third round still red → blocked, naming the tests still red
|
|
451
|
+
| `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. **Before either record below, the cause is looked for** (§11, a red test outside the change): a test that would take the base exception or the flake record and whose cause §11 identifies is not excused — it goes to the repair rounds below, its step naming the cause, and counts in their `<n>`; only a test whose cause is not identified takes a record, and **a pass that sends any test to a repair round writes no record at all** — the others are measured again at the next validate, so the pass has one ending. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry — unless §11 finds the fragility in the test itself (it counts ticks the diff's extra load now delays): then the test is the step, fixed as §11 says. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed, or — for a test §11 found fragile — make it assert on the result it meant to prove; never delete, skip, retry or loosen a test, and never lengthen a timeout*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker; a fragile test rewritten to assert on the same result, as §11 allows, is not loosened. A round that did not lower the count, or a third round still red → blocked, naming the tests still red, the count each round left and, for each, what a person does next |
|
|
452
452
|
| A product decision (§7 `decision`) | question `decision` |
|
|
453
453
|
| Clarifying questions on the ticket (`start`) | question `clarify` — after the branch and the work folder exist, with the questions also written to `01-context.md` |
|
|
454
454
|
| An unanswered high-severity challenge (`design`, `investigate`) | question `design_challenge` / `investigation_challenge` |
|
|
@@ -1431,3 +1431,53 @@ before and after:
|
|
|
1431
1431
|
|
|
1432
1432
|
Bugs do not link: a bug repairs something already delivered, and the roadmap tracks what is still to
|
|
1433
1433
|
deliver. A bug that *is* a roadmap item is started as a feature.
|
|
1434
|
+
|
|
1435
|
+
## 11. A red test outside the change — find the cause before it is excused
|
|
1436
|
+
|
|
1437
|
+
A test this diff did not touch goes red, and every path flow has for it — the base exception and the
|
|
1438
|
+
flake record of `validate` (§2.1), a rerun in `green`, "not reproduced" in `respond` — hands it to a
|
|
1439
|
+
person. When flow can see why the test is red, handing it over is the wrong answer: the MR/PR has to
|
|
1440
|
+
go green to merge, so the fix is in scope whether or not the diff touched that test.
|
|
1441
|
+
|
|
1442
|
+
**Look for the cause first.** Read the test and the code it drives, and name the mechanism. Typical
|
|
1443
|
+
causes in the test: it asserts on **how many times** something ran (timer ticks, calls, retries)
|
|
1444
|
+
inside a wall-clock window instead of on what came out — when the count *is* the behaviour (retries, calls made), the count stays and the clock is what gets fixed (a fake or injected time source); it depends on the order tests run in; it
|
|
1445
|
+
reads state another test left behind (a shared fixture, a global, a file, a port); it sleeps and
|
|
1446
|
+
hopes. Typical causes in the code: a race, an await missing, a resource not released.
|
|
1447
|
+
|
|
1448
|
+
**Identified means evidence, not a story.** A cause is identified only when the diagnosis names it at
|
|
1449
|
+
`file:line` **and** either (a) a forced reproduction turns the test red on purpose — stall the timer,
|
|
1450
|
+
reorder the run, leave the shared state dirty, load the machine — or (b) the mechanism is in the
|
|
1451
|
+
assertion itself, plain to read (it counts ticks in a time window, it expects an order nobody
|
|
1452
|
+
guarantees). A plausible guess with neither is **not identified**, and is never acted on.
|
|
1453
|
+
|
|
1454
|
+
**Identified → a repair step in this MR/PR**, aimed where the cause is:
|
|
1455
|
+
|
|
1456
|
+
- **In the test** → the test is rewritten to prove the **same behaviour by its result**, not by its
|
|
1457
|
+
timing or its order. That is not loosening it: the assertion keeps its subject and gets a sturdier
|
|
1458
|
+
witness. Never delete, skip, retry or loosen it, and never lengthen a timeout or a sleep — each one
|
|
1459
|
+
hides the cause instead of removing it. Where (a) applied, the forced reproduction passes after the
|
|
1460
|
+
fix.
|
|
1461
|
+
- **In the code** → the step fixes the code; the test stays as it is.
|
|
1462
|
+
- **Proved by the whole suite**, never by `quality.test_one` alone — an order- or load-dependent test already passes on its own — plus the forced reproduction where (a) applied.
|
|
1463
|
+
- A fragile test in a file this diff touches is repaired the same way: it never had the exception to lose.
|
|
1464
|
+
- **Its own commit** — `Fix fragile test <name>: <cause in one line>` — never folded into another
|
|
1465
|
+
step's or round's commit, so a reviewer reads it alone.
|
|
1466
|
+
- **The MR/PR body says so**, under `## Also fixed`: `` `<test>` — <cause>; <what changed> `` —
|
|
1467
|
+
written by `ship` for a repair made before it (`/flow-feat-ship`, `/flow-bug-ship`); a repair made
|
|
1468
|
+
by `green` or `respond` on an MR/PR already open adds the line itself: to `publish-body.md` in
|
|
1469
|
+
`unattended`, otherwise to the MR/PR description with the push, shown at the push gate.
|
|
1470
|
+
|
|
1471
|
+
**Not identified → the path that already exists** (the base exception, the flake record, a rerun,
|
|
1472
|
+
`blocked`), and whatever that path leaves red says, in the slot it already has — the stop's
|
|
1473
|
+
`I need:`, the `blocked` reason, the "what to do" of a line under `## Not verified — needs a human` —
|
|
1474
|
+
**what the person does next**, in one plain line: *rerun CI; if `<test>` fails again, its cause is
|
|
1475
|
+
not in this change — open a ticket for it*, never only that the test is red.
|
|
1476
|
+
|
|
1477
|
+
**A CI failure that does not reproduce here** (`green`, or a CI log a person pasted into a review
|
|
1478
|
+
thread for `respond`) is diagnosed the same way, from its log and the test's code: a fragility
|
|
1479
|
+
identified → fix it as above and push it, even though it would not go red locally. Neither
|
|
1480
|
+
reproduced nor identified → change nothing for it and say so. In `unattended` that run ends with
|
|
1481
|
+
its usual closing order when it changed code (`publish`: the push reruns CI anyway); when it changed
|
|
1482
|
+
nothing, it ends `blocked`, its one-line reason starting `rerun CI: <job>[, <job>…]` — not
|
|
1483
|
+
reproduced, no cause found — so the orchestrator knows a rerun is all that is left.
|
|
@@ -89,6 +89,9 @@ Template (in this order):
|
|
|
89
89
|
<bullets from the "What is NOT touched" section of the Brief. Important so the reviewer knows the fix is minimal.>
|
|
90
90
|
<then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — the neighbouring bug, the similar-risk pattern, the prevention action — with its ticket id when one exists. Omit the block when there are none.>
|
|
91
91
|
|
|
92
|
+
## Also fixed
|
|
93
|
+
<only when a test outside this fix went red and was repaired because its cause was identified (flow-core §11): one line each, `` `<test>` — <cause>; <what changed> ``. Omit the section otherwise.>
|
|
94
|
+
|
|
92
95
|
## Evidence
|
|
93
96
|
<only if `.claude/work/<TICKET>/evidence/` has files and `quality.evidence` is not `off`. The **before** is what `03-investigation.md` captured when the failure was reproduced — the one moment it exists — and the **after** is §2.5 of `05-validation.md`. A bug fix is the change where a before/after pair carries the most: it *is* the argument. Same upload rules as `/flow-feat-ship`. Omit when there is nothing.>
|
|
94
97
|
|
|
@@ -95,7 +95,7 @@ this is the same gate as a red test.
|
|
|
95
95
|
|
|
96
96
|
## 5. Close
|
|
97
97
|
|
|
98
|
-
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides:
|
|
98
|
+
- Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides — and before any test is excused there, its cause is looked for (flow-core §11): identified → a repair step, its own commit, never an exception or a flake record. Every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `/flow-bug-fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red and, for each, what a person does next. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
|
|
99
99
|
- Green → `phase = "validate"`, add to `phases_done`; in the same write record `validated_sha` = `git rev-parse HEAD` — the tree the regression test passed on, which `/flow-bug-ship §0` reads. Suggest `/flow-bug-review`.
|
|
100
100
|
- **Other bugs detected become `followups[]` entries** (flow-core §7) when they clear its bar — a reproducible symptom with someone who suffers it, not «this looks fragile» — per the output template.
|
|
101
101
|
- **Stage what the validation taught** (`knowledge.stage` set; silence by default): a mutation that stayed green, a disguise the scenario wore, a fixture that could not produce the case — findings about how this codebase is tested, not about this diff. Same rule and evidence line as the review's Close.
|
|
@@ -92,9 +92,12 @@ there → it is a question like any other.
|
|
|
92
92
|
Chained from a review's `high_findings` *Fix them* → the findings are unticked steps at the end of
|
|
93
93
|
this MR/PR's plan: build them in order, then chain into `/flow-feat-review`. Chained from a red
|
|
94
94
|
suite at validate (flow-core §2.1) → the same, under the plan's latest `### Red suite at validate
|
|
95
|
-
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code
|
|
96
|
-
assertion this MR/PR's design changed —
|
|
97
|
-
|
|
95
|
+
(unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code, by an
|
|
96
|
+
assertion this MR/PR's design changed, or — a step naming a fragile test's cause (flow-core §11) —
|
|
97
|
+
by making it assert on the result it meant to prove, in its own commit `Fix fragile test <name>:
|
|
98
|
+
<cause>`; never by deleting, skipping, retrying or loosening it, or by a longer timeout. Run each
|
|
99
|
+
step's test with `quality.test_one` before ticking it — and a §11 step with the whole suite plus its
|
|
100
|
+
forced reproduction, since an order- or load-dependent test already passes on its own.
|
|
98
101
|
|
|
99
102
|
**The brief travels inside the question** (flow-core §3): the user reads it in the prompt they are answering, never by opening `05-implementation.md`. Write the file, run whatever you need, and *then* open the gate — **nothing runs between the brief and the question**, because a tool call after it is what lets a terminal fold the brief into one collapsed line, and the gate is answered blind. Options:
|
|
100
103
|
- **Yes, proceed** → start building.
|
|
@@ -66,10 +66,14 @@ place it would ask:
|
|
|
66
66
|
|
|
67
67
|
**In every mode**, criteria `07-validation.md` marks `not-verified-unattended` go into the body under
|
|
68
68
|
`## Not verified — needs a human`, with what to do for each — and so do the tests the suite left red
|
|
69
|
-
because they also fail on the base (`unattended:validate-red-base`): each name,
|
|
70
|
-
where it failed too — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
71
|
-
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches `` — and the review findings an orchestrator's answer accepted unfixed
|
|
72
|
-
(`06-review.md` "Answered (unattended)"), one line each.
|
|
69
|
+
because they also fail on the base (`unattended:validate-red-base`): each name, the base sha
|
|
70
|
+
where it failed too, and what the person does next (flow-core §11) — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
|
|
71
|
+
`` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches; rerun CI, and if it fails again open a ticket for it `` — and the review findings an orchestrator's answer accepted unfixed
|
|
72
|
+
(`06-review.md` "Answered (unattended)"), one line each. A test outside the change that this
|
|
73
|
+
MR/PR repaired because its cause was identified (flow-core §11) — a repair step of a validate round,
|
|
74
|
+
or of `green`/`respond` — goes under `## Also fixed`, one line each:
|
|
75
|
+
`` `<test>` — <cause>; <what changed> ``, so the reviewer sees why a test this change did not need
|
|
76
|
+
was touched. The §3 preview shows that section like
|
|
73
77
|
any other, and the person reading it is the check the run could not do. Entries of
|
|
74
78
|
`auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
|
|
75
79
|
`mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
|
|
@@ -231,13 +231,16 @@ Write `.claude/work/<TICKET>/07-validation.md`:
|
|
|
231
231
|
failing tests on the base the way they went red on HEAD — the whole suite, three runs on each side
|
|
232
232
|
for a test that is red in the suite and green on its own — and write each name, its result there,
|
|
233
233
|
the run counts and the base sha under "Suite results" in `07-validation.md`. Calling a failure "pre-existing" without that run is not the
|
|
234
|
-
exception — it is a red suite.
|
|
234
|
+
exception — it is a red suite. **Before a test takes the exception or the flake record, its cause
|
|
235
|
+
is looked for** (flow-core §11, a red test outside the change): identified → it is not excused, it
|
|
236
|
+
becomes a step of the repair round below, named with its cause, fixed in its own commit and listed
|
|
237
|
+
under `## Also fixed` by `ship`. Tests red once in HEAD's three runs, never on the base, outside the
|
|
235
238
|
files this diff touches, green on their own and proving no criterion are suspect flakes: when every test red in HEAD's three runs is one,
|
|
236
239
|
five more whole-suite runs on HEAD decide — nothing red in them → `unattended:validate-flaky`, the
|
|
237
240
|
counts under "Suite results", and the phase advances. Short of it, the red suite gets a repair round (the same row):
|
|
238
241
|
the failing tests become unticked steps of this MR/PR's plan, `phase = build`, and the run
|
|
239
242
|
chains into `/flow-feat-build`, then review and this phase again. Rounds go on while each lowers
|
|
240
243
|
the red count, three at most; one that does not, or a third still red → `blocked`, naming the
|
|
241
|
-
tests still red.
|
|
244
|
+
tests still red and, for each, what a person does next.
|
|
242
245
|
|
|
243
246
|
In `guided`/`auto` this is, together with the brief in `/flow-feat-build §2`, **the only stop of the whole MR/PR** — everything between them ran without a person. It carries the **full stop header** and the body answers, in this order: what is green, what this MR/PR proves and what it does not, and what shipping it takes. Assume the user has read none of the build and review.
|
|
@@ -41,7 +41,7 @@ Read `~/.claude/flow/CORE.opencode.md` first (shared rules: `FLOW.md` step 0, mo
|
|
|
41
41
|
2. Creating/switching a branch, or DB schema changes/migrations, if a fix requires them.
|
|
42
42
|
3. **Re-triggering a pipeline or job on the remote** (CI resources; outward action).
|
|
43
43
|
4. **Integrating the base branch** — any `git merge`/`git rebase` of `git.default_base` into the branch, and any history rewrite or force-push it implies (§5.C).
|
|
44
|
-
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides.
|
|
44
|
+
5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides. A fragile test rewritten to assert on the same result, as flow-core §11 allows, is not loosening it.
|
|
45
45
|
|
|
46
46
|
**In `unattended`** (flow-core §2.1) — launched by `/flow-work-run` on `why = pipeline` or
|
|
47
47
|
`why = conflict` — this command never touches the forge. Gate 5 holds exactly as written; the
|
|
@@ -55,8 +55,10 @@ others resolve this way:
|
|
|
55
55
|
conflicts with `base`, which the orchestrator left in the checkout as `origin/<base>` at
|
|
56
56
|
`base_sha`. That is the only blocker of the round — category C, nothing to triage. `origin/<base>`
|
|
57
57
|
missing or not at `base_sha` → `blocked`: the run would merge a base nobody named.
|
|
58
|
-
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) →
|
|
59
|
-
|
|
58
|
+
- **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → when the round
|
|
59
|
+
changed no code, `blocked` with the evidence and a one-line reason starting `rerun CI: <job>[,
|
|
60
|
+
<job>…]` (flow-core §11): the run has no rerun order, and the orchestrator owns reruns and the
|
|
61
|
+
red-round limit; when the round changed code, its `publish` reruns CI anyway.
|
|
60
62
|
**C** (conflict, behind base) on `why = pipeline`, and anything needing a rebase or force-push →
|
|
61
63
|
`blocked`: the orchestrator brings the base in, and relaunches with `why = conflict` when it
|
|
62
64
|
conflicts. A **human** blocker → `blocked`, naming who. **S** → fixed within
|
|
@@ -136,12 +138,14 @@ Categories:
|
|
|
136
138
|
| **L — lint / style / format** | formatter or linter job red | mechanical auto-fix with `quality.style_fix` (or the repo's formatter) |
|
|
137
139
|
| **T — test failure** | a unit/integration/functional/frontend test failed | **root-cause fix**: real regression → fix the code; behavior changed *on purpose* → update the test to the new contract (justified from the design) |
|
|
138
140
|
| **Y — type / build / compile** | type-check (`static_analysis`) or build broke | fix the code/types |
|
|
139
|
-
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
141
|
+
| **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) **whose cause in the test or the code was looked for and not identified** (flow-core §11) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
|
|
140
142
|
| **S — quality gate / scope** | coverage threshold, security scan, a lint rule newly hitting legacy code | judgment call: fix within scope, or defer/config with justification — never touch unrelated code just to appease a gate without confirming |
|
|
141
143
|
| **C — conflict / branch behind base** | the branch conflicts with `git.default_base`, or the host requires it updated before merging | integrate the base into the branch and **resolve each conflict on its merits** (§5.C) — hard gate before touching git history |
|
|
142
144
|
| **H — human blocker** | draft/WIP, approvals missing, unresolved review threads, a required reviewer or check that only a person can clear | **not this command's job**: name it, say exactly what is needed and from whom, and route it (threads → `/flow-work-respond`; draft → offer to mark ready; approvals → the reviewers). Never work around it |
|
|
143
145
|
|
|
144
|
-
**
|
|
146
|
+
**A test this diff did not touch is still this command's.** A red test that looks flaky is diagnosed before it is called K (flow-core §11): read its log tail and its code; a fragility identified there — it counts timer ticks, depends on order, reads another test's leftovers — or a cause in the code is **T**, fixed in this round even when it does not go red locally, in its own commit `Fix fragile test <name>: <cause>`, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Only a cause not identified stays K.
|
|
147
|
+
|
|
148
|
+
**Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks (a flow-core §11 rewrite onto the same result is not weakening), never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
|
|
145
149
|
|
|
146
150
|
Present a **triage table**: `blocker → kind → category → probable cause (log or merge verdict) → proposed action`, **C** and **H** rows first (a conflict makes the pipeline result provisional — CI reruns on a different tree after integrating the base). In `manual`, let the user re-categorize any row (especially T-vs-K) before proceeding.
|
|
147
151
|
|
|
@@ -164,9 +168,9 @@ Only **base-integration**, **auto-fix** and **code-fix**:
|
|
|
164
168
|
|
|
165
169
|
- **Design-invalidation first.** A test failure that shows the *design* was wrong → do not patch the test into agreement; update `03-design.md` **before** editing; if large, route back through `/flow-feat-build` / `/flow-bug-fix`.
|
|
166
170
|
- **Delegate the edits** to the expert sub-agents (FLOW.md `agents`); the conductor stays on judgment. Repo conventions plus the **comment discipline** of `/flow-feat-build` — comments only for a non-obvious *why*, never a ticket ID or "for MR #N".
|
|
167
|
-
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote.
|
|
171
|
+
- **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote. A fragile test fixed by flow-core §11 is checked with its forced reproduction when there is one, then pushed the same way.
|
|
168
172
|
- **Re-run the review gate for non-trivial code-fixes.** More than a mechanical tweak → `quality.review_skill` (or built-in `code-review` if empty) on this round's diff before pushing. Pass the diagnosis as context, never as a scope exclusion (*"the cause was X"*, not *"skip X"*). High-severity findings block the push until addressed.
|
|
169
|
-
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). The push is a hard gate in **every** mode.
|
|
173
|
+
- **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). A fragile-test repair (flow-core §11) is split into its own commit in every mode, and the round's summary names it as *also fixes fragile test `<name>`: <cause>*. The push is a hard gate in **every** mode.
|
|
170
174
|
|
|
171
175
|
### 5.C Integrate the base and resolve conflicts (category C)
|
|
172
176
|
|
|
@@ -99,7 +99,10 @@ back through it, and the hard gates above resolve this way:
|
|
|
99
99
|
- **The one closing order**, after the WIP commit (flow-core §2.1): code changed this round →
|
|
100
100
|
`publish` with the work's `publish-title.md` / `publish-body.md` (updated when the round changed
|
|
101
101
|
what they say, and naming any thread whose reply failed) and no `--part/--of` — the MR/PR is
|
|
102
|
-
already open (flow-core §2.1) — so the commits the replies name reach the branch
|
|
102
|
+
already open (flow-core §2.1) — so the commits the replies name reach the branch (and the push reruns CI, so a
|
|
103
|
+
failure nobody could explain needs nothing more); no code changed, every reply went out and a
|
|
104
|
+
thread carried a CI failure neither reproduced nor explained (§3) → `blocked`, its one-line reason
|
|
105
|
+
starting `rerun CI: <job>[, <job>…]` (flow-core §11); no code changed and every reply went
|
|
103
106
|
out → `done`, the summary listing the threads answered; no code changed and a reply failed →
|
|
104
107
|
`blocked`, naming those threads.
|
|
105
108
|
|
|
@@ -148,6 +151,8 @@ Categories:
|
|
|
148
151
|
| **F — obsolete/done** | Already addressed, or no longer applies | reply pointing to where |
|
|
149
152
|
| **G — data / performance objection** | The reviewer says a query is slow, unbounded, unindexed, or proposes a different query | **measure first** (§4.G), then reply with the plan |
|
|
150
153
|
|
|
154
|
+
**A thread that carries a CI failure** — a person pasted a failing job's log or a red test's output — is a **C** about that test, not an **A** to answer: reproduce it with `quality.test_one`; red → fix it on its merits, through flow-core §11 when the test is outside this diff. Not red here → diagnose it from the pasted log and the test's code (flow-core §11): a fragility identified (it counts timer ticks, depends on order, reads another test's leftovers) or a cause in the code → fix it in its own commit `Fix fragile test <name>: <cause>`, and the reply names that commit and the cause, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Neither → change nothing for it; the reply says it did not reproduce, that no cause was found in the test or the code, and what the person does next (*rerun CI; if it fails again, …*) — never a bare "not reproduced".
|
|
155
|
+
|
|
151
156
|
Present a **triage table** to the user: `thread → location → category → proposed action → one-line rationale` — the map for the rest of the command. In `manual` mode, let the user re-categorize any row before proceeding.
|
|
152
157
|
|
|
153
158
|
## 4. Agree the response per thread (the debate)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flow-workflows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.107.0",
|
|
4
4
|
"description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "flow",
|
|
4
4
|
"displayName": "Flow — guided dev workflows",
|
|
5
5
|
"description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.107.0",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Alberto Vioque",
|
|
9
9
|
"email": "mashware@gmail.com"
|
|
@@ -5,6 +5,27 @@ plugin and is what `/flow:news` reads to show you what changed since your previo
|
|
|
5
5
|
|
|
6
6
|
The canonical, richest notes live in the [GitHub Releases](https://github.com/mashware/flow-workflows/releases).
|
|
7
7
|
|
|
8
|
+
## v0.107.0 — A red test outside the change gets fixed when flow can see why · 2026-11-03
|
|
9
|
+
|
|
10
|
+
**In short**
|
|
11
|
+
- **A red test the change did not touch is diagnosed before it is excused.** flow reads the test and the code it
|
|
12
|
+
drives and names the cause: it counts timer ticks instead of checking the result, it depends on the order tests
|
|
13
|
+
run in, it reads what another test left behind, or the code has a race.
|
|
14
|
+
- **A cause it can prove gets fixed in the same MR/PR.** The test keeps checking the same behaviour, by its result
|
|
15
|
+
rather than its timing. It is never deleted, skipped, retried or loosened, and no timeout gets longer. The fix
|
|
16
|
+
goes in its own commit, and the MR/PR description lists it under `## Also fixed`.
|
|
17
|
+
- **"Proved" means evidence.** The cause is named at `file:line`, and either a forced reproduction turns the test
|
|
18
|
+
red on purpose or the fragility is plain in the assertion. A plausible guess is not acted on.
|
|
19
|
+
- **A CI failure pasted into a review no longer ends at "not reproduced".** `respond` and `green` diagnose it from
|
|
20
|
+
the log. If they find the fragility, they fix it and push. If not, the reply says so and tells the person what to
|
|
21
|
+
do next. An unattended run that changed nothing ends `blocked` with a reason starting `rerun CI:`.
|
|
22
|
+
- **When the cause is not found, the old path still applies**: the base exception, the flake record, or a rerun.
|
|
23
|
+
Each test it leaves red now says what the person does next.
|
|
24
|
+
|
|
25
|
+
Until now, an unattended `validate` let a red test through when it was also red on the base or looked flaky. The
|
|
26
|
+
MR/PR went out red with the test under "Not verified — needs a human", even when the run could see why it failed.
|
|
27
|
+
In one case the test counted timer ticks, so a 180 ms stall failed it (#232).
|
|
28
|
+
|
|
8
29
|
## v0.106.0 — The knowledge a work learned ships in its own MR/PR · 2026-11-02
|
|
9
30
|
|
|
10
31
|
**In short**
|