Skip to content

armgit / cra

Public Imported from GitHub
0

The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.

Every bug fix comes with a test that fails without it, locked when the bug has an issue

Victor0bd9a83f0ee9
diff --git a/CLAUDE.md b/CLAUDE.md
index 605669e..031297e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -36,9 +36,16 @@ through `Sources/Cra/App/CraCoreExports.swift`.
record the new expectation and say why in the PR.
5. **Run `scripts/test.sh` before a PR.** CI runs it as well, with the coverage gates in
docs/testing.md.
-6. **A fix for an issue comes with a test tagged `.bug(".../issues/<n>")`**, locked in
- `Tests/promises.lock`. When a locked test fails, the change broke something that shipped: fix
- the change, not the test. Only Victor decides that a shipped behaviour changes; then run
+6. **Every bug fix comes with a test that fails without it.** That applies whether the bug
+ came from an issue, an X DM, a crash report, a nightly failure or your own testing. Write the
+ test first, see it fail on the unfixed code, then fix. When the bug has an issue, tag the test
+ `.bug(".../issues/<n>")` (`// promise: #<n>` above a harness func, `# promise: #<n>` in a
+ scenario) and run `scripts/promises.py --update`, so it's locked in `Tests/promises.lock`.
+ When the decision can't be reached by a test, move it into CraCore (rule 1) or add the
+ `cra://debug` readout a scenario needs as part of the fix. Only what needs a real site, the
+ GPU or a human eye becomes a line in docs/release-checklist.md, and the commit says so.
+ When a locked test fails, the change broke something that shipped: fix the change, not the
+ test. Only Victor decides that a shipped behaviour changes; then run
`scripts/promises.py --update` and name the issue in the commit (docs/testing.md rule 8).
## Known exceptions
diff --git a/docs/testing.md b/docs/testing.md
index 4adb64e..56ec88b 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -17,7 +17,11 @@ Commands for each piece are in [development.md](development.md#tests).
4. **Fixtures over dictionaries.** Every format Cra reads from another browser has a made-up
profile in that browser's own format under `Tests/Fixtures/<Browser>` (no real browsing
data). Parsers are tested on those files, and the fuzzer mutates them.
-5. **A bug fix comes with the test that would have caught it.**
+5. **A bug fix comes with the test that would have caught it**, written first and seen failing
+ on the unfixed code. That holds for every bug, with or without an issue; one with an issue is
+ also locked (rule 8). If no test can reach it, the fix moves the decision into CraCore or adds
+ the debug readout a scenario needs; only what takes a real site, the GPU or a person's eye
+ becomes a line in [release-checklist.md](release-checklist.md).
6. **Never assert on a fake's bookkeeping alone.** A test whose only check is "the fake
recorded a call" tests the fake.
7. **A flaky test is rewritten on the clock or deleted**, never retried or given a sleep.