From d0ac63399e903c7269858c7712aeb2b59ebd5afd Mon Sep 17 00:00:00 2001 From: marregui Date: Sat, 31 Oct 2026 15:29:48 +0100 Subject: [PATCH] 2.0.3: G-11.6 Finding exempts the per-class fixture its title asks for --- CHANGELOG.md | 7 +++++++ RULES.md | 2 +- STANDARD.md | 9 ++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e16db3..4432878 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.0.3 (2026-10-31) + +- G-11.6: the Finding reported every `Closeable` outside `try`-with-resources, so the per-class fixture its title asks + for (opened in `@BeforeAll`, closed in `@AfterAll`) was a finding. The Finding now exempts a per-class fixture + closed in `@AfterAll` or by an extension, and the text says how `@AfterAll` closes a fixture whose start failed. + The title wins over the Finding it contradicted; no other rule changed. + ## 2.0.2 (2026-10-31) Corrections found by applying the standard to a whole repository; no rule ID, scope, class or Finding line changed. diff --git a/RULES.md b/RULES.md index 051e6ab..418cad0 100644 --- a/RULES.md +++ b/RULES.md @@ -89,7 +89,7 @@ rule. Read the rule's block in the standard before applying it or reporting a fi | G-11.3 | Fault injection is an anonymous subclass of the facade, failing on the Nth call or on a specific name, installed via the configuration for one test block | skip unless facades | rule | review | A mocking library, or fault injection that does not go through the facade. | | G-11.4 | Randomness is a two-seed generator, seeds printed on every run and accepted back through system properties | everywhere | rule | test, review | A randomised test whose seed is not printed or cannot be replayed. | | G-11.5 | Concurrency tests: a barrier to start, a latch with a timeout to join, atomics for outcomes asserted once on the main thread, `assertEventually` with backoff instead of `Thread.sleep`, races hunted with seeded repeat loops | everywhere | rule | review | `Thread.sleep` used to wait for a condition, an unbounded join, or outcomes asserted on a worker thread. | -| G-11.6 | Heavy fixtures are static per class; every mutable piece is reset before each test (`@BeforeEach`); overrides go through a typed `Overrides` object the test configuration consults live | everywhere | rule | review | A `Closeable` in a test outside `try`-with-resources, mutable shared state not reset per test, or a copied test where a parameter would do. | +| G-11.6 | Heavy fixtures are static per class; every mutable piece is reset before each test (`@BeforeEach`); overrides go through a typed `Overrides` object the test configuration consults live | everywhere | rule | review | A `Closeable` in a test that is neither in `try`-with-resources nor a per-class fixture closed in `@AfterAll` (or by an extension), mutable shared state not reset per test, or a copied test where a parameter would do. | | G-11.7 | Tests are documented with Markdown comments | everywhere | rule | test | A test class or test method without a `///` comment, or a `/** */` comment on one. | | G-11.8 | Tests never touch the user's data | everywhere | defect | review, test | A test that reads or writes the user's home data, keychain, preferences or configuration without a named flag. | | G-12.1 | A repository that follows this standard has an Apply section | everywhere | rule | review | A repository whose agent instructions or documentation claim this standard and that has no Apply section, or an Apply section without the version it follows. | diff --git a/STANDARD.md b/STANDARD.md index 75bb3ca..d7c4541 100644 --- a/STANDARD.md +++ b/STANDARD.md @@ -1864,10 +1864,13 @@ assertEquals(0, anomalies.get()); **Scope:** everywhere · **From:** P1, P5 · **Checked by:** review · **Class:** rule -**Finding:** A `Closeable` in a test outside `try`-with-resources, mutable shared state not reset per test, or a copied test where a parameter would do. +**Finding:** A `Closeable` in a test that is neither in `try`-with-resources nor a per-class fixture closed in `@AfterAll` (or by an extension), mutable shared state not reset per test, or a copied test where a parameter would do. -`try (final X x = ...)` for every `Closeable` in -tests. Parameterise over modes rather than copy tests. Assert meaning, not +A heavy fixture (an embedded database, a server) lives for the class: opened in +`@BeforeAll` and closed in `@AfterAll`, which closes what was opened even when +the start failed half-way (a fixture still `null` is skipped, so the start's +failure is the one reported). Every other `Closeable` in a test is held in +`try (final X x = ...)`. Parameterise over modes rather than copy tests. Assert meaning, not representation. Narrow unit tests need no base class.