Skip to content

refactor(server): code quality and consistency audit#825

Merged
FelixTJDietrich merged 11 commits intoreact-flow-achievementsfrom
code-quality-consistency-audit
Mar 11, 2026
Merged

refactor(server): code quality and consistency audit#825
FelixTJDietrich merged 11 commits intoreact-flow-achievementsfrom
code-quality-consistency-audit

Conversation

@FelixTJDietrich
Copy link
Copy Markdown
Collaborator

Summary

  • Address 100+ findings from principal-engineer code review
  • CRITICAL: Add @Transactional to recalculateUserInternal(), handle optimistic lock exceptions
  • HIGH: Remove dead methods from AchievementService, AchievementRegistry, UserAchievementRepository
  • HIGH: Fix registry duplicate bug (deduplicated map values instead of raw records)
  • MAJOR: Remove unused controller parameters, fix @PositiveOrZero@Positive on LinearAchievementProgress.target
  • Fix inline styles→Tailwind in all story decorators, CSS lint violations
  • Fix diamond league color typo, division-by-zero guards, non-null assertions→nullish coalescing
  • Consistent @/ alias imports, exported prop interfaces, proper type guards
  • Biome lint clean: sorted imports, removed unused vars, accessibility fixes

How to Test

  • CI covers this (lint, type-check, build, tests)
  • Verify backend compiles: cd server/application-server && ./mvnw compile
  • Verify frontend compiles: cd webapp && npx tsc --noEmit

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>
@FelixTJDietrich FelixTJDietrich requested a review from a team as a code owner March 10, 2026 18:53
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 10, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c710efed-bbf4-4b68-9131-7bb8095a069f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch code-quality-consistency-audit

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added application-server Spring Boot server: APIs, business logic, database dependencies Package updates, version bumps, lock file changes webapp React app: UI components, routes, state management size:XXL This PR changes 1000+ lines, ignoring generated files. refactor Code restructuring without changing behavior labels Mar 10, 2026
FelixTJDietrich and others added 7 commits March 11, 2026 11:18
…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>
…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",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getUser is annotated with @nonnull and therefore there is no nullcheck necessary here.

}

@Transactional
private void recalculateUserInternal(User user) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Transactional methods must be overridable. Will change it to protected.

)
@CacheEvict(
value = ACHIEVEMENT_PROGRESS_CACHE,
key = "#event.user().isPresent() ? #event.user().get().getId() : 0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pogressData.current cannot be undefined as it is always a number.

@FelixTJDietrich FelixTJDietrich merged commit c700048 into react-flow-achievements Mar 11, 2026
30 of 36 checks passed
@FelixTJDietrich FelixTJDietrich deleted the code-quality-consistency-audit branch March 11, 2026 12:15
@github-actions
Copy link
Copy Markdown
Contributor

📚 Documentation Preview

Preview has been removed (PR closed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

application-server Spring Boot server: APIs, business logic, database dependencies Package updates, version bumps, lock file changes refactor Code restructuring without changing behavior size:XXL This PR changes 1000+ lines, ignoring generated files. webapp React app: UI components, routes, state management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants