feat(archunit-rules): NoBlanketCatch violationCount for ratchet assertions (#332 W1) #16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/archunit-noblanketcatch-count"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds
NoBlanketCatchArchTest.violationCount(JavaClasses)so consuming services can ratchet the blanket-catch debt instead of warning with no ceiling.Surfaced by user-service #16 R1 (MAJOR): a pure warn test (log, no assertion) lets new
catch (Exception)blocks accumulate silently forever — cosmetic from merge. The fix is a ratchet: pin the W1 baseline, assertviolationCount(...) <= baseline→ existing debt tolerated, new debt fails.evaluateForWarning(report string) stays for logging; counting its rendered lines is fragile (theFailureReporttoString carries header/format lines).violationCountreturnsgetFailureReport().getDetails().size()— one entry per flagged catch clause, format-independent.Changes
NoBlanketCatchArchTest.violationCount(JavaClasses)— new accessor (0 when compliant).NoBlanketCatchSelfTest.violationCountMatchesFixtures— asserts 3 for the negative package (Exception+Throwable+RuntimeException fixtures), 0 for the positive package.Verification
mvn -pl archunit-rules test→ Tests run: 8, Failures: 0, Errors: 0; BUILD SUCCESS, zero warnings.Blast radius
Additive public method on a test-helper class; no behaviour change to the rule itself. Score 2/10. Consumed next by the 7-service
NoBlanketCatchWarnTestratchets (W2 flip tracked in im2be-mono#4).Show previous round
hib-pr-reviewer review — PR #16 (affinity-intelligence-rework/im2be-platform-libs)
Round 1 — head
46c0edc77975, basemain, triggeropenedTL;DR: CONDITIONAL_APPROVE — kept 1 minor unique-to-A finding (vacuous positive-branch self-test), Reviewer B filed 0 findings; no blocking issues.
Summary
Arbitration — PR #16
feat(archunit-rules): NoBlanketCatchArchTest.violationCountPrior runs: None — first arbitration for this PR.
Reconciliation: A=1 finding, B=0 findings.
Unique-to-A finding (line 123,
NoBlanketCatchSelfTest.java): Verified by reading the file. The positive branch ofviolationCountMatchesFixtures(lines 123–126) imports from thePOSITIVEpackage and assertsisZero()with no fixture-containment guards. Contrast withpassesForCompliantFixtures(lines 43–65), which guards with fourpositive.contain(...)assertions and an explicit comment// Guard against a vacuous pass. IfimportPackages(POSITIVE)returns an emptyJavaClasses(classpath gap, accidental package rename, etc.),violationCountreturns0andisZero()passes silently. The negative branch is self-protecting (count ≠ 3 fails). Finding kept.B's summary mention of class-level Javadoc missing RATCHET mode was not filed as a formal finding — not surfaced here per reconciliation rules.
Result: 1 minor finding kept, 0 dropped.
Blast Radius
The diff adds one new public static method (
violationCount) to an in-library helper class and a self-test; no existing behaviour is modified. The library is consumed by downstream services but the change is purely additive, so the blast radius is narrow and confined to test reliability of the new helper.BLAST_SCORE: 2/10
CI status (head
46c0edc77975)Overall: ✓ success
2 checks: 2 pending
Findings (1)
[MINOR] Positive branch of
violationCountMatchesFixturescan vacuously pass ifPOSITIVEpackage yields no classesarchunit-rules/src/test/java/com/aim2be/platform/archunit/NoBlanketCatchSelfTest.java:123
Lines 123–126 import the
POSITIVEpackage and assertisZero()with no fixture-containment guards:If
importPackages(POSITIVE)returns an empty set — e.g. due to a classpath gap, compilation failure, or accidental package rename —violationCountreturns0andisZero()passes without evaluating anything.The existing
passesForCompliantFixtures(lines 43–65) guards against exactly this with fourpositive.contain(...)assertions before evaluating, and carries an explicit comment// Guard against a vacuous pass. The new test's positive branch should follow the same pattern. At minimum add:before the
isZero()assertion. Adding all four guards (matchingpassesForCompliantFixtures) is preferable so both tests agree on which fixtures constitute the positive set. The negative branch (isEqualTo(3)) is already self-protecting: a missing fixture produces a count ≠ 3 and the test fails.Verdict
CONDITIONAL_APPROVE
hib-pr-reviewer • round 1 • 1 finding (1m) • 2026-05-30T17:53:35.586Z → 2026-05-30T17:55:21.667Z • posted-as: pr-reviewer-bot • model: auto
R1 verdict CONDITIONAL_APPROVE; 1 minor finding (kept=1): (1) MINOR NoBlanketCatchSelfTest:123 — violationCountMatchesFixtures' positive branch asserted isZero() with no containment guard; an empty POSITIVE import (classpath gap / rename) would make it vacuously pass. Added a positive.contain(SpecificCatchService.class) guard before the isZero() assertion (mirrors passesForCompliantFixtures' anti-vacuity guards). The negative branch (isEqualTo(3)) is already self-protecting — a missing fixture yields count != 3 and fails. Verification: - mvn -pl archunit-rules test → Tests run: 8, Failures: 0, Errors: 0 (BUILD SUCCESS) - zero warningshib-pr-reviewer review — PR #16 (affinity-intelligence-rework/im2be-platform-libs)
Round 2 — head
f0e907c491f6, basemain, triggersynchronizeTL;DR: NO_NEW_FINDINGS — No new findings this round.
Summary
[quorum-converged] A=0 = B=0. Round 1 finding fully resolved. The new
violationCountMatchesFixturestest adds an explicitpositive.contain(SpecificCatchService.class)guard (lines 126–129) before theisZero()assertion, exactly the pattern the round-1 comment requested.SpecificCatchServicewas confirmed present atarchunit-rules/src/test/java/com/aim2be/platform/archunit/fixtures/positive/SpecificCatchService.java. The negative branch'sisEqualTo(3)assertion is self-guarding against vacuous pass (an empty import returns 0, which ≠ 3, so it cannot silently pass).violationCount's use ofresult.getFailureReport().getDetails().size()is the correct stable ArchUnit API for per-violation counts — it won't drift with header/formatting changes. README prose accurately describes the new method and ratchet pattern.CI status (head
f0e907c491f6)Overall: ⏳ pending
2 checks: 2 pending
Findings
No new findings this round.
Quorum converged on empty findings (A + B both returned 0).
Verdict
NO_NEW_FINDINGS
hib-pr-reviewer • round 2 • 0 findings • 2026-05-30T17:56:34.615Z → 2026-05-30T17:58:04.983Z • posted-as: pr-reviewer-bot • model: auto • [bookkeeping fallback]