fix(sonar): drive open findings to zero and document gate policy#89
Conversation
Hoist route.asset() into a single local Optional in RouteTableBuilder and RouteRuntimeAssembler so the isPresent() guard and the value access (asset.get()) are driven from the same reference, clearing both gate-failing java:S3655 unguarded-Optional findings. Behavior is preserved (asset XOR upstream terminal action, ADR-0014). Adds empty-Optional regression tests asserting the no-asset proxy path resolves without throwing. Co-Authored-By: Claude <noreply@anthropic.com>
Resolve the four investigate-first care items: - java:S2589 (DispatchStage.upstreamRequestUri): drop the always-false `rawQuery == null` sub-expression (rawQuery is non-null under @NullMarked) and add an explicit Objects.requireNonNull boundary check. - java:S112 (DispatchStage.awaitDispatch): replace the generic `throws Exception` with the specific `throws InterruptedException, ExecutionException` actually raised by CompletableFuture#get; the in-class Callable caller is unaffected. - java:S3776 (ConfigValidator.validateAnchorNamespaceMembership): extract the rule-3 and rule-4 membership checks into named private helpers, preserving exact ADR-0007 semantics (squatter/undeclared-anchor boot failures unchanged). - java:S125 (DispatchStageTest): the flagged block is legitimate explanatory prose about the ExecutionException-wrapping contract, not commented-out code (false positive) — apply an auditable NOSONAR java:S125 suppression. Co-Authored-By: Claude <noreply@anthropic.com>
…192) - ConfigValidator: use the existing REQUIRE_BEARER / REQUIRE_SESSION constants in the effective-auth requires.contains(...) checks instead of raw literals. - TokenValidatorProducer: extract the four-times-repeated "Issuer '" error- message prefix into a private static final ISSUER_PREFIX constant. Literal values are unchanged — a behavior-neutral refactor; no test assertion changes value and existing tests pass unmodified. Co-Authored-By: Claude <noreply@anthropic.com>
…7467/S6353/S4276/S6878) Behavior-preserving mechanical sweep clearing the D4 SonarCloud findings: - S5778 x21: hoist multi-invocation setup out of assertThrows lambdas so each wraps a single throwing call (ConfigLoaderTest, RouteRuntimeAssemblerTest, TcpPeerGateTest, RouteTableBuilderTest) - S7467 x14: unnamed variable pattern (_) for unused catch parameters (7) and unused lambda parameters (7) - S6353: concise \w regex token in EnvSecretResolver placeholder patterns - S4276: UnaryOperator<String> for the Function<String,String> header lookup in ForwardPolicyStage - S6878: record deconstruction patterns in Served/Fetched equals() Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add the contributor SonarCloud compliance page and a reference-first CLAUDE.md section: - doc/development/sonar-quality-gate.adoc: authoritative/blocking gate, zero new findings, never-merge-over-red-or-stale-green, PR-new-code vs post-merge project-gate auditability, fix-by-default / suppress-with-rationale; references org thresholds without restating them - doc/development/README.adoc: index row linking the new page - CLAUDE.md: concise Sonar / Quality Gate section linking the full policy Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Correct the two integration-benchmark badge link targets to the operator-verified live paths (benchmarks/integration/index.html, benchmarks/integration/trends.html) and align the Performance Benchmarking prose with the k6 migration from PR #82. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Sorry @OliverWolffGIP, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: cuioss/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (26)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive SonarCloud Quality Gate compliance policy, documented in a new sonar-quality-gate.adoc file and referenced in CLAUDE.md and README.adoc. Code changes focus on modernization and refactoring, including the adoption of Java 21 unnamed variables (_) and record pattern matching, extracting helper methods in ConfigValidator, refactoring local variables to prevent redundant calls, and improving test coverage for empty-Optional asset branches. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Route two durable project-config facts (Sonar HTTPS credential-config guardrail, Java-25 unnamed-variable source-level guardrail) into the project-local architecture-hints store. Co-Authored-By: Claude <noreply@anthropic.com>
Align shouldFailBootForSessionAndAssembleProtocolRoutes with the hoisted-local pattern PR #89 established (and the file's dominant style) after the rebase conflict resolution kept the plan-side test semantics. Co-Authored-By: Claude <noreply@anthropic.com>
Summary
Drives the API Sheriff codebase toward zero open SonarCloud findings and documents the zero-findings compliance policy. Fixes the two gate-failing
java:S3655unguarded-Optional bugs first (RouteTableBuilder,RouteRuntimeAssembler), investigates and remediates the four flagged care-item findings, extracts duplicated string literals to constants, applies a mechanical Java-25 modernization sweep acrossapi-sheriff, and adds contributor-facing documentation of the SonarCloud compliance policy.Changes
java:S3655unguarded-Optional):api-sheriff/src/main/java/de/cuioss/sheriff/api/config/RouteTableBuilder.java,api-sheriff/src/main/java/de/cuioss/sheriff/api/edge/RouteRuntimeAssembler.java, with matching empty-Optional regression tests inRouteTableBuilderTest.javaandRouteRuntimeAssemblerTest.java.api-sheriff/src/main/java/de/cuioss/sheriff/api/edge/DispatchStage.javaandDispatchStageTest.java.java:S1192):api-sheriff/src/main/java/de/cuioss/sheriff/api/config/validation/ConfigValidator.java,api-sheriff/src/main/java/de/cuioss/sheriff/api/auth/TokenValidatorProducer.java.api-sheriff/src/main/java/de/cuioss/sheriff/api/(asset, config, edge, forward packages) and matching test files:AssetSource.java,DirectoryAssetSource.java,PathConfinement.java,UpstreamAssetSource.java(+UpstreamAssetSourceTest.java),EnvSecretResolver.java(+ConfigLoaderTest.java),GatewayEdgeRoute.java,ForwardPolicyStage.java,TcpPeerGate.java(+TcpPeerGateTest.java),GatewayEventCounterTest.java.doc/development/sonar-quality-gate.adoc(withdoc/development/README.adocindex update) documenting the org-owned SonarCloud gate as authoritative and blocking, zero-new-findings policy, never-merge-over-red-or-stale-green rule, PR-new-code-vs-project-analysis auditability nuance, and fix-by-default / suppress-with-rationale rule; new "Sonar / Quality Gate" section inCLAUDE.mdreferencing the org gate and the new page.README.adocbenchmark badge link fixes and WRK→k6 prose update.Test Plan
python3 .plan/execute-script.py plan-marshall:build-maven:maven run --command-args "verify -Ppre-commit")python3 .plan/execute-script.py plan-marshall:build-maven:maven run --command-args "verify")Related Issues
None.
Generated by plan-finalize skill