Skip to content

feat(ask): persist public-claim envelopes for Global Ask verification - #679

Draft
seonghobae wants to merge 31 commits into
mainfrom
feat/public-claim-envelope-v2220
Draft

feat(ask): persist public-claim envelopes for Global Ask verification#679
seonghobae wants to merge 31 commits into
mainfrom
feat/public-claim-envelope-v2220

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Issue #272 remaining slice: a typed, persisted, egress-eligible public-claim envelope is the owning admission contract for Global Ask external verification (ADR 0224).

Until this envelope exists, the honest product state is unavailable, not a search query invented from question tokens.

Buyer-visible contract

  • After make seed, Ask Agent can opt into Verify public claims on the web.
  • The Demo public post envelope sits above the answer; a click opens that post.
  • Web verification is unavailable when SearXNG is unset.
  • Closed kinds only: organization presence, public event, public relationship.
  • Person, Keyman, TEPP, and fast-mlsirm kinds cannot be stored.
  • External URLs stay on external_evidence_urls and never enter cited_post_ids.
  • Organization-presence distinctive-token footprint can read Supported (ADR 0005 / FEVER presence subset).
  • Other polarity stays unavailable. This repository does not force mode="verify" (ADR 0076).

Independent of

#672, #668, #657, #640. Do not squash-mix those stacks into this PR.

Tests

  • tests/test_public_claim_verification.py
  • queue loader / search-client / opt-in forwarding in tests/test_global_ask_queue.py
  • schema trigger + lookup contract in tests/test_schema.py (skipped without Postgres)
  • frontend PublicClaimList + Ask Agent checkbox + i18n required shared labels

Independent APPROVE required. Do not self-approve.


Open in Devin Review

Summary by CodeRabbit

  • 새로운 기능
    • Ask Agent에서 선택적으로 공개 웹 검증을 요청할 수 있습니다.
    • 승인된 공개 주장만 검증하며, 조직·공개 이벤트·관계 정보를 지원합니다.
    • 검증 결과에 상태, 관련 게시물, 외부 근거 링크를 표시합니다.
    • 검증 근거와 내부 게시물 인용을 명확히 분리합니다.
  • 개선 사항
    • 검색 불가 또는 근거 부족 상태를 안내합니다.
    • 공개 주장 목록과 관련 메시지를 다국어로 제공합니다.
  • 버그 수정
    • 비공개 정보와 부적격 주장이 외부 검증으로 전송되지 않도록 제한했습니다.

Issue #272 / ADR 0224. Admit only typed, egress-eligible public claims.
Opt-in verify_external. Never force mode=verify. External URLs stay off
cited_post_ids.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 58 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8201aaae-5fd0-44eb-bd28-819aa85dc041

📥 Commits

Reviewing files that changed from the base of the PR and between 866c46d and 135dfe7.

⛔ Files ignored due to path filters (2)
  • docs/screenshots/public-claim-aggregate-desktop.png is excluded by !**/*.png
  • docs/screenshots/public-claim-aggregate-mobile.png is excluded by !**/*.png
📒 Files selected for processing (21)
  • CHANGELOG.d/2.22.0-public-claim-envelope.md
  • backend/app/global_ask_queue.py
  • backend/tests/test_api.py
  • docs/adr/0229-public-claim-envelope.md
  • docs/storybook-inventory.md
  • frontend/src/App.css
  • frontend/src/App.test.tsx
  • frontend/src/App.tsx
  • frontend/src/AskAgentCutoff.stories.tsx
  • frontend/src/AskAgentPanel.test.tsx
  • frontend/src/components/PublicClaimList.test.tsx
  • frontend/src/components/PublicClaimList.tsx
  • frontend/src/i18n.test.ts
  • frontend/src/i18n.ts
  • lineageweave/public_claim_verification.py
  • migrations/0224_public_claim_envelope.sql
  • migrations/rollback/0224_public_claim_envelope.sql
  • tests/test_global_ask_queue.py
  • tests/test_migration_replay.py
  • tests/test_public_claim_verification.py
  • tests/test_schema.py
📝 Walkthrough

Walkthrough

Global Ask가 verify_external 선택 시 영속 public_claim_envelope만 검색하도록 변경되었습니다. 공개 URL은 내부 게시물 인용과 분리됩니다. Ask Agent는 새 검증 계약과 PublicClaimList UI를 사용합니다.

Changes

공개 주장 검증

Layer / File(s) Summary
주장 계약과 저장 구조
migrations/0224_public_claim_envelope.sql, migrations/rollback/..., scripts/seed_demo_data.py, docs/adr/*
허용된 공개 주장 종류와 검증 상태를 등록했습니다. 공개 게시물에 연결된 egress 적격 봉투 테이블과 트리거를 추가했습니다.
공개 주장 검색과 판정
lineageweave/public_claim_verification.py, tests/test_public_claim_verification.py
SearXNG 결과에서 허용된 공개 URL만 반환합니다. 검색 불가, 정보 부족, 지원됨 상태를 생성합니다. 외부 URL의 내부 인용 ID 사용을 거부합니다.
Global Ask 실행 경로 통합
backend/app/global_ask_queue.py, backend/app/main.py, backend/app/post_chat_ingestion.py, tests/test_global_ask_queue.py, backend/tests/test_api.py
기존 claim verification 의존성을 제거했습니다. verify_external 요청에서 권한 있는 봉투를 조회하고 검증 결과를 응답에 추가합니다. 워커 전달 경로와 안전한 오류 메시지를 갱신했습니다.
Ask Agent 계약과 공개 주장 UI
frontend/src/api.ts, frontend/src/App.tsx, frontend/src/components/PublicClaimList.tsx, frontend/src/i18n.ts, frontend/src/*test*
응답 계약을 public_claim_verification으로 변경했습니다. 공개 주장, 원본 게시물, 상태, 외부 근거 URL을 표시합니다. 지원됨, 검색 불가, 빈 목록 상태와 다국어 라벨을 추가했습니다.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: 🟠 High · up to 866c4

The change can persist unsupported claim kinds, expose ineligible post content through public verification, and fail against the seeded database because the new schema migration is not applied. Merge should wait for these correctness, data-contract, and test-environment issues to be fixed.

Sequence Diagram(s)

sequenceDiagram
  participant AskAgent
  participant GlobalAsk
  participant PostgreSQL
  participant SearXNG
  participant PublicClaimList
  AskAgent->>GlobalAsk: verify_external=true 요청
  GlobalAsk->>PostgreSQL: 승인된 public_claim_envelope 조회
  GlobalAsk->>SearXNG: claim text로 공개 URL 검색
  SearXNG-->>GlobalAsk: 정제된 외부 증거 URL 반환
  GlobalAsk-->>AskAgent: public_claim_verification 응답
  AskAgent->>PublicClaimList: claims와 증거 URL 렌더링
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 91 functions across 21 files. (13 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 Global Ask 검증을 위한 영속 public-claim envelope 저장이라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 48.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 91 functions across 21 files. (13 skipped: 13 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/public-claim-envelope-v2220

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

Exact head d09884369ed3e51d3f9850b1c39cc4365c745619 on feat/public-claim-envelope-v2220.

Independent APPROVE required at this exact head. Not self-approving. Do not wait on Checks to request that review. Independent of #672 / #668 / #657 / #640.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 00:46
@seonghobae

Copy link
Copy Markdown
Contributor Author

Fixed at exact head 640e530c: opt-in public-claim verification now runs through asyncio.to_thread in both empty-source and non-empty-source paths, so synchronous SearXNG calls cannot block the async Ask worker. Focused verification passed 24 tests (tests/test_global_ask_queue.py, tests/test_public_claim_verification.py). The separate next-action localization finding remains open for follow-up.

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 00:59
@seonghobae

Copy link
Copy Markdown
Contributor Author

Current exact head 194f5a3f includes the locale-aware public-claim next-action rendering (ee5eb25f), preserves verification guidance in the no-source path, and constructs the public-claim search client only when verification is opted in. Focused queue/claim tests pass 24/24. The ABAC re-check remains deliberate defense-in-depth at the trust boundary.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Reviewed and repaired at exact head 7e6e386a. Mixed public-claim verdicts now choose the next action matching the aggregate status instead of the first verdict. The empty-source path retains its source-availability action while verification remains a separate payload. The missing-table handling follows the established fail-closed worker convention and does not fabricate data. Focused verification passed: 16 tests.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

github-code-quality[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

github-advanced-security[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 12:04
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 12:15
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

github-advanced-security[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 13:46
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 14:05
devin-ai-integration[bot]

This comment was marked as resolved.

github-advanced-security[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 15:12
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 15:57
@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 16:18
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 16:19
@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 16:27
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 16:37
devin-ai-integration[bot]

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants