[datagsm] 학생 이벤트가 학번으로 사용자를 조회하도록 수정#99
Conversation
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)로 정정
There was a problem hiding this comment.
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.
문제
student.updated이벤트를 수신해도 사용자 정보가 갱신되지 않고 조용히 유실됩니다.예외가 발생하지 않고 200을 반환하기 때문에 DataGSM 쪽에서는 성공으로 보입니다.
DataGSM 페이로드에는
student_id(내부 PK)와student_number(학번)가 함께 전달됩니다.{ "student_id": 127, "student_number": 3404, "dormitory_room": 412 }그런데 기존 코드는 후보 필드를 순서대로 조회해
student_id(127)를 먼저 선택했습니다.반면
users.student_id컬럼에는 회원가입 시점부터 학번이 저장됩니다(
UserRegistrationSupport가student.getStudentNumber()를 사용). 따라서findByStudentId("127")은 매번 빗나가고,ifPresentOrElse의 else 분기로 빠져로그만 남긴 채 변경 사항이 사라집니다.
참고로 DataGSM SDK의
Student모델에는studentId필드 자체가 없습니다.내부 PK는
id, 학번은studentNumber입니다.변경 사항
조회 후보에서
student_id와studentId를 제거하고student_number만 사용합니다.폴백으로 남겨두면 동일하게 잘못된 값을 우선 선택하므로 후보에서 완전히 제외했습니다.
extractText에 이미 숫자 처리 분기가 있어3404(숫자)도"3404"로 변환됩니다.테스트
기존 테스트는
student_id를 학번으로 가정한 픽스처를 사용해 이 버그를 통과시켰습니다.픽스처를 실제 페이로드 형태로 정정하고 회귀 테스트를 추가했습니다.
student_id(127)와student_number(3404)가 함께 오는 실제 페이로드로findByStudentId("3404")호출 및 호실 갱신(411 → 412) 검증회귀 테스트가 수정 전 코드에서 실패하는 것을 먼저 확인했습니다
(
PotentialStubbingProblem: 코드가"127"로 조회). 전체 354개 테스트 통과.