test: guard the disclosure a delegation is required to point at - #276
Merged
Conversation
disclosure_policy_document_id is NOT NULL, so this document is not decoration: when the policy code resolves to nothing, delegation does not degrade, it stops. Both ways that has already happened this week are now pinned. Publishing v2 with a future published_at retired v1 while v2 was not yet selectable and left the code with zero current documents; every grant failed. Publishing the disclosure as is_required put it in the set every account must consent to before it can finish authenticating, blocking login for customers who never delegate anything. Neither is visible in the migration file under review, and the first was only caught because unrelated grant tests happened to read the document. The remaining two assertions cover drift rather than outage: the stored hash must still describe the stored text, and the disclosure must still say the tool can build the strategy itself. A disclosure that quietly narrows while the capability widens is the one failure this document exists to prevent. Refs #479 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
후속: Idea2Strategy/Idea2Strategy#479
왜 필요한가
identity.delegated_authorizations.disclosure_policy_document_id는 NOT NULL 이다. 즉 이 문서가없으면 위임 기능이 조용히 저하되는 게 아니라 완전히 멈춘다. 그런데 "이 정책 코드에는 항상
유효한 문서가 정확히 하나 있다" 를 검사하는 곳이 없었다.
이번 주에 그 상태를 두 번 만들었다.
모든 위임 발급이 실패했다. CI 가 잡았지만, 그건 무관한 발급 테스트가 우연히 그 문서를 읽었기
때문이지 이 불변조건을 검사해서가 아니다.
is_required = true로 발행 — 모든 계정이 인증을 마치려면 동의해야 하는 집합에 들어가위임을 쓰지 않는 사용자의 로그인까지 막았다.
둘 다 리뷰 중인 마이그레이션 파일만 봐서는 보이지 않는다. 이 테스트에서는 보인다.
무엇을 고정하는가
is_required가 절대 참이 아님content_hash가content_text와 일치마지막 항목이 이 문서의 존재 이유다. 위임 범위가 커질 때 고지가 따라가지 않으면, 사용자는 자기가
허용한 것보다 넓은 권한을 준 것이 된다.
검증
:modules:backend-persistence:test --tests '*DelegationDisclosurePolicyMigration*'통과.가드가 실제로 깨지는지도 확인했다 — v2 의
published_at을 미래로 옮기면 유효 문서 수가1 → 0으로 떨어지고, 되돌리면 다시 1이 된다.🤖 Generated with Claude Code