Skip to content

Conversation

@jimmy0006
Copy link

@jimmy0006 jimmy0006 commented Sep 26, 2025

πŸ“• Issue Number

Close #

πŸ“™ μž‘μ—… λ‚΄μ—­

κ΅¬ν˜„ λ‚΄μš© 및 μž‘μ—… ν–ˆλ˜ λ‚΄μ—­

  • μž‘μ—… λ‚΄μ—­ 1
  • μž‘μ—… λ‚΄μ—­ 2
  • μž‘μ—… λ‚΄μ—­ 3
  • μž‘μ—… λ‚΄μ—­ 4

πŸ“˜ μž‘μ—… μœ ν˜•

  • μ‹ κ·œ κΈ°λŠ₯ μΆ”κ°€
  • 버그 μˆ˜μ •
  • λ¦¬νŽ™ν† λ§
  • λ¬Έμ„œ μ—…λ°μ΄νŠΈ

πŸ“‹ 체크리슀트

  • Merge ν•˜λŠ” λΈŒλžœμΉ˜κ°€ μ˜¬λ°”λ₯Έκ°€?
  • μ½”λ”©μ»¨λ²€μ…˜μ„ μ€€μˆ˜ν•˜λŠ”κ°€?
  • PRκ³Ό κ΄€λ ¨μ—†λŠ” 변경사항이 μ—†λŠ”κ°€?
  • λ‚΄ μ½”λ“œμ— λŒ€ν•œ 자기 κ²€ν† κ°€ λ˜μ—ˆλŠ”κ°€?
  • 변경사항이 νš¨κ³Όμ μ΄κ±°λ‚˜ λ™μž‘μ΄ μž‘λ™ν•œλ‹€λŠ” 것을 λ³΄μ¦ν•˜λŠ” ν…ŒμŠ€νŠΈλ₯Ό μΆ”κ°€ν•˜μ˜€λŠ”κ°€?
  • μƒˆλ‘œμš΄ ν…ŒμŠ€νŠΈμ™€ 기쑴의 ν…ŒμŠ€νŠΈκ°€ 변경사항에 λŒ€ν•΄ λ§Œμ‘±ν•˜λŠ”κ°€?

πŸ“ PR 특이 사항

PR을 λ³Ό λ•Œ 주의깊게 λ΄μ•Όν•˜κ±°λ‚˜ λ§ν•˜κ³  싢은 점

  • 특이 사항 1
  • 특이 사항 2



Summary by CodeRabbit

  • New Features

    • Added an authenticated endpoint to retrieve your Kubernetes key (/kubernetes/me).
  • Refactor

    • Active members now return richer member objects (UUID and login ID) instead of plain strings.
    • Kubernetes key lookups now use member UUID for consistent retrieval.

@coderabbitai
Copy link

coderabbitai bot commented Sep 26, 2025

Walkthrough

Adds GET /kubernetes/me returning the caller's Kubernetes key by authenticated Member UUID; replaces active member lists of Strings with ActiveMemberDto; adds GetMyKubernetesKeyResponseDto; updates repository/service queries and signatures to use UUID-based key lookup.

Changes

Cohort / File(s) Change Summary
Controller: new endpoint
src/main/java/org/poolc/api/kubernetes/controller/KubernetesController.java
Adds GET /kubernetes/me endpoint using @AuthenticationPrincipal Member to call service by UUID and return GetMyKubernetesKeyResponseDto; imports added.
DTOs: additions and type change
src/main/java/org/poolc/api/kubernetes/dto/ActiveMemberDto.java, src/main/java/org/poolc/api/kubernetes/dto/GetMyKubernetesKeyResponseDto.java, src/main/java/org/poolc/api/kubernetes/dto/GetKubernetesResponseDto.java
Adds ActiveMemberDto interface. Adds GetMyKubernetesKeyResponseDto with immutable key and @JsonCreator constructor. Changes GetKubernetesResponseDto.activeMembers from List<String> β†’ List<ActiveMemberDto> and updates constructor.
Repository: query and signature updates
src/main/java/org/poolc/api/kubernetes/repository/KubernetesRepository.java
findAllActiveMembers() now returns List<ActiveMemberDto> and query selects member_uuid and login_id. Renames findKubernetesKeyByUserId β†’ findKubernetesKeyByUUID and changes query to filter by UUID.
Service: API refactor
src/main/java/org/poolc/api/kubernetes/service/KubernetesService.java
getAllActiveMembers now returns List<ActiveMemberDto>. Renames getKubernetesKeyByUserId β†’ getKubernetesKeyByUUID, uses repository UUID lookup and adjusts not-found message.
Minor whitespace
src/main/java/org/poolc/api/comment/controller/CommentController.java
Adds a trailing blank line; no functional change.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant K8sController
  participant K8sService
  participant K8sRepository
  participant Database

  Note over Client,K8sController: GET /kubernetes/me (authenticated)
  Client->>K8sController: HTTP GET (Member principal)
  K8sController->>K8sService: getKubernetesKeyByUUID(member.getUUID())
  K8sService->>K8sRepository: findKubernetesKeyByUUID(UUID)
  K8sRepository->>Database: SELECT kubernetes_key WHERE member_uuid=UUID
  Database-->>K8sRepository: Optional<String> (key or empty)
  alt key found
    K8sRepository-->>K8sService: key
    K8sService-->>K8sController: key
    K8sController-->>Client: 200 + GetMyKubernetesKeyResponseDto{key}
  else not found
    K8sRepository-->>K8sService: empty
    K8sService-->>K8sController: throw IllegalArgumentException / NotFound
    K8sController-->>Client: 404 / error response
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Dev to ProdΒ #13 β€” touches the same Kubernetes controller/service/repository and DTO surfaces; likely overlaps the UUID-based key lookup and new endpoint.

Poem

I nibble at UUIDs beneath the clover,
DTO carrots lined up, one after other.
A gentle /me fetches my secret key,
I hop back to the repo, happy as can be.
Thump! the CI sings β€” all green for me. πŸ‡πŸ”‘

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title β€œDev” is too vague and does not convey any specific information about the main changes in the pull request, making it unclear to reviewers what functionality or files are being added or modified. Please update the title to clearly summarize the primary change, for example β€œAdd authenticated GET /me endpoint and update Kubernetes DTOs and service methods” so that the purpose of the PR is immediately clear.
βœ… Passed checks (1 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • πŸ“ Generate Docstrings
πŸ§ͺ Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

πŸ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 6e98699 and 3b3beca.

πŸ“’ Files selected for processing (2)
  • src/main/java/org/poolc/api/kubernetes/controller/KubernetesController.java (2 hunks)
  • src/main/java/org/poolc/api/kubernetes/service/KubernetesService.java (3 hunks)
πŸ”‡ Additional comments (3)
src/main/java/org/poolc/api/kubernetes/controller/KubernetesController.java (1)

38-49: Robust handling for /kubernetes/me.

Line 40’s null guard cleanly turns anonymous access into a 401, and the try/catch on Lines 43-49 maps the missing-key path to a 404 instead of leaking an exception. This aligns with the earlier compliance feedbackβ€”thanks for tightening it up.

src/main/java/org/poolc/api/kubernetes/service/KubernetesService.java (2)

23-28: Projection swap for active members looks right.

Returning the repository’s List<ActiveMemberDto> (Lines 23-28) matches the DTO change upstream while preserving the existing API-key guard. No issues here.


47-49: Clean not-found signaling.

The Optional lookup on Lines 47-49 now throws a sanitized IllegalArgumentException, which the controller translates to a 404. This keeps sensitive data out of logs while delivering a sensible client response.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between d8d61e1 and 2f69832.

πŸ“’ Files selected for processing (6)
  • src/main/java/org/poolc/api/kubernetes/controller/KubernetesController.java (2 hunks)
  • src/main/java/org/poolc/api/kubernetes/dto/ActiveMemberDto.java (1 hunks)
  • src/main/java/org/poolc/api/kubernetes/dto/GetKubernetesResponseDto.java (1 hunks)
  • src/main/java/org/poolc/api/kubernetes/dto/GetMyKubernetesKeyResponseDto.java (1 hunks)
  • src/main/java/org/poolc/api/kubernetes/repository/KubernetesRepository.java (2 hunks)
  • src/main/java/org/poolc/api/kubernetes/service/KubernetesService.java (3 hunks)
πŸ”‡ Additional comments (2)
src/main/java/org/poolc/api/kubernetes/dto/ActiveMemberDto.java (1)

3-6: Projection interface fits the JPA projection use case well.

The minimal interface with accessor methods keeps the projection lightweight and should plug straight into the repository layer.

src/main/java/org/poolc/api/kubernetes/dto/GetKubernetesResponseDto.java (1)

10-14: Confirm downstream consumers handle the new payload shape.

activeMembers used to be a List<String>; it is now a list of objects. Please double-check that any clients (web/app/automation) parsing this endpoint have been updated so we don’t break them at deploy time.

Comment on lines +3 to +14
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

@Getter
public class GetMyKubernetesKeyResponseDto {

private final String key;

@JsonCreator
public GetMyKubernetesKeyResponseDto(String key){
this.key = key;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard Jackson constructor binding with @JsonProperty.

With @JsonCreator on a single-arg constructor, Jackson switches to delegating mode unless the argument is explicitly named. Without @JsonProperty("key"), ObjectMapper.readValue("{\"key\":\"value\"}", GetMyKubernetesKeyResponseDto.class) will throw InvalidDefinitionException (unless we happen to register ParameterNamesModule everywhere). Please annotate the parameter (and add the import) to keep deserialization safe.

-import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
@@
-    @JsonCreator
-    public GetMyKubernetesKeyResponseDto(String key){
+    @JsonCreator
+    public GetMyKubernetesKeyResponseDto(@JsonProperty("key") String key){
         this.key = key;
     }
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;
@Getter
public class GetMyKubernetesKeyResponseDto {
private final String key;
@JsonCreator
public GetMyKubernetesKeyResponseDto(String key){
this.key = key;
}
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
@Getter
public class GetMyKubernetesKeyResponseDto {
private final String key;
@JsonCreator
public GetMyKubernetesKeyResponseDto(@JsonProperty("key") String key) {
this.key = key;
}
}
πŸ€– Prompt for AI Agents
In src/main/java/org/poolc/api/kubernetes/dto/GetMyKubernetesKeyResponseDto.java
around lines 3 to 14, the @JsonCreator single-arg constructor is not guarded
with @JsonProperty, which causes Jackson to use delegating mode and fail
deserialization unless ParameterNamesModule is registered; add the import for
com.fasterxml.jackson.annotation.JsonProperty and annotate the constructor
parameter with @JsonProperty("key") so Jackson can bind the "key" JSON property
to the constructor parameter during deserialization.

Comment on lines +16 to +31
@Query(value = "SELECT DISTINCT T2.MEMBER_UUID\n" +
" , (SELECT login_id" +
" FROM MEMBER T1" +
" WHERE T1.UUID = T2.MEMBER_UUID)\n" +
"FROM ROLES T2\n" +
"WHERE T2.MEMBER_UUID IN (\n" +
" SELECT MEMBER_UUID\n" +
" FROM ROLES\n" +
" WHERE ROLES = 'MEMBER'\n" +
")\n" +
"AND MEMBER_UUID NOT IN (\n" +
"AND T2.MEMBER_UUID NOT IN (\n" +
" SELECT MEMBER_UUID\n" +
" FROM ROLES\n" +
" WHERE ROLES = 'INACTIVE'\n" +
")", nativeQuery = true)
List<String> findAllActiveMembers();
List<ActiveMemberDto> findAllActiveMembers();
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | πŸ”΄ Critical

Alias the selected columns for ActiveMemberDto projection

Line 17 currently returns the login ID via a scalar subquery without an alias. In Postgres (and most RDBMSs) that yields a ?column? heading, so Spring can’t map it onto the ActiveMemberDto getters and you’ll hit an IllegalArgumentException at runtime. Please alias both selected columns to match the DTO contract (and consider replacing the subquery with a join for clarity). For example:

-    @Query(value = "SELECT DISTINCT T2.MEMBER_UUID\n" +
-            "   , (SELECT login_id" +
-            "       FROM MEMBER T1" +
-            "       WHERE T1.UUID = T2.MEMBER_UUID)\n" +
+    @Query(value = "SELECT DISTINCT T2.MEMBER_UUID AS memberUuid\n" +
+            "   , (SELECT login_id" +
+            "       FROM MEMBER T1" +
+            "       WHERE T1.UUID = T2.MEMBER_UUID) AS loginId\n" +
             "FROM ROLES T2\n" +
             "WHERE T2.MEMBER_UUID IN (\n" +
             "    SELECT MEMBER_UUID\n" +
             "    FROM ROLES\n" +
             "    WHERE ROLES = 'MEMBER'\n" +
             ")\n" +
             "AND T2.MEMBER_UUID NOT IN (\n" +
             "    SELECT MEMBER_UUID\n" +
             "    FROM ROLES\n" +
             "    WHERE ROLES = 'INACTIVE'\n" +
             ")", nativeQuery = true)
πŸ€– Prompt for AI Agents
In src/main/java/org/poolc/api/kubernetes/repository/KubernetesRepository.java
around lines 16 to 31, the native query selects MEMBER_UUID and a scalar
subquery for login_id without aliases which prevents Spring from mapping the
result to ActiveMemberDto; modify the SELECT to alias both columns to the DTO
property names (e.g., memberUuid or member_uuid and loginId or login_id matching
ActiveMemberDto getters/constructor) so the projection maps correctly, and
optionally replace the scalar subquery with an equivalent JOIN to MEMBER for
clarity and performance.

Comment on lines +38 to +39
@Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :UUID")
Optional<String> findKubernetesKeyByUUID(String UUID);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | πŸ”΄ Critical

Restore nativeQuery = true (and bind the UUID properly)

Line 38 is still raw SQL against kubernetes_mappings, but the @Query annotation no longer sets nativeQuery = true, so Spring will parse it as JPQL and blow up at runtime. Please reinstate the native flag and bind the parameter explicitly:

-    @Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :UUID")
-    Optional<String> findKubernetesKeyByUUID(String UUID);
+    @Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :uuid", nativeQuery = true)
+    Optional<String> findKubernetesKeyByUUID(@Param("uuid") String uuid);
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :UUID")
Optional<String> findKubernetesKeyByUUID(String UUID);
@Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :uuid", nativeQuery = true)
Optional<String> findKubernetesKeyByUUID(@Param("uuid") String uuid);
πŸ€– Prompt for AI Agents
In src/main/java/org/poolc/api/kubernetes/repository/KubernetesRepository.java
around lines 38-39, the @Query is raw SQL but missing nativeQuery = true and the
UUID parameter isn't explicitly bound; restore nativeQuery = true on the @Query
and bind the parameter by annotating the method parameter with @Param("UUID")
(or change the placeholder and param name consistently) so the native SQL runs
correctly.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 2f69832 and 6e98699.

πŸ“’ Files selected for processing (3)
  • src/main/java/org/poolc/api/comment/controller/CommentController.java (1 hunks)
  • src/main/java/org/poolc/api/kubernetes/controller/KubernetesController.java (2 hunks)
  • src/main/java/org/poolc/api/kubernetes/service/KubernetesService.java (3 hunks)
πŸ”‡ Additional comments (1)
src/main/java/org/poolc/api/comment/controller/CommentController.java (1)

57-58: LGTM on the whitespace tweak.

No functional impact; formatting stays consistent.

@jimmy0006 jimmy0006 merged commit ac09d70 into master Sep 26, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants