Skip to content

feat(ask): per-post Ask history stack with gap-baseline refresh - #667

Open
seonghobae wants to merge 263 commits into
mainfrom
chore/refresh-gap-baseline-20260826
Open

feat(ask): per-post Ask history stack with gap-baseline refresh#667
seonghobae wants to merge 263 commits into
mainfrom
chore/refresh-gap-baseline-20260826

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR is not docs-only despite the original title. It is a stack-composition branch carrying:

  • docs(gaps): refreshes docs/product-technical-gap-baseline.md against protected main@494b54e2 and records the exact-head queue (aggregate, non-identifying evidence only)
  • feat(ask): per-post Ask conversation history — ADR 0235, migration 0223, GET/POST conversation endpoints, ChatPanel continuation UI with localized loading states, authorization re-checked per turn
  • fix(ui): cancelled analysis-run next-action guidance, responsive analysis grid stacking, non-empty action column
  • docs(adr): decomposition of ADR 0133–0137 into current records
  • Contract amendment: _require_lineage_create_kind_require_requestable_run_kind so POST /api/analysis-runs accepts Pending TEPP/topic-lineage requests (amends ADR 0017/0022 + AGENTS.md)

Verification

  • uv run --extra dev --extra backend pytest -q tests/test_documentation_hygiene.py tests/test_public_docstrings.py
  • Storybook scenes for the cancelled-run and Ask-history states; screenshots are synthetic-fixture renders only

This change contains aggregate, non-identifying evidence only. Committed screenshots use synthetic fixtures.

Summary by CodeRabbit

  • 새 기능
    • 게시물별 Ask 대화 기록을 저장하고, 이전 대화 선택·추가 로드·새 대화 시작을 지원합니다.
    • 외부 주장 검증과 지식 기준일을 설정하고, 근거·제한·원문 변경 정보를 확인할 수 있습니다.
    • 실패한 측정 및 토픽 계보 분석을 기존 기록 보존 상태에서 다시 실행할 수 있습니다.
  • 개선 사항
    • 분석 상태 안내와 다음 작업 문구를 다국어로 제공합니다.
    • 모바일 화면에서 분석 목록과 채팅 제어 영역이 더 읽기 쉽게 표시됩니다.
    • 취소·실패 분석에 유형별 후속 조치를 안내합니다.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

분석 실행 요청과 실패 재시도, 게시물별 Ask 대화 기록, Global Ask 검증, 온톨로지 공개 정책, 가속기 런타임 경계 및 관련 문서·테스트가 갱신되었습니다.

Changes

게시물 Ask 기능

Layer / File(s) Summary
대화 저장소와 API
migrations/0223_post_ask_conversation_history.sql, backend/app/main.py, backend/app/post_ask_history.py, frontend/src/api.ts, tests/test_post_ask_history.py
게시물별 대화·턴·출처·인용 저장소와 목록·상세 조회 API를 추가했습니다. 권한, 커서, 증거 변경 및 삭제된 대화 복구를 처리합니다.
대화 UI와 비동기 응답 처리
frontend/src/App.tsx, frontend/src/ChatPanel.test.tsx, frontend/src/ChatPanel.stories.tsx, frontend/src/i18n.ts
대화 선택, 새 대화, 추가 로드, 이전 턴 로드 및 오래된 응답 무시를 추가했습니다. 관련 번역과 Storybook 검증을 추가했습니다.
Global Ask 검증과 지식 기준일
backend/app/main.py, backend/app/global_ask_queue.py, frontend/src/App.tsx, frontend/src/api.ts, backend/tests/test_api.py
외부 주장 검증과 지식 기준일 입력·응답을 연결했습니다. 주장 근거, 제한사항 및 보존된 원문 정보를 표시합니다.

분석 실행 요청과 재시도

Layer / File(s) Summary
분석 실행 계약과 시작 경로
backend/app/analysis_run_ingestion.py, backend/app/main.py, tests/test_analysis_run_create.py, backend/tests/test_api.py, docs/adr/0017-authorized-analysis-run-create.md, docs/adr/0022-authorized-tepp-start.md, docs/adr/0132-tepp-topic-lineage-consumption-boundary.md
lineage·TEPP·topic-lineage 요청을 Pending으로 허용했습니다. 실행 범위 식별자를 저장하고 start·outbox·tepp_client 경로를 사용하도록 문서와 테스트를 갱신했습니다.
분석 안내와 국제화
frontend/src/App.tsx, frontend/src/analysisRunI18n.ts, frontend/src/AnalysisRunGuidance.stories.tsx, frontend/src/App.test.tsx, frontend/src/analysisRunI18n.test.ts
실행 종류별 상태 안내와 재시도 문구를 다국어로 통합했습니다. 실패한 TEPP·topic-lineage 실행은 새 current-snapshot 실행으로 재시도합니다.
화면 배치와 표시 스타일
frontend/src/App.css
분석 실행 목록, 채팅 기록 제어, Ask 입력 폼 및 온톨로지 노드 스타일을 갱신했습니다.

온톨로지와 런타임 경계

Layer / File(s) Summary
온톨로지 공개 정책
docs/adr/0207-repository-case-ontology-namespace-canonical.md, docs/adr/0236-legacy-ontology-namespace-publication.md, docs/doctoring/ONTOLOGY_NAMESPACE_INVENTORY.md
repository-case 네임스페이스와 namespace-compatibility.ttl 매핑 문서를 공개 대상으로 구분했습니다. lowercase 경로는 404로 기록했습니다.
가속기 서비스 경계
ARCHITECTURE.md, docs/adr/0237-accelerator-runtime-service-boundary.md, docs/adr/README.md
MLX·CUDA·OpenCL 및 과학 계산 런타임을 외부 소유 서비스 계약으로 분리했습니다. Compose는 장치 예약과 내부 대체 계산을 수행하지 않습니다.

제품 기술 기준선

Layer / File(s) Summary
요구사항, 기준선 및 운영 증거
docs/product-requirements.md, docs/product-technical-gap-baseline.md, docs/operability/http-concurrency-evidence.md, CHANGELOG.md, AGENTS.md, CLAUDE.md
제품 요구사항, PR·병합 기준선, 운영 증거, 분석 실행 정책 및 관련 추적 문서를 최신 상태로 갱신했습니다.
ADR 인덱스와 문서 위생
docs/adr/README.md, docs/adr/0050-seed-period-report-analysis-run.md, docs/adr/0222-project-nodes-in-ontology-neighborhood.md, docs/adr/0230-pnpm-build-script-allowlist.md, docs/adr/0231-external-lineage-arithmetic-authority.md, tests/test_documentation_hygiene.py
ADR 연결과 번호를 갱신했습니다. 문서의 후행 공백과 레거시 참조를 정리했습니다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Merge Risk: 🟡 Moderate · up to bc399

The PR adds per-post Ask history and related API/UI behavior. A current correctness risk remains in public-source verification: malformed or empty verification results could either fail an Ask request or mark verification complete without cited sources, so this handling should be fixed or explicitly accepted before merge. A smaller ADR contract clarification is also still needed.

Sequence Diagram(s)

sequenceDiagram
  participant Analyst
  participant AnalysisUI
  participant AnalysisAPI
  participant Outbox
  participant tepp_client
  Analyst->>AnalysisUI: Retry measurement 선택
  AnalysisUI->>AnalysisAPI: 새 current-snapshot 실행 생성
  AnalysisAPI-->>AnalysisUI: Pending 실행과 기업 범위 반환
  AnalysisAPI->>Outbox: 시작 작업 기록
  Outbox->>tepp_client: 측정 제출
Loading
sequenceDiagram
  participant AskAgentPanel
  participant GlobalAskAPI
  participant submit_global_ask
  participant ExternalClaimVerifier
  AskAgentPanel->>GlobalAskAPI: 질문과 검증 옵션 전송
  GlobalAskAPI->>submit_global_ask: 비동기 작업 제출
  submit_global_ask->>ExternalClaimVerifier: 공개 주장 검증 요청
  ExternalClaimVerifier-->>AskAgentPanel: 주장·근거·제한사항 반환
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.82% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 88 functions across 21 files. (23 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 PR 제목은 게시물별 Ask 대화 기록 구현과 gap-baseline 갱신이라는 주요 변경 사항을 정확히 요약합니다. 간결하고 구체적입니다.
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 56.82% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 88 functions across 21 files. (23 skipped: 23 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 chore/refresh-gap-baseline-20260826

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@seonghobae

Copy link
Copy Markdown
Contributor Author

Baseline refresh is based on protected main@7e9030c9a8ee2684e680c63013b304b435ba646e and records 11 current open exact heads plus #660 protected delivery. Focused documentation/public-docstring tests: 7 passed. The current API reports a stale/unknown base SHA and CONFLICTING; no merge claim until GitHub recomputes exact-head mergeability and required independent review.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Protected main advanced through #659 to 494b54e2245040bcf02b45376f221c37cd437e76. Refreshed the baseline again with the current 11-PR queue and recorded #659 as protected delivery. New exact head: 294d4c61; documentation/public-docstring tests: 7 passed. Fresh hosted checks and independent review remain required.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae enabled auto-merge August 25, 2026 22:17
@seonghobae

Copy link
Copy Markdown
Contributor Author

Refreshed the baseline again from concurrent exact heads (89df50a3) and recorded current queue heads including #629 0138db5f, #632 4e3c6272, #639 8da485d3, #640 dd134e77, #663 d3bb9348. New exact head: 425de329; documentation/public-docstring tests: 7 passed.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Refreshed the baseline at 07:32 KST with current exact heads, including #629 UUID tie-order repair, #657/#658 timestamp/TEPP review resolutions, #663 MCP admission hardening, and concurrent #632 movement. New exact head: e353d376; documentation/public-docstring tests: 7 passed.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Revalidated at exact head 3bf57fed: refreshed the queue inventory for #667 and #640 (361641ec), and ran uv run --extra dev --extra backend pytest -q tests/test_public_docstrings.py in a clean detached worktree: 2 passed. Hosted required checks remain queued; no merge action is authorized until terminal same-head checks and independent approvals are present.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Revalidated exact head ecdfdba after adding PR #668 and refreshing #668/#667 heads in the gap baseline. Clean detached-worktree public-docstring tests: 2 passed. All sampled/current PR Checks show no failures; required hosted checks remain queued.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Fixed the snapshot inconsistency at exact head ef95d32: the section 1 narrative and protected-release gap row now both report 12 open PRs, matching the 12-row inventory. No identifying data was added.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Updated the PR description from 11-PR to 12-PR queue, matching the exact-head inventory and current open-PR count. Resolved the corresponding review thread.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Reconciled the live issue queue at exact head 7bd9b84: section 4 now lists the 10 currently open issues from GitHub, including #611, and removes closed issues from the live table.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Removed dangling references to closed issues #274, #336, and #358 from the active issue/gap sections. Historical implementation context remains labeled as historical, while the live table stays limited to the 10 currently open issues.

Codex added 2 commits August 26, 2026 08:14
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

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

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 17:27
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 17:46
coderabbitai[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 18:52
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 19:35

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +79 to +87
and (
$3 is null
or $4 is null
or session.updated_at < $3
or (session.updated_at = $3 and session.post_ask_session_id < $4)
)
group by session.post_ask_session_id, session.updated_at
order by session.updated_at desc, session.post_ask_session_id desc
limit $5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Keyset pagination on a mutable sort key can drop conversations

list_conversations keysets on session.updated_at (backend/app/post_ask_history.py:79-87), but persist_turn sets updated_at=now() on every new turn. A conversation bumped after the page-1 cursor is captured moves above the cursor and never appears on a later Load more page. appendUniqueConversations dedups but cannot recover an omitted row, so a concurrently-updated conversation can vanish from the list until reload.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 20:14

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread backend/app/main.py
Comment on lines +3050 to +3065
except PostAskConversationNotFound as exc:
if recover_deleted_conversation and conversation_id is not None:
return await _persist_post_ask_turn(
conn,
account,
post_id,
None,
question,
answer_text,
source_post_ids,
cited_post_ids,
)
raise HTTPException(
status.HTTP_404_NOT_FOUND,
"This conversation is no longer available. Choose another conversation or start a new one.",
) from exc

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Deleted-conversation recovery re-runs source reauthorization

The recovery recursion in _persist_post_ask_turn passes conversation_id=None, so no second PostAskConversationNotFound is possible and dropping recover_deleted_conversation is safe. It does re-run _ensure_sources_visible, taking share locks a second time in one request; harmless but duplicated.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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