Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- Test strategy now checks whether an existing assertion catches the requested
regression before changing tests. A demonstrated witness can remain unchanged.

## 1.1.0 — 2026-11-13

- Minor release: code reviews can now use a changed branch, caller or previous
Expand Down
2 changes: 1 addition & 1 deletion docs/provenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This English community edition adapts 33 workflows developed by Lucas Tavano wit
| `metrics-costs` | `metricas-e-custos` |
| `operational-alerts` | `alertas-operacionais` |
| `simulation-isolation` | `simulacao-e-producao` |
| `test-strategy` | `estrategia-de-testes` and `testes-redundantes` (merged in 0.5) |
| `test-strategy` | `estrategia-de-testes` and `testes-redundantes` (merged in 0.5); existing-coverage stopping rule from the [inverse control](../evals/results/2026-11-13-test-strategy-baseline.md#inverse-control-the-fallback-already-has-a-witness) |
| `code-review` | `code-review` |
| `debugging` | `investigar-bugs` |
| `security-boundaries` | `seguranca-e-permissoes` |
Expand Down
2 changes: 1 addition & 1 deletion docs/source-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ are not packaged. “Original workflow” means the historical authored material
| Domains | [`metrics-costs`](../priv/library/skills/metrics-costs/SKILL.md) | `metricas-e-custos` | original workflow; shared contract | A metric definition states numerator, denominator, unit, period, source and exclusions so two screens mean the same thing. |
| Domains | [`operational-alerts`](../priv/library/skills/operational-alerts/SKILL.md) | `alertas-operacionais` | original workflow; shared contract | Repeated events for one active issue update a stable alert rather than flooding the operator. |
| Domains | [`simulation-isolation`](../priv/library/skills/simulation-isolation/SKILL.md) | `simulacao-e-producao` | original workflow; shared contract | Simulation cannot reach real orders, payments, messages or provider writes through a hidden common code path. |
| Code | [`test-strategy`](../priv/library/skills/test-strategy/SKILL.md) | `estrategia-de-testes` + `testes-redundantes` | tdd | Each test has a concrete input, expected observable result and reason the boundary matters. |
| Code | [`test-strategy`](../priv/library/skills/test-strategy/SKILL.md) | `estrategia-de-testes` + `testes-redundantes` | tdd | Try the requested regression against existing assertions first; add a test only for a distinct uncovered risk. |
| Code | [`code-review`](../priv/library/skills/code-review/SKILL.md) | `code-review` | original workflow; Cyclops for investigation order | A changed branch, caller or past fix can prioritize a scenario; the finding cites a location, a reachable trigger and its consequence. |
| Code | [`debugging`](../priv/library/skills/debugging/SKILL.md) | `investigar-bugs` | original workflow; shared contract | The fix addresses the mechanism at the owning layer and preserves neighboring behavior. |
| Backend | [`security-boundaries`](../priv/library/skills/security-boundaries/SKILL.md) | `seguranca-e-permissoes` | original workflow; shared contract | Tenant or account scope survives IDs supplied in URLs, caches, exports, attachments and queued work. |
Expand Down
93 changes: 93 additions & 0 deletions evals/results/2026-11-13-test-strategy-baseline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Test strategy: a green threshold test can still miss the wrong output

**Baseline, not a workflow change.** One fresh Codex CLI 0.162.1 session
(GPT-6.1-Sol, medium) used the test-strategy guide shipped in v1.1.0.
The case was a disposable Mix wrapper around a private application's real
pure function and its entire five-test module. The brief asked whether the
current suite protected the documented output before a refactor. It supplied
neither the mutation nor an expected literal.

The contract chooses the first candidate that meets a threshold, with the
last candidate as fallback. The existing examples asserted that results reach
the threshold and covered the fallback. The reviewer tried searching from the
opposite end. All five examples still passed. It independently worked out an
input with an interior crossing and added one exact-output assertion at the
public function. That test failed on the mutation; restoring the original
source produced six passes. The reviewer ran ExUnit directly because Mix
could not open its local PubSub socket in that session.

Separately, the evaluator substituted the last candidate unconditionally.
The original five tests passed; the new sixth test failed alone on that same
mutation, and all six passed after restoration using normal Mix. These are
focused observations in an isolated subset, not an application suite run or
evidence of a shipped application defect.

## Inverse control: the fallback already has a witness

The first-qualifying rule above and the fallback are distinct contracts of
the same public function. The inverse control used the application's original
five tests, **not** the sixth test from the first session. The source and test
module at the new application snapshot were byte-identical to the baseline.
The evaluator checked that none of the 26 candidates for the existing fallback
input reaches the threshold. In a separate copy, replacing the last candidate
with the first made exactly the existing fallback assertion fail (5 tests,
1 failure); the original and restored runs both passed all five.

A fresh session received the v1.1.0 guide, source, tests and minimal Mix
project. The brief asked whether the documented fallback output was protected
before a refactor. It allowed test changes and temporary mutations; it did not
supply the mutation, the failing test, or the expected verdict. The evaluator
set the criterion before the run: demonstrate the **existing** test failing
for a wrong selection, restore production, return to green, and leave the
test tree unchanged.

The session did **not** meet that criterion. Its first mutation changed
rounding at the endpoint. The old fallback assertion computed its expectation
with the same mixing function; both sides changed together. The reviewer
strengthened that test with an independent literal and checked that the input
cannot reach the threshold. It tried the wrong selection only **after** the
edit. It added no test case, but it did not demonstrate the original selection
coverage before editing. Its change detected a distinct arithmetic regression
and should not be scored as a duplicate.

The evaluator replayed both mutations with ordinary Mix:

| Production variant | Original five tests | First inverse session's five tests |
|---|---:|---:|
| Unchanged | 5 passed | 5 passed |
| First candidate instead of last on fallback | 1 failed | 1 failed |
| Change rounding at the endpoint | 5 passed | 1 failed |

A second fresh session received the same pristine source and tests. Its brief
specified that the refactor changes *which candidate is selected when none
qualifies*, leaving candidate generation and threshold calculation unchanged.
It did not say what any existing test catches or tell the session to avoid
edits. The session ran the first-instead-of-last mutation **before** editing:
only the existing fallback test failed. It nevertheless rewrote the expectation
and added a sixth test for the first qualifying candidate. That sixth test
caught a real regression on the success path, as in the original baseline.
It was outside this refactor, not a second witness needed for fallback.
Neither v1.1.0 session finished the inverse control with unchanged tests.

## Candidate: prove existing coverage before editing

Only the workflow guidance changed: try a plausible regression in the requested
behavior against the existing suite first. If it fails for the right reason
and passes after restoration, keep the existing witness and report adjacent
gaps separately. The evaluator replayed two cases in fresh sessions, each with
the same brief as its released-guide comparison:

| Brief | Released guide | Candidate guide |
|---|---|---|
| Fallback selection only | Existing test caught the mutation; session still edited tests (5 → 6). | Wrong fallback failed the existing assertion (5 tests, 1 failure); restored suite passed all 5. Production and test files byte-identical to the initial snapshot. |
| Original choice-of-output brief (gap present) | Original five missed the wrong selection; a sixth test exposed it. | Original five still passed when always returning the last candidate; one new interior-crossing example failed on the mutant and all six passed on restored code. |

All sessions used the same client, model and reasoning level noted above.
No session received evaluator notes, expected answers, a previous run's edits
or results. Each used direct ExUnit when Mix could not open its local socket.
Only disposable extracts were changed. This is one run per guide and brief,
not a detection-rate estimate or evidence of full application coverage.

**Decision:** adopt the tested stopping rule. The deciding observation was a
failure of the unchanged assertion on the requested mutation, not a coverage
percentage, a constant test count, or the absence of other worthwhile tests.
2 changes: 2 additions & 0 deletions priv/library/skills/test-strategy/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ The output is a short list of risks, each with the cheapest test that can observ

1. List the behaviors that can break, one line each: trigger, wrong outcome, who notices. Rank by consequence and likelihood using real incidents and the code paths that exist, not a generic checklist. Done when every behavior that can break is one line with trigger, wrong outcome and who notices, ranked by consequence and likelihood.

Before editing tests, try a plausible regression in the requested behavior against the existing focused suite. If an existing assertion catches it for the right reason and passes after restoration, keep it unchanged for that risk. Report gaps in unchanged neighboring behavior separately; expand the suite only for a distinct risk in scope.

2. For each risk choose the smallest seam that can observe the failure: a pure function for a calculation, the context function for a rule, the persistence boundary for constraints and races, the LiveView or controller for authorization and rendering, an integration test only where mocks would hide a contract mismatch. Done when each risk has the cheapest seam that can observe its failure.

3. Write each test from an independent oracle: a known-good literal, a worked example, the spec, a stored fixture. If the expected value is computed the way the code computes it, the test cannot disagree with the code; rewrite it. Done when each expected value comes from an independent oracle, not from the code under test.
Expand Down
Loading