Skip to content

Add source-linked Data repository assets - #302

Merged
seonghobae merged 1 commit into
masterfrom
feature/data-source-surface-20260529
May 29, 2026
Merged

Add source-linked Data repository assets#302
seonghobae merged 1 commit into
masterfrom
feature/data-source-surface-20260529

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • Extend signed /api/data/quality-surface with repository_assets derived from scoped emails + attachments rows.
  • Render the Data document repository tab with source-linked file/attachment assets, opaque asset/thread keys, extraction/thread state, and provider_write_executed=false.
  • Update README, AGENTS, plan docs, frontend mocks, E2E fixtures, and PostgreSQL smoke coverage so static file-list fixtures do not re-enter copied examples.

Source and Safety Boundaries

  • No new DB tables or columns.
  • No provider writes; WebDAV remains intent-only.
  • No sequential attachment/email ids, raw message ids, raw thread ids, message bodies, provider URLs, usernames, or credentials are returned.
  • Browser calls continue to use stored naruon_session_token bearer sessions and omit public identity headers.

Subagent

  • Attempted to spawn a Data/WebDAV audit explorer, but the multi-agent service returned agent thread limit reached. I proceeded locally and kept the delegated scope documented.

Verification

  • PYTHONDONTWRITEBYTECODE=1 python3 -m pytest backend/tests/test_data_api.py -q -> 3 passed, 1 skipped
  • PYTHONDONTWRITEBYTECODE=1 python3 -m pytest backend/tests/test_data_api.py backend/tests/test_auth_real.py -q -> 48 passed, 1 skipped
  • PYTHONDONTWRITEBYTECODE=1 python3 -m pytest -q in backend/ -> 512 passed, 14 skipped
  • PYTHONDONTWRITEBYTECODE=1 python3 -m bandit -r backend/ -x backend/tests/ -q -> pass
  • npm test -- --run src/app/data/page.test.tsx -> 7 passed
  • npm test -> 22 passed, 103 passed
  • npm run lint -> pass
  • npm run typecheck -> pass
  • env -u FORCE_COLOR -u NO_COLOR PLAYWRIGHT_PORT=18131 npm run test:e2e -- --project=desktop tests/e2e/dashboard-branding.spec.ts -g "Data quality" -> 1 passed

Screenshots Inspected

  • data-quality-desktop-repository-assets.png: source-linked repository assets visible; no clipped provider-write text after fix.
  • data-quality-tablet-pipeline.png: tablet pipeline layout scrolls/frames correctly.
  • data-quality-mobile-scroll.png: mobile scroll reaches quality checks with bottom nav intact.
  • data-quality-mobile-hamburger.png: mobile drawer shows Data and all primary destinations.

Prior PR Follow-up

  • PR Add source-backed AI Hub workspace surface #301 merged and open PRs were converged to zero before this PR. Its follow-up Strix run 26632458842 was still in progress when this PR was opened; pending checks are tracked as wait states, not hard blockers.

@seonghobae
seonghobae temporarily deployed to feature/data-source-surface-20260529 - naruon PR #302 May 29, 2026 11:08 — with Render Destroyed
@seonghobae
seonghobae enabled auto-merge May 29, 2026 11:08
@seonghobae

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

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.

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Data quality surface API에 attachment 기반 repository assets 기능을 추가합니다. 오브스큐레이션된 키와 정제된 표시 텍스트로 민감한 데이터를 보호하며, 백엔드 쿼리와 집계, 프론트엔드 UI 렌더링, 그리고 전체 스택 검증을 포함합니다.

Changes

Repository Assets in Data Quality Surface API

Layer / File(s) Summary
API Contract, Models & Obfuscation Strategy
backend/api/data.py
RepositoryAssetState 타입과 DataRepositoryAsset 응답 모델을 정의하고, 응답 스키마에 repository_assets 필드를 추가합니다. Hashlib를 사용하여 asset/thread 키를 오브스큐레이션하고 HTML 태그를 제거한 정제된 표시 텍스트를 생성하는 유틸리티 함수를 구현합니다.
Backend Data Query & Asset Aggregation
backend/api/data.py
Attachment와 email을 조인하여 최신순/파일명 기준 상위 8건을 조회하는 쿼리를 추가합니다. _repository_assets 함수에서 content 길이와 thread 존재 여부를 기반으로 state_code와 detail_text를 조합하고, 오브스큐레이션된 키와 정제된 표시값을 포함한 자산 목록을 생성합니다.
Backend Test Fixtures & Validation
backend/tests/test_data_api.py
테스트용 Email과 Attachment 객체를 생성하는 헬퍼 함수를 추가합니다. Mock_db 픽스처를 확장하여 준비/주의 상태의 이메일 및 첨부 자산을 포함하도록 하고, 응답의 repository_assets 필드와 각 자산의 세부 정보(state_code, asset_key, thread_key 등)를 구체적으로 검증합니다. 민감한 데이터 미노출을 확인하고 PostgreSQL 스모크 테스트를 조건부 실행으로 변경합니다.
Frontend Type Contracts & Component Integration
frontend/src/components/DataLayout.tsx, frontend/src/app/data/page.test.tsx
Frontend에서 RepositoryAssetState 타입과 DataRepositoryAsset 스키마를 정의합니다. DataLayout 컴포넌트에서 응답의 repository_assets를 파싱하여 "최근 파일/첨부 자산" 섹션을 렌더링하고, 각 자산의 키, 스레드, 콘텐츠 길이, 캡처 시각, 상태, evidence 소스를 표시합니다.
Frontend & E2E Test Coverage
frontend/src/app/data/page.test.tsx, frontend/tests/e2e/dashboard-branding.spec.ts, frontend/tests/e2e/helpers.ts
Mock 응답 데이터에 준비/주의 상태의 repository_assets 배열을 추가합니다. Component 렌더링, 자산 텍스트 표시, 그리고 민감한 데이터(이메일 주소 등) 미노출을 검증합니다. E2E 테스트에서 Data 페이지의 자산 표시와 스크린샷을 검증합니다.
Policy & Implementation Documentation
AGENTS.md, README.md, docs/plans/2026-05-29-data-repository-assets-surface.md
API 노출 정책을 정의하여 데이터 저장소 자산은 signed quality-surface 증거로만 구성하며, 정적 ID, 원문 메시지, 자격증명 등을 재도입하지 않음을 명시합니다. Security contract에서 노출하지 않는 정보(provider_write_executed=false, 메시지 본문, 원문 ID 등)를 명시합니다. 구현 계획 문서에서 기능 범위, 검증 항목, 이후 로드맵을 정리합니다.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🐰 Attachments become assets, with keys obscured and names refined,
Data surface blooms with repository nodes, safely aligned,
Backend gathers, frontend renders with care,
Sensitive secrets hidden, only breadcrumbs to share!
Tests and docs declare the boundary bright—
A rabbit's delight in secure insight! 🔐✨


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Docstring Coverage ❌ Error Docstring coverage is 0.00% which is insufficient. The required threshold is 100.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed 제목은 주요 변경사항을 명확하게 요약하며, 저장소 자산 추가라는 핵심 내용을 정확히 전달합니다.
Description check ✅ Passed 설명은 변경사항과 직접 관련되어 있으며, 구현 내용, 안전성 경계, 검증 결과 등을 구체적으로 서술합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/data-source-surface-20260529
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/data-source-surface-20260529

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
backend/api/data.py (1)

295-326: 💤 Low value

rows 파라미터에 타입 어노테이션 추가 권장

함수 시그니처에서 rows의 타입이 명시되지 않아 코드 가독성과 IDE 지원이 저하됩니다. 반환 타입에는 list[DataRepositoryAsset]가 명시되어 있으므로 입력도 일관되게 타이핑하는 것이 좋습니다.

♻️ 타입 어노테이션 추가 제안
-def _repository_assets(rows) -> list[DataRepositoryAsset]:
+def _repository_assets(
+    rows: list[tuple[Attachment, Email]],
+) -> list[DataRepositoryAsset]:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/api/data.py` around lines 295 - 326, The _repository_assets function
lacks a type annotation for the rows parameter; add a concrete typing such as
rows: Iterable[tuple[Attachment, Email]] or rows: list[tuple[Attachment, Email]]
(matching your domain classes used as attachment and email in the loop) so
callers and IDEs get proper hints, and ensure you import the appropriate typing
(Iterable or list) and the Attachment/Email types or forward references if
needed; keep the existing return type list[DataRepositoryAsset] unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@backend/api/data.py`:
- Around line 295-326: The _repository_assets function lacks a type annotation
for the rows parameter; add a concrete typing such as rows:
Iterable[tuple[Attachment, Email]] or rows: list[tuple[Attachment, Email]]
(matching your domain classes used as attachment and email in the loop) so
callers and IDEs get proper hints, and ensure you import the appropriate typing
(Iterable or list) and the Attachment/Email types or forward references if
needed; keep the existing return type list[DataRepositoryAsset] unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59b7d09b-1a7a-4f62-9cc4-04b3f92532ce

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd190d and 97f8cd7.

📒 Files selected for processing (9)
  • AGENTS.md
  • README.md
  • backend/api/data.py
  • backend/tests/test_data_api.py
  • docs/plans/2026-05-29-data-repository-assets-surface.md
  • frontend/src/app/data/page.test.tsx
  • frontend/src/components/DataLayout.tsx
  • frontend/tests/e2e/dashboard-branding.spec.ts
  • frontend/tests/e2e/helpers.ts

@seonghobae
seonghobae merged commit 5a60dc9 into master May 29, 2026
16 checks passed
@seonghobae
seonghobae deleted the feature/data-source-surface-20260529 branch May 29, 2026 11:23
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.

1 participant