Skip to content

[datagsm] 학생 이벤트가 학번으로 사용자를 조회하도록 수정#99

Merged
hej090224 merged 2 commits into
team-washer:developfrom
ZaMan0806:fix/datagsm-student-number-lookup
Jul 15, 2026
Merged

[datagsm] 학생 이벤트가 학번으로 사용자를 조회하도록 수정#99
hej090224 merged 2 commits into
team-washer:developfrom
ZaMan0806:fix/datagsm-student-number-lookup

Conversation

@ZaMan0806

Copy link
Copy Markdown
Contributor

문제

student.updated 이벤트를 수신해도 사용자 정보가 갱신되지 않고 조용히 유실됩니다.
예외가 발생하지 않고 200을 반환하기 때문에 DataGSM 쪽에서는 성공으로 보입니다.

DataGSM 페이로드에는 student_id(내부 PK)와 student_number(학번)가 함께 전달됩니다.

{ "student_id": 127, "student_number": 3404, "dormitory_room": 412 }

그런데 기존 코드는 후보 필드를 순서대로 조회해 student_id(127)를 먼저 선택했습니다.

final var studentId = extractText(student, "student_id", "studentId", "student_number", "studentNumber");

반면 users.student_id 컬럼에는 회원가입 시점부터 학번이 저장됩니다
(UserRegistrationSupportstudent.getStudentNumber()를 사용). 따라서
findByStudentId("127")은 매번 빗나가고, ifPresentOrElse의 else 분기로 빠져
로그만 남긴 채 변경 사항이 사라집니다.

참고로 DataGSM SDK의 Student 모델에는 studentId 필드 자체가 없습니다.
내부 PK는 id, 학번은 studentNumber입니다.

변경 사항

조회 후보에서 student_idstudentId를 제거하고 student_number만 사용합니다.
폴백으로 남겨두면 동일하게 잘못된 값을 우선 선택하므로 후보에서 완전히 제외했습니다.

extractText에 이미 숫자 처리 분기가 있어 3404(숫자)도 "3404"로 변환됩니다.

테스트

기존 테스트는 student_id를 학번으로 가정한 픽스처를 사용해 이 버그를 통과시켰습니다.
픽스처를 실제 페이로드 형태로 정정하고 회귀 테스트를 추가했습니다.

  • student_id(127)와 student_number(3404)가 함께 오는 실제 페이로드로
    findByStudentId("3404") 호출 및 호실 갱신(411 → 412) 검증

회귀 테스트가 수정 전 코드에서 실패하는 것을 먼저 확인했습니다
(PotentialStubbingProblem: 코드가 "127"로 조회). 전체 354개 테스트 통과.

student.updated 이벤트 처리 시 DataGSM 내부 PK인 student_id를 학번으로
잘못 사용해 사용자를 찾지 못하고 갱신이 유실되던 문제를 수정합니다.

DataGSM 페이로드에는 student_id(내부 PK)와 student_number(학번)가 함께
전달되는데, 기존 코드는 후보 필드를 순서대로 조회해 student_id를 먼저
선택했습니다. 반면 users.student_id 컬럼에는 회원가입 시점부터 학번이
저장되므로(UserRegistrationSupport), 조회가 매번 빗나가 예외 없이 200을
반환한 채 변경 사항이 유실됐습니다.

조회 후보에서 student_id와 studentId를 제거합니다. 폴백으로 남겨두면
동일하게 잘못된 값을 우선 선택하므로 후보에서 완전히 제외했습니다.
기존 테스트는 student_id를 학번으로 가정한 픽스처를 사용해 조회 버그를
그대로 통과시켰습니다. 실제 페이로드 형태에 맞게 픽스처를 정정하고
회귀 테스트를 추가합니다.

- student_id(127)와 student_number(3404)가 함께 오는 실제 페이로드로
  학번 조회 및 호실 갱신을 검증
- 픽스처의 학번을 실제 형태(3404)로 정정

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the student event handling logic to extract and use the student number (student_number / studentNumber) instead of the internal database identifier (student_id / studentId) when processing DataGSM events. It also updates the corresponding unit tests to reflect this change and adds a new test case verifying that the service correctly prioritizes the student number when both fields are present in the payload. There are no review comments, so no additional feedback is provided.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@ZaMan0806 ZaMan0806 changed the title fix(datagsm): 학생 이벤트가 학번으로 사용자를 조회하도록 수정 [datagsm] 학생 이벤트가 학번으로 사용자를 조회하도록 수정 Jul 15, 2026
@ZaMan0806
ZaMan0806 changed the base branch from master to develop July 15, 2026 01:24
@hej090224
hej090224 merged commit 8da704f into team-washer:develop Jul 15, 2026
1 check passed
@hej090224 hej090224 mentioned this pull request Jul 15, 2026
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