Skip to content

F26.2 — Sonar debt

State Closed
Parent E26
Iteration Release 11
Start Date 2026-11-19
Closed Date 2026-11-19
Predecessors —
Source owner 2026-11-19

Stories: 2 Closed

Story State Depends on
S26.2.1 — Fix the test findings Closed (2026-11-19) —
S26.2.2 — Fix the source findings Closed (2026-11-19) —

main has no open Sonar issue that the code can fix. An issue whose code is right stays open with its reason written here, for the owner to mark in Sonar.

Context

On 2026-11-19 Sonar listed 66 open issues on main. The quality gate passes.

Rule Count Where
S5778: one call per pytest.raises block 44 tests in every package except rn-forge-cli and rn-forge-devops
S3415: actual value first in an assertion 2 rn-forge-sqlalchemy and rn-forge-commons tests
S1192: duplicated string literal 7 rn_forge/web/transfer.py, rn_forge/web/conformance/_transfer.py, rn_forge/web/conformance/_platform.py
S3776: cognitive complexity over 15 6 django/drf/transfer.py (2), django/drf/pagination.py, fastapi/transfer.py, web/transfer.py, devops/requirements.py
S5754: bare except without re-raise 2 rn_forge/commons/runtime/actor.py
S5655: argument type 1 rn_forge/data/excel.py (add_table)
S5886: return type 1 rn_forge/auth/linking.py (link_bearer_principal)
S1110, S6353, S6395: redundant parentheses, \d, needless group 3 tooling/install/lifecycle.py, django/drf/pagination.py, commons/logging/redaction.py

The fixes change no public API and no behaviour.

S26.2.1 — Fix the test findings

State: Closed (2026-11-19)

Acceptance:

  • Each S5778 and S3415 issue's test is rewritten so the pytest.raises block holds the one call expected to raise, with arguments built before it, and the assertion names the actual value first.
  • The tests assert the same things as before.
  • task validate passes.

Outcome: 44 S5778 and 2 S3415 sites rewritten across 19 test files; the next Sonar scan confirms them. The two atomic_replace tests in test_paths.py must write through the entered temporary path inside the block, so Sonar may still flag them.

S26.2.2 — Fix the source findings

State: Closed (2026-11-19)

Acceptance:

  • Each S1192, S3776, S1110, S6353, S6395 and S5886 issue is fixed in the source with no change to public signatures or behaviour; a complexity fix extracts private helpers.
  • Each S5754 and S5655 issue is fixed, or, where the code is right, this story records the issue key and the reason, for the owner to mark in Sonar.
  • task validate passes.

Settled records, for the owner to mark in Sonar:

Key Where Verdict Reason
AaHtIFshtunqNZ1Frc1C auth/linking.py 50 (S5886) false positive dataclasses.replace returns its argument's type; pyright strict types the result as Principal
AaHW2efLUPDpoJKGF_V7 commons/runtime/actor.py 174 (S5754) won't fix _main hands a constructor's exception, KeyboardInterrupt and SystemExit included, to the waiting caller; re-raising would kill the actor thread and leave the caller waiting
AaHW2efLUPDpoJKGF_V8 commons/runtime/actor.py 198 (S5754) won't fix _serve delivers a job's exception to its future, for the same reason
AaFFMR_GALak1_rdMGrw data/excel.py 284 (S5655) false positive the openpyxl stub's Worksheet.add_table takes openpyxl.worksheet.table.Table, the class excel.py passes

Outcome: the other 16 issues are fixed in nine source files. The complexity fixes extract private helpers, and the next Sonar scan confirms they are at or below 15.