Repository navigation
fix: term_custom 삭제를 지정한 레이어로 제한 (#261) - #262
Merged
seyoung4503 merged 1 commit intoNov 22, 2026
Merged
seyoung4503 merged 1 commit into
seyoung4503 merged 1 commit into
Conversation
삭제 전에 레이어와 권한을 검증하고 실제 삭제 범위를 응답과 감사 로그에 기록한다. 레이어를 생략한 직접 호출의 동작은 호환을 위해 유지한다. Refs CausalInferenceLab#261
seyoung4503
approved these changes
Nov 22, 2026
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Number
요약(Summary)
layer:user로 개인 정의를 삭제할 때 같은 용어의 팀 정의까지 지워져 팀원들이 공용 정의를 조회할 수 없던 문제를 수정했습니다.term_custom도구는layer가 전달되면 삭제 전에 범위와 권한을 검증하고, 해당 레이어의 정의만 삭제합니다.layer:user예시를 추가했습니다.To Reviewers (선택)
수정 전 동작과 영향
재무팀은
revenue의 팀 정의를 환불 포함으로 공유하고, 민지는 본인에게만 적용할 환불 제외 정의를 추가합니다. 민지가 팀 기준으로 돌아가려고 Discord에서layer:user로 개인 정의를 삭제하면, 수정 전에는 삭제 성공 응답과 함께 팀 정의도 사라졌습니다.Discord 핸들러는 선택된
layer를 공통 도구에 전달했습니다. 공통 도구의 삭제 분기는 레이어를 검증하기 전에 실행됐고, 요청한 레이어 값과 관계없이 전사, 현재 채널, 본인 순으로 해당 용어의 키를 확인해 발견한 정의를 삭제했습니다. 일반 사용자는 팀과 개인 정의에 영향을 줬고, 관리자가 같은 요청을 보냈을 때는 전사 정의도 삭제 대상이었습니다. Discord 핸들러 · 수정 전 삭제 분기수정 후 삭제 흐름
flowchart TD A["term_custom 삭제 요청"] --> B{"layer 키가 있나요?"} B -->|지정| C{"레이어와 권한이 유효한가요?"} C -->|예| D["지정 레이어의 키 하나 선택"] C -->|아니요| E["검증 오류 반환"] B -->|생략| F["호출자에게 허용된 기존 삭제 범위 선택"] D --> G["선택한 키를 SQLite에서 삭제"] F --> G G --> H{"삭제된 행이 있나요?"} H -->|예| I["삭제된 범위로 응답하고 감사 로그 기록"] H -->|아니요| J["정의 없음 또는 관리자 권한 안내"]user는 요청자 본인,team은 현재 채널,org는 현재 조직의 전사 정의를 대상으로 합니다.team에는 채널 컨텍스트가 필요하고org삭제에는 관리자 권한이 필요합니다.SqliteStore.kv_delete()는 실제 행을 삭제했는지 반환하므로, 같은 요청을 다시 보냈을 때 행이 이미 없으면 해당 범위에 정의가 없다고 응답합니다.layer생략 시의 호환 동작layer를 생략하면team을 전달합니다. 삭제 대상은 현재 채널의 팀 정의입니다.layer키를 생략하면, 같은 용어의 현재 채널 정의와 요청자 본인의 정의를 삭제합니다. 관리자에게는 현재 조직의 전사 정의도 포함됩니다. #261의 하위 호환 계획에 따라 기존 동작을 유지했습니다.PR Checklist
layer생략 호환 동작을 테스트했습니다.pytest166개 테스트가 통과했습니다.git diff --check를 통과했습니다.