cleanup(legibility): rename Helper/Utils/Manager violators to express intent #414
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Context
Part of Epic #411 — Cleanup. This is CLEANUP-3: act on C4.3 findings — file/class names that use generic suffixes (
Helper,Utils,Manager,Handlerwithout modifier) where a more specific name would tell the reader what the thing does.Per the Legibility Rubric, this addresses C4.3 (Minor) — but accumulated naming sloppiness is a strong AI-smell signal.
Inputs
Method
For each offender:
Utils.formatPersonName()→PersonNameFormatter.format()or move method to the class it operates ongit mv+ grep)Known cases (from requirements-phase research, not exhaustive)
Backend:
SecurityUtils.getCurrentUserId()— likely OK to keep asSecurityUtils(genuine utility, not a misnomer)PersonNameParser— already a good name (class-noun + verb)DisplayNameFormatter— already a good namePolygonConverter— already a good name*Helperwe find should be reviewedFrontend:
lib/utils/*— these are genuine utility modules. The folder structure is the concern, not the name. C4.3 mostly applies to the JS side via class-like exports.Acceptance criteria
*Helper,*Utils.java,*Manager,*Handlerfiles have been classified (rename / justify / defer)Dependency
Soft dependency on Epic 4 refactor — easier after files are in domain packages.
Definition of Done
PR merged. Closing comment lists each rename in
OldName → NewNameform.🏗️ Markus Keller — Senior Application Architect
Observations
Two confirmed naming violators exist in the backend. The frontend
utils/folder is not a violator — it's already purpose-decomposed into single-responsibility modules (date.ts,personFormat.ts,sanitize.ts, etc.), which is the ideal outcome.SecurityUtils— the issue correctly flags this as "likely OK to keep." Looking at the actual class: it's afinalclass with a private constructor and a single static methodrequireUserId(). The "utility" wrapper exists because the SpringAuthenticationobject can't be tested cleanly when it's injected directly into services. The name accurately describes what this is: a security utility that has no better domain home. Justified. No rename needed.GlobalExceptionHandler— this is actually a legitimate edge case. Spring's@RestControllerAdvicemechanism requires a class that handles exceptions globally — the "Handler" suffix is load-bearing vocabulary from the framework. Compare:AuthenticationEntryPoint,AccessDeniedHandler— Spring's own naming uses "Handler" for cross-cutting concerns. The alternative name would beGlobalExceptionResolverorApiErrorHandler, neither of which is more expressive. Justified. No rename needed.RateLimitInterceptor— this oneimplements HandlerInterceptor(a Spring interface), so "Interceptor" is the correct suffix for the pattern. Not a violator — it follows Spring's naming convention exactly.Recommendations
OldName → OldName (justified: reason)format the DoD requires.SecurityUtils — likely OK to keep) is correct; the same reasoning applies toGlobalExceptionHandler.SecurityUtils's location (security/flat package) more natural assecurity/AuthenticationResolveror similar. But that's a separate issue, not this one.lib/utils.tsre-exportsisoToGerman/germanToIsofromlib/utils/date.ts. That barrel export is fine — the underlying file is well-named.Open Decisions (omit this section entirely if none)
None. Both violators are defensible under the issue's own classification criteria.
👨💻 Felix Brandt — Senior Fullstack Developer
Observations
Ran the exact grep commands from the issue. The actual offender list is lean:
Backend (
*.java):SecurityUtils—finalclass, private constructor, one method:requireUserId(Authentication, UserService). This name correctly categorizes a cross-cutting security helper with no domain home. The method name itself reveals full intent. Justified.GlobalExceptionHandler— annotated@RestControllerAdvice. "Handler" is Spring's own vocabulary for this pattern. Renaming toGlobalExceptionResolvergains nothing in clarity. Justified.RateLimitInterceptor— implements Spring'sHandlerInterceptorinterface. "Interceptor" suffix is framework-idiomatic. Not a violator.Frontend (
src/):Zero hits. The
lib/utils/folder is already properly decomposed:date.ts,personFormat.ts,sanitize.ts,debounce.ts,mention.ts, etc. Every file has a single responsibility and a name that reveals it. The top-levellib/utils.tsis a one-line barrel re-export — not a naming concern.Recommendations
SecurityUtils, add a one-liner:// Cross-cutting auth helper; no domain home — "Utils" is correct here.GlobalExceptionHandler, add:// "Handler" is Spring @RestControllerAdvice convention — not a generic suffix.SecurityUtilsTestexists and has 4 tests covering null auth, unauthenticated, user-not-found, and happy path. That's solid coverage for a 13-line class. No new tests needed unless the class grows.SecurityUtils → SecurityUtils (justified: cross-cutting auth utility, no domain owner)andGlobalExceptionHandler → GlobalExceptionHandler (justified: Spring @RestControllerAdvice convention).No open decisions — both classifications are clear from the code.
🔒 Nora "NullX" Steiner — Application Security Engineer
Observations
Reviewed both naming violators through a security lens.
SecurityUtils.requireUserId()— the static method pattern here deserves a security read independent of the naming question. The method is called in three controllers (DocumentController,TranscriptionBlockController,DashboardController). It validates thatauthentication != null,isAuthenticated() == true, and that the user exists in the database. Thenullguard andisAuthenticated()check are both correct — a SpringAuthenticationobject in the context can be non-null but still represent an anonymous user.One security-relevant observation:
findByEmail()returnsnullfor unknown users, and the code guards withif (user == null) throw DomainException.unauthorized(...). This is correct fail-closed behavior. However,findByEmail()returningnullrather thanOptional<AppUser>is a smell — a future maintainer might accidentally miss the null check. This is worth a low-priority note but not a blocker for this issue.GlobalExceptionHandler— thehandleGeneric(Exception ex)catch-all logsexvia SLF4J parameterized logging (log.error("Unhandled exception", ex)) which is correct. The response body returns only"An unexpected error occurred"— no stack trace leakage. Error codes are from theErrorCodeenum, not raw exception messages. Clean.RateLimitInterceptor— this class has a well-documented comment explaining the X-Forwarded-For trust model. The trusted proxy check correctly limits to loopback, RFC-1918 ranges (with the 172.16/12 range correctly implemented). This is security-relevant naming: "Interceptor" correctly signals that it runs on every request. Renaming would obscure this.Recommendations
Optional<AppUser>return type fromfindByEmail()to make the null check more idiomatic and compiler-enforced. That's aPersonService/UserServicecleanup, separate from this issue.SecurityUtilstest covers thenulluser path. Good. No regression risk from this cleanup issue.No open decisions.
🧪 Sara Holt — QA Engineer & Test Strategist
Observations
This is a classification issue, not a feature issue, so the test strategy is minimal. Here's what exists and what the risk profile looks like:
SecurityUtils—SecurityUtilsTestexists with 4@ExtendWith(MockitoExtension.class)tests covering all branches of the method. This is the right layer (pure Mockito, no Spring context). If the class were renamed, the test file would need to follow. Since the classification is "Justified / no rename", there's no test work.GlobalExceptionHandler— I searched for aGlobalExceptionHandlerTestand found none. The handler is@RestControllerAdviceand is effectively integration-tested via any@WebMvcTestslice that exercises the error paths. But there's no dedicated test proving each@ExceptionHandlermethod maps to the expected HTTP status and response structure. This is a gap independent of this naming issue.RateLimitInterceptor— no test file found. Rate limiting logic is moderately complex (Caffeine cache, X-Forwarded-For trust chain). The trusted-proxy logic with the172.16/12boundary check is the kind of thing that breaks silently under edge cases. This is also independent of the naming issue.Recommendations
GlobalExceptionHandlerTest— a@WebMvcTestslice verifying thatDomainException,MethodArgumentNotValidException, and the generic handler each produce the correct HTTP status andErrorResponsebody.RateLimitInterceptorTest— unit tests forresolveClientIp()covering: direct connection, trusted-proxy forwarded, untrusted-proxy ignored, and the 172.16–172.31 boundary.No open decisions.
🎨 Leonie Voss — UX Designer & Accessibility Strategist
Observations
This is a backend/developer-experience issue with no direct UI impact. No frontend components are being renamed, no user-visible strings or labels are involved, and no Svelte files are in scope.
I checked the frontend
lib/utils/folder since it was listed in the issue inputs. What I found: 24 purpose-specific files (date.ts,personFormat.ts,mention.ts,sanitize.ts, etc.), each with a corresponding*.spec.ts. This is a healthy state — the utils folder is already doing what C4.3 asks for. No component naming violations found.Recommendations
*Utils*files that get renamed or moved, flag the corresponding i18n keys and translation files to ensure no string keys rely on the old class/module path. In this case, none do.No concerns from my angle on the UX/accessibility side — the frontend naming is already expressive and domain-oriented.
⚙️ Tobias Wendt — DevOps & Platform Engineer
Observations
This is a pure source-code refactor with no infrastructure, CI pipeline, or Docker Compose impact. Running the grep commands from the issue confirms the scope is two Java files and the frontend
utils/folder. No build scripts, Dockerfiles, environment variables, or deployment configs are in scope.A few things I did check:
SecurityUtilsis imported in 3 controllers andGlobalExceptionHandleris in the controller package, any rename would produce a clean compile cycle. No CI pipeline changes needed.SecurityUtilsTestexists and runs in the unit test phase. The test is pure Mockito — no Testcontainers, no Spring context, no Docker dependency. Fast and reliable.Recommendations
No concerns from the platform side.
📋 Elicit — Requirements Engineer
Observations
This issue is well-specified for a cleanup task. The Method, Known Cases, and Acceptance Criteria sections give an implementor everything needed to work through the list without ambiguity. The DoD format ("closing comment lists each rename in
OldName → NewNameform") is measurable and specific.A few requirement-quality notes:
Scope is clear and bounded. The grep commands are provided. The pre-classified list of Known Cases reduces research overhead. The "Defer" option in the method provides an escape valve for expensive renames — this prevents scope creep during execution.
The acceptance criterion "Audit re-run (CLEANUP-5) confirms C4.3 PASS" depends on an external issue. This is a cross-issue dependency that should be tracked. If CLEANUP-5 doesn't exist yet as a Gitea issue, it should be created before this issue is closed, or the acceptance criterion should be rephrased: "Audit re-run criteria are met (verified by implementor; CLEANUP-5 will confirm formally)."
"Not exhaustive" caveat is important. The Known Cases list says "not exhaustive" — this means the implementor must run the grep commands, not just work from the pre-classified list. The acceptance criterion "All
*Helper,*Utils.java,*Manager,*Handlerfiles have been classified" correctly captures this.Recommendations
*Utils.java(Java-specific suffix) but the grep command also covers frontend. Consider specifying whether the frontendlib/utils/directory structure is in scope for classification or explicitly out of scope. Based on the issue body ("The folder structure is the concern, not the name. C4.3 mostly applies to the JS side via class-like exports"), the folder is excluded — but the AC doesn't say this explicitly.GlobalExceptionHandler → GlobalExceptionHandler (justified: Spring @RestControllerAdvice naming convention)andSecurityUtils → SecurityUtils (justified: cross-cutting auth utility). This satisfies the DoD without requiring a rename.No open decisions.
CLEANUP-3 — Closing summary
Ran the full grep pass as specified in the issue. Results:
Backend (
*.java):SecurityUtils→SecurityUtilsGlobalExceptionHandler→GlobalExceptionHandler@RestControllerAdvicenaming conventionRateLimitInterceptorHandlerInterceptorinterfaceFrontend (
src/): Zero hits.lib/utils/is already purpose-decomposed into 24 single-responsibility modules (date.ts,personFormat.ts,sanitize.ts, etc.).No renames needed. Two one-line justification comments added to prevent future confusion.
Backend test suite: 1516 tests ✅
Implemented in commit
0fa90d58on branchfeat/issue-411-legibility-cleanup.