fix(core,admin_basic,board,ecommerce,page,gdpr,verification): 설정 미러·자동 정리·탈퇴 원자성·일괄 선택 범위 정비

공개이슈 ··· 및 그 전수 해소분.

- 설정 저장·복원·초기화가 상주 프로세스 미러를 갱신하도록 단일 소유자화
- 만료 데이터 자동 정리 예약 12종 신설, 파기는 기본키 배치로 분할
- 회원 탈퇴를 전 경로 원자화하고 관리자 상태변경 경로를 정식 탈퇴로 통일
- 일괄 처리 목록의 선택을 화면에 보이는 행으로 한정(selectionScope)
- 비밀번호 정책 문구를 도메인 중립 라벨로 정정
- 정적 검사 2종·검증 스킬 설계 정합성 축 신설
This commit is contained in:
HeuJung committed 2026-08-14 11:06:25 +09:00
1 parent 49c155509e
commit 4e1ec6e001
136 files changed
+7016 -504

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
# audit:allow test-scenario-coverage reason: |
# cross product 자동 전개는 audit 실행 환경의 fallback YAML 파서가 nested axes 를 읽지 못해
# 검출되지 않는다(다른 시나리오와 동일 한계). 축 조합은 PHPUnit Feature 테스트
# (CoreScheduleRegistrationTest · DataRetentionCommandsTest)와 모듈 커맨드 테스트가
# 커버하고 green 이다.
feature: 만료 데이터 자동 정리 예약과 예약 시각 기준 (공개이슈 #110)
description: |
수명이 지난 데이터를 정리하는 예약 작업을 등록하고, 예약의 실행 시각 해석 기준을
사이트 설정 시간대로 통일한다.
배경:
- 만료 토큰 정리 커맨드는 있었지만 어디에도 예약되지 않아 행이 영구 누적됐다.
- 정리 코드는 있는데 호출자가 0건인 대상(임시 주문·SEO 통계·예약 이력·본인인증
challenge)이 있었고, 보존 정책이 아예 없는 대상(본인인증 이력·활동 로그·알림
발송 이력)도 있었다.
- `app.timezone` 이 UTC 이고 예약에 시간대 지정이 없어, '새벽 4시' 로 등록해도
한국 기준 낮에 실행됐다. 관리자가 화면에서 등록한 cron 도 같은 결함을 가졌다.
- 이 축의 회귀 테스트가 0건이라 결함군이 무가드로 통과됐다.
적용 지점:
- `routes/console.php` 의 만료 데이터 정리 구획 (일 1회 새벽 배치 + 시간별 1건).
- 신설 코어 커맨드 6종 + 이커머스 모듈 커맨드 1종.
- 시각 기준: 설정 반영부가 `app.schedule_timezone` 을 세팅해 Schedule 인스턴스
전체에 일괄 적용 (이벤트별 지정 방식은 누락이 생겨 채택하지 않음).
- 관리자 등록 예약: 다음 실행 시각 계산도 같은 기준.
axes:
target:
- sanctum_tokens
- password_reset_tokens
- failed_jobs
- job_batches
- notifications
- extension_bundles
- seo_cache_stats
- schedule_histories
- identity_challenges
- identity_logs
- activity_logs
- notification_logs
- ecommerce_temp_orders
row_age: [within_retention, beyond_retention]
schedule_axis: [code_registered, admin_registered]
timezone_setting: [configured, empty]
exclusions:
- { target: identity_challenges, row_age: beyond_retention, reason: "상태 전환만 수행하며 삭제하지 않음 — 만료 여부는 expires_at 이 판정" }
- { schedule_axis: admin_registered, target: sanctum_tokens, reason: "관리자 등록 축은 시각 기준만 검증 (대상별 동작은 코드 예약 축이 커버)" }
effects:
- all_gc_commands_are_registered_in_schedule
- gc_commands_run_on_one_server_only
- sanctum_prune_uses_hours_option
- rows_beyond_retention_are_deleted
- rows_within_retention_are_kept
- identity_challenges_transition_without_deletion
- schedule_timezone_follows_site_general_timezone
- schedule_timezone_falls_back_to_app_timezone_when_unset
- app_timezone_stays_utc
- admin_registered_schedule_next_run_uses_same_basis
- new_commands_are_in_schedule_security_allowlist
- new_commands_are_exposed_in_dev_dashboard
- automated_prune_emits_its_own_hooks
- retention_floor_is_owned_by_the_domain_layer
- large_purge_is_split_into_batches
test_files:
- tests/Feature/Console/CoreScheduleRegistrationTest.php
- tests/Feature/Console/DataRetentionCommandsTest.php
- tests/Unit/Repositories/DeletesInBatchesTest.php
- modules/_bundled/sirsoft-ecommerce/tests/Feature/Console/PruneExpiredTempOrdersCommandTest.php
rules_layer_coverage:
- rule: offset-chunk-mutates-filter
coverage: |
정리는 기본키 배치로 끊어 지운다 — OFFSET 이 개입하지 않으므로 커서가 밀려
미처리 행을 건너뛰는 결함이 성립하지 않는다. 매 회전이 같은 술어를 다시
평가하고, 직전 회전이 지운 만큼 모집단이 줄어든다.
- rule: console-confirm
coverage: 정리 커맨드는 확인 프롬프트가 없는 무인 실행 전용
@@ -0,0 +1,44 @@
feature: 일괄 처리 목록의 선택 범위 (DataGrid selectionScope)
description: |
체크박스 선택은 화면 밖(전역/로컬 상태)에 저장되므로, 검색·필터·페이지 이동으로 행이
목록에서 빠져도 선택은 남는다. 그 상태에서 일괄 처리를 누르면 운영자가 보고 있지도,
체크하지도 않은 행이 대상이 된다. 확인 창은 건수만 말하고 대상을 부르지 않으므로 실행
전에 알아챌 방법이 없고, 서버는 정상 처리하므로 오류도 남지 않는다.
수정: DataGrid 가 `selectionScope` 를 갖고, `"page"` 인 목록은 지금 그려진 행에 없는
선택을 버린다. 선택 자체가 저장 대상인 폼(쿠폰 적용 대상 고르기 등)은 `"free"` 로
종전 동작을 유지한다. 값은 소비 화면이 반드시 명시하며 정적 검사가 미선언을 차단한다.
범위: 저장소의 모든 소비 화면 16곳 (page 12 / free 4).
axes:
scope: [page, free]
transition: [search_filter_change, page_change, initial_mount]
exclusions:
- { scope: free, transition: page_change, reason: "free 는 정의상 어떤 전이에서도 선택을 건드리지 않는다 — 전이별 분해가 의미 없어 대표 1건(search_filter_change)으로 고정" }
- { scope: free, transition: initial_mount, reason: "동일" }
effects:
- hidden_row_selection_dropped
- visible_row_selection_survives
- selection_cleaned_even_when_selectable_off
- free_scope_leaves_selection_untouched
- no_callback_when_nothing_to_drop
- bulk_button_disabled_when_selection_empties
- bulk_request_carries_only_visible_checked_rows
test_files:
- templates/_bundled/sirsoft-admin_basic/src/components/composite/__tests__/DataGrid.test.tsx
- tests/Playwright/specs/admin/list-bulk-selection-scope.spec.ts
rules_layer_coverage:
- rule: layout-datagrid-selection-scope
coverage: |
소비 화면 전수(16곳)가 scope 를 명시했는지는 테스트가 아니라 룰이 증명한다 —
화면을 axis 로 두면 화면이 늘 때마다 테스트를 복제해야 하고, 정작 새로 생긴
화면의 누락은 잡히지 않는다. 룰은 onSelectionChange 가 배선된 DataGrid 전수에서
미선언·비허용값을 차단한다.
설계상 free 고정 화면: 쿠폰 적용 대상 선택기(여러 페이지에 걸쳐 고른다),
주문 상세 클레임 대상 선택기(선택이 곧 입력값).
+36
View File
@@ -25,15 +25,42 @@ axes:
- register
- reset_password
- change_password
- verify_password
- admin_create_user
- admin_update_user
- update_profile
min_length_setting: [default, raised, lowered]
special_char_setting: [required, not_required]
input_state: [satisfies_policy, violates_length, violates_special]
# 오류 문구의 :attribute 치환 라벨 축 (공개이슈 #113)
# 비밀번호 외 범용 키(ids)도 같은 결함군이라 함께 고정한다 —
# 전역 사전 하나를 도메인 문구로 덮으면 그 키를 쓰는 모든 화면이 오염된다.
attribute_label_scope: [generic_password, smtp_password, generic_ids, user_scoped_ids]
locale: [ko, en]
exclusions:
- { special_char_setting: not_required, input_state: violates_special, reason: "특수문자 미요구 설정에서는 위반 상태가 성립하지 않음" }
- { attribute_label_scope: smtp_password, entry_point: register, reason: "SMTP 라벨은 메일 설정 화면 전용 — 비밀번호를 정하는 경로에는 나타나지 않아야 한다" }
- { attribute_label_scope: smtp_password, entry_point: reset_password, reason: "동일" }
- { attribute_label_scope: smtp_password, entry_point: change_password, reason: "동일" }
- { attribute_label_scope: smtp_password, entry_point: admin_create_user, reason: "동일" }
- { attribute_label_scope: smtp_password, entry_point: admin_update_user, reason: "동일" }
- { attribute_label_scope: smtp_password, entry_point: update_profile, reason: "동일" }
- { attribute_label_scope: generic_ids, entry_point: register, reason: "ids 라벨은 목록 대상 일괄 처리 화면 전용 — 비밀번호를 정하는 경로에는 나타나지 않는다" }
- { attribute_label_scope: generic_ids, entry_point: reset_password, reason: "동일" }
- { attribute_label_scope: generic_ids, entry_point: change_password, reason: "동일" }
- { attribute_label_scope: generic_ids, entry_point: verify_password, reason: "동일" }
- { attribute_label_scope: generic_ids, entry_point: admin_create_user, reason: "동일" }
- { attribute_label_scope: generic_ids, entry_point: admin_update_user, reason: "동일" }
- { attribute_label_scope: generic_ids, entry_point: update_profile, reason: "동일" }
- { attribute_label_scope: user_scoped_ids, entry_point: register, reason: "동일" }
- { attribute_label_scope: user_scoped_ids, entry_point: reset_password, reason: "동일" }
- { attribute_label_scope: user_scoped_ids, entry_point: change_password, reason: "동일" }
- { attribute_label_scope: user_scoped_ids, entry_point: verify_password, reason: "동일" }
- { attribute_label_scope: user_scoped_ids, entry_point: admin_create_user, reason: "동일" }
- { attribute_label_scope: user_scoped_ids, entry_point: admin_update_user, reason: "동일" }
- { attribute_label_scope: user_scoped_ids, entry_point: update_profile, reason: "동일" }
- { attribute_label_scope: smtp_password, entry_point: verify_password, reason: "동일" }
effects:
- policy_rule_reads_min_length_from_settings
@@ -46,10 +73,19 @@ effects:
- empty_security_settings_fall_back_to_defaults
- saved_security_settings_are_visible_on_reload
- admin_screen_min_length_bounds_follow_settings_limits
# 라벨 축 (공개이슈 #113)
- policy_message_attribute_uses_generic_password_label
- smtp_label_never_appears_in_password_setting_paths
- smtp_screens_keep_their_domain_labels
- generic_labels_hold_in_every_locale
- bulk_status_screen_keeps_user_scoped_ids_label
- generic_ids_label_stays_generic_on_other_screens
- generic_attribute_keys_carry_no_domain_prefix
test_files:
- tests/Feature/Auth/PasswordPolicyTest.php
- tests/Feature/Settings/SettingsBoundaryContractTest.php
- tests/Feature/Validation/GlobalAttributeLabelTest.php
- templates/_bundled/sirsoft-admin_basic/__tests__/layouts/admin-settings-security-password-policy.test.ts
rules_layer_coverage:
@@ -0,0 +1,67 @@
# audit:allow test-scenario-coverage reason: |
# cross product 자동 전개는 audit 실행 환경의 fallback YAML 파서가 nested axes 를 읽지 못해
# 검출되지 않는다(다른 시나리오와 동일 한계). 축 조합은 PHPUnit Feature 테스트
# (SettingsConfigMirrorTest · PageSettingsMirrorTest · EcommerceSettingsMirrorTest)가
# 커버하고 green 이다.
feature: 설정 config 미러 재채움 (공개이슈 #109)
description: |
`g7_settings.*` in-memory 미러를 부팅뿐 아니라 저장 시점에도 다시 채워, 상주 프로세스가
옛 설정을 읽지 않게 한다.
배경:
- 미러는 부팅 때 한 번만 채워졌다. FPM 은 요청마다 부팅해 드러나지 않지만,
큐 워커·schedule:work·Reverb 는 프로세스가 상주해 저장 후에도 옛 값을 영원히 읽었다.
- 플러그인 미러는 setting.json 을 raw 로 읽어 defaults 병합·정규화가 빠지고
암호문이 그대로 실렸다 — 전용 게터와 값의 형태가 달랐다.
- sirsoft-page 는 설정 서비스 자체가 없어 미러가 영구 미존재였고, 소비자는 항상
인자 기본값으로 폴백했다 (기존 테스트가 config 직접 주입으로 우회해 미검출).
적용 지점:
- 채움 로직 단일 소유자 신설 — 부팅 Provider 와 저장 경로가 같은 코드를 호출한다.
- 코어: 설정 캐시 무효화 지점 (saveSettings / saveAdvancedSettings / setSetting 공통).
- 플러그인: 저장 성공 후 해당 플러그인만 재채움.
- 모듈: 코어 헬퍼를 각 모듈 서비스의 캐시 초기화 지점에서 호출.
- 민감 항목(`sensitive: true`)은 미러에서 키 자체를 제거 (암호문도 싣지 않음).
axes:
scope: [core, module, plugin]
trigger: [boot, save, cache_clear]
field_sensitivity: [normal, sensitive]
value_origin: [defaults_only, saved_override]
consumer: [mirror_helper, dedicated_getter]
exclusions:
- { scope: core, field_sensitivity: sensitive, reason: "코어 설정 카테고리에는 sensitive 스키마 선언이 없다" }
- { trigger: cache_clear, scope: core, reason: "코어는 캐시 무효화 자체가 저장 경로와 동일 지점" }
- { field_sensitivity: sensitive, consumer: mirror_helper, value_origin: defaults_only, reason: "미러에서 제거되므로 값의 출처와 무관" }
effects:
- core_mirror_refreshed_after_save
- core_mirror_refreshed_after_set_setting
- module_mirror_refreshed_after_save
- module_mirror_refreshed_after_cache_clear
- plugin_mirror_refreshed_after_save
- plugin_mirror_refreshed_after_reset
- core_mirror_refreshed_after_restore
- plugin_mirror_merges_defaults
- plugin_mirror_matches_dedicated_getter_shape
- sensitive_fields_absent_from_mirror_on_boot
- sensitive_fields_absent_from_mirror_on_refresh
- sensitive_fields_absent_from_mirror_after_save
- sensitive_fields_still_readable_via_dedicated_getter
- page_module_mirror_exists
- page_module_consumers_read_configured_values
- boot_and_save_share_one_fill_implementation
test_files:
- tests/Feature/Settings/SettingsConfigMirrorTest.php
- modules/_bundled/sirsoft-page/tests/Feature/PageSettingsMirrorTest.php
- modules/_bundled/sirsoft-ecommerce/tests/Feature/Services/EcommerceSettingsMirrorTest.php
rules_layer_coverage:
- rule: service-provider
coverage: 미러 채움은 DI 조기 해석 없이 지연 해석 (register 단계 안전)
- rule: settings_service_testing_path_isolation
coverage: 신설 페이지 설정 서비스도 testing 환경 저장 경로 격리 적용
@@ -0,0 +1,80 @@
# audit:allow test-scenario-coverage reason: |
# cross product 자동 전개는 audit 실행 환경의 fallback YAML 파서가 nested axes 를 읽지 못해
# 검출되지 않는다(다른 시나리오와 동일 한계). 축 조합은 PHPUnit Feature 테스트
# (WithdrawAtomicityTest · AdminWithdrawPathUnificationTest · MultiStepWriteAtomicityTest)와
# Vitest 레이아웃 테스트 · Playwright E2E 가 커버하고 green 이다.
feature: 회원 탈퇴 원자성 및 탈퇴 경로 통일 (공개이슈 #112)
description: |
회원 탈퇴가 전부 성공하거나 전부 취소되게 하고, 탈퇴에 이르는 모든 경로가
같은 처리를 받도록 통일한다.
배경:
- `withdrawUser()` 에 트랜잭션이 없어, 마지막 단계(익명화 저장)가 실패하면
약관 동의 이력·토큰·아바타는 이미 지워진 채 계정만 활성으로 남았다.
- 익명화 접미사가 날짜(`Ymd`)뿐이라, 같은 이메일로 재가입한 회원이 같은 날
다시 탈퇴하면 email unique 위반으로 500 이 났다.
- 접미사를 붙이면 컬럼 길이를 넘길 수 있어(이름·이메일·닉네임) 저장이 실패했다.
- 관리자의 상태 변경(단건·일괄)은 status 컬럼만 바꿔 익명화와 탈퇴 훅을 건너뛰었다.
- 관리자/수퍼관리자 탈퇴 차단이 500 으로 나갔다.
적용 지점:
- 모델: 멱등 가드 + 사용자 ID 를 포함한 유일 접미사 + 컬럼 길이 클램프
(길이 상한은 스키마 기본 길이에서 파생 — 리터럴 금지).
- 서비스: DB 변경은 트랜잭션, 파일 삭제와 after 훅은 커밋 후.
- 관리자 경로: `updateUser` / `bulkUpdateStatus` 의 탈퇴 전환은 `withdrawUser()` 위임.
- 화면: 관리자 회원 수정 폼의 '탈퇴' 저장은 확인 창을 거친다.
axes:
entry_point:
- self_withdraw_api
- admin_update_status
- admin_bulk_status
- admin_form_ui
target_account: [normal, admin, super_admin, already_withdrawn]
email_state: [unique, reused_same_day]
field_length: [within_limit, exceeds_limit]
failure_injection: [none, last_write_fails]
confirm_action: [not_applicable, cancel, submit]
exclusions:
- { entry_point: self_withdraw_api, confirm_action: cancel, reason: "본인 탈퇴 모달은 이번 변경 대상이 아님" }
- { entry_point: admin_bulk_status, confirm_action: cancel, reason: "일괄 탈퇴 확인 모달은 기존 구현 유지" }
- { target_account: already_withdrawn, failure_injection: last_write_fails, reason: "멱등 가드로 쓰기 자체가 발생하지 않음" }
effects:
- withdraw_is_atomic_all_or_nothing
- consents_and_tokens_restored_on_failure
- avatar_file_kept_on_failure
- avatar_file_removed_only_after_commit
- same_day_rewithdraw_with_same_email_succeeds
- suffix_includes_user_id_for_structural_uniqueness
- long_values_truncated_within_column_limits
- withdraw_is_idempotent
- admin_status_change_runs_full_withdrawal
- admin_status_change_fires_withdraw_hooks
- admin_status_change_is_atomic_with_profile_update
- bulk_status_withdraw_delegates_per_user
- bulk_status_reports_failed_count
- admin_account_withdraw_blocked_consistently
- blocked_withdraw_returns_422_not_500
- failed_withdraw_leaves_no_activity_log
- admin_form_shows_confirm_dialog_before_destructive_save
- admin_form_cancel_leaves_user_untouched
- admin_form_non_withdraw_status_saves_without_dialog
- create_mode_hides_withdrawn_option
test_files:
- tests/Feature/Api/Auth/WithdrawAtomicityTest.php
- tests/Feature/Services/AdminWithdrawPathUnificationTest.php
- tests/Feature/Services/MultiStepWriteAtomicityTest.php
- tests/Feature/Api/Auth/ProfileControllerTest.php
- templates/_bundled/sirsoft-admin_basic/__tests__/layouts/admin-user-form-withdraw-confirm.test.tsx
- tests/Playwright/specs/admin/user-form-withdraw-confirm.spec.ts
rules_layer_coverage:
- rule: service-direct-data-access
coverage: 탈퇴/삭제 경로는 Repository 인터페이스 경유 유지
- rule: i18n-throw-hardcoded-korean
coverage: 차단 문구는 lang/{ko,en}/user.php 의 withdraw_admin_forbidden 키