refactor(server): code quality and consistency audit#825
refactor(server): code quality and consistency audit#825FelixTJDietrich merged 11 commits intoreact-flow-achievementsfrom
Conversation
Address 100+ findings from review: - Add @transactional to recalculation - Handle optimistic lock exceptions - Remove dead methods and queries - Fix registry duplicate bug - Fix division-by-zero guards - Fix diamond league color typo - Biome lint and accessibility fixes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
…llApi The achievement package declares @NonNullApi, making all params/returns non-null by default. Remove 5 defensive null checks that are unreachable under this contract: - AchievementService: drop `condition = "#user != null"` from @Cacheable and the `if (user == null)` guard in getAllAchievementsWithProgress - AchievementRecalculationService: drop `condition = "#user != null"` from @CacheEvict and the workspace null check (workspace has @NotNull + nullable = false on JoinColumn) - DummyEvaluator: drop user null ternary (UserAchievement.user has @NotNull + nullable = false) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…audit Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix Java formatting in OpenAPIConfiguration.java (Prettier) - Fix Biome import ordering in AchievementNode.tsx and SkillTreeDesigner.tsx - Remove duplicate isHidden property in openapi.yaml (merge artifact) - Regenerate TypeScript API client types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… achievement services
…into code-quality-consistency-audit
…oller Reverts @validated, @notblank, and @PathVariable removal that changed the generated OpenAPI spec. Keeps non-spec improvements (LoggingUtils, formatting). Cannot regenerate openapi.yaml locally without Docker/DB. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Prettier auto-formatted AchievementController.java method signatures - Reverted openapi.yaml to base branch version (4bd2419) since all spec-affecting Java changes were already reverted in the previous commit Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| userAchievement.getAchievementId(), | ||
| userAchievement.getUser().getLogin(), | ||
| event.eventType()); | ||
| user != null ? LoggingUtils.sanitizeForLog(user.getLogin()) : "unknown", |
There was a problem hiding this comment.
getUser is annotated with @nonnull and therefore there is no nullcheck necessary here.
| } | ||
|
|
||
| @Transactional | ||
| private void recalculateUserInternal(User user) { |
There was a problem hiding this comment.
@Transactional methods must be overridable. Will change it to protected.
| ) | ||
| @CacheEvict( | ||
| value = ACHIEVEMENT_PROGRESS_CACHE, | ||
| key = "#event.user().isPresent() ? #event.user().get().getId() : 0", |
There was a problem hiding this comment.
Double null check is unnecessary since condition ensures user is present. Also mapping to id 0 is not good practise since that id could be another user in the database.
| switch (progressData.type) { | ||
| case "LinearAchievementProgress": { | ||
| // Logic for Counter Achievements (e.g., 5/10 PRs) | ||
| const current = progressData.current ?? 0; |
There was a problem hiding this comment.
pogressData.current cannot be undefined as it is always a number.
…into code-quality-consistency-audit
c700048
into
react-flow-achievements
📚 Documentation Preview
|
Summary
@TransactionaltorecalculateUserInternal(), handle optimistic lock exceptionsAchievementService,AchievementRegistry,UserAchievementRepository@PositiveOrZero→@PositiveonLinearAchievementProgress.target@/alias imports, exported prop interfaces, proper type guardsHow to Test
cd server/application-server && ./mvnw compilecd webapp && npx tsc --noEmit