feat: PostListItem에 user_has_saved 계약 + 카드 소비 (#840)#872
Draft
thxforall wants to merge 2 commits into
Draft
Conversation
카드 저장상태 정합용 `user_has_saved: Option<bool>` 를 PostListItem(utoipa)에
추가하고, list_posts 에서 viewer_id 있을 때만 saved_posts 배치 조회(IN 1쿼리,
N+1 회피)로 채운다. 게스트/admin 목록은 None. openapi.json 재생성(dump_openapi).
- saved_posts::service::saved_post_ids_for_user 신규(post_ids IN + user 필터)
- 시맨틱=PostDetailResponse.user_has_saved 동일(null=게스트/미계산, bool=서버진실)
- TDD: list_posts_user_has_saved_{true_when_viewer_saved,none_for_guest} GREEN
- 공유캐시 공개 피드(홈)엔 per-user 못 실음 → authed/uncached 리스트(#852)용
⚠️ 로컬 컴파일=`--ignore-rust-version` 우회(repo rustc 1.91 핀 vs aws-sdk 1.94.1
MSRV, Cargo.lock gitignore) — Rust는 philippe 정본 빌드/리뷰 필요.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
SaveLookButton 에 initialSaved prop 추가 → 리스트 모델의 user_has_saved 로 카드 초기 저장상태를 seed. HomeLookCard.userHasSaved + toLookCard 배선. 공유캐시 공개 홈 피드엔 값이 없어(viewer_id 없음) 미저장 fallback — 홈 카드 저장상태 반영은 client-hydration 후속(#840). 무회귀. - FE seam 테스트: SaveLookButton initialSaved → 렌더/aria 정합 (3 GREEN) - generated 클라이언트(gitignore)는 generate:api 로만 갱신(수동편집 없음) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What & why
user_has_saved필드를PostListItemAPI 계약(utoipa)에 추가한다 (PRD #825, map #789). 카드 저장상태가 서버 진실과 일치하도록 하는 contract-first 슬라이스 — Rust 계약+population은 kiyori 작성, philippe 정본 빌드/리뷰.PostListItem.user_has_saved: Option<bool>(utoipa).list_posts가viewer_id있을 때만saved_posts배치 조회(IN 1쿼리, N+1 회피)로 채움. 게스트/admin 목록은None. 시맨틱=기존PostDetailResponse.user_has_saved와 동일(null=게스트/미계산, bool=서버진실).dump_openapi) →generate:api로 FE 클라이언트에 필드 전파(생성물 gitignore, 수동편집 없음).SaveLookButton에initialSavedprop → 리스트 모델의user_has_saved로 카드 초기 저장상태 seed.HomeLookCard.userHasSaved+toLookCard배선.홈 룩 카드(
SaveLookButton의 주 서식지)는 공유캐시(revalidate:60) + 비인증(serverApiGet이 쿠키/토큰 미전달) 피드로 렌더된다. 따라서 per-useruser_has_saved는 홈 캐시드 응답에 실을 수 없다(항상 None이거나 유저간 누출).→ 이 필드의 실제 near-term 소비처는 authed·uncached Library(#852, blocked-by #840). 홈 카드의 저장상태 반영은 **client-side hydration(별도 후속)**이 필요하며, 이 PR은 계약+population+최소 소비배선까지만 담고 홈 갭을 코드 주석 4곳에 명시했다(
dto.rs필드doc,SaveLookButton.tsx,types.ts,page.tsx). 무회귀 — 홈 카드는 오늘과 동일하게 미저장 fallback + optimistic.Acceptance (#840)
user_has_saved가 OpenAPI(utoipa) 계약에 명시 → 재생성 클라이언트 소비generate:api로만 갱신(gitignore, 수동편집 없음)Verification
list_posts_user_has_saved_{true_when_viewer_saved, none_for_guest}— viewer→Some(bool)/ 게스트→None. 기존list_posts테스트 전부 무회귀.SaveLookButtoninitialSaved→렌더/aria.rust-toolchain.toml)인데 현재 aws-sdk 의존성이 1.94.1 MSRV를 요구 +Cargo.lockgitignore라 fresh resolve 시 최신 aws-sdk를 끌어와cargo check가 MSRV 게이트에서 실패한다. 로컬 검증은--ignore-rust-version로 우회(코드는 1.91 호환, 게이트만 우회) — philippe 정본 빌드 검증 필요. 이 툴체인 vs dep 불일치는 별도 인프라 이슈.tests::architecture::files_should_not_exceed_line_budget(dto.rs 836>800, 변경 전부터) ·domain_dependencies_match_allowed_list(새 도메인 엣지 없음, posts→saved_posts는 기존 import) ·all_handlers_registered_in_openapi(핸들러 0 추가) ·tests/integration_feed.rs(사전 E0061 시그니처 불일치) · grpc 테스트(라이브서버 필요).AGENT.md §1라인카운트 bump은 dev의 자체 README 유지(2 커밋)와 충돌하여 이 PR에서 제외.Base =
dev. Closes #840.