Skip to content

feat(mail): open recognized HWPX text from email attachments - #1406

Draft
seonghobae wants to merge 20 commits into
cursor/hwpx-recognized-text-preview-b246from
cursor/mail-hwpx-attachment-preview-7b5e
Draft

feat(mail): open recognized HWPX text from email attachments#1406
seonghobae wants to merge 20 commits into
cursor/hwpx-recognized-text-preview-b246from
cursor/mail-hwpx-attachment-preview-7b5e

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Current authority — 2026-09-10

This mail HWPX preview slice remains valid product work, but it is Draft / not merge-ready.

Parent adoption

40594758c1f1791a1d679fb0ee0da0d1c8b2cf06 non-force merged current #1404 into this branch; cc7d2cefd41aff24bac1a1a94d3a0205984816c1 then exact-adopted current parent blobs left stale by the first merge. The child therefore inherits #1404 preview authority without force-push, destructive rebase, or parent-source rollback.

Retained child repairs

  • Attachment-body overfetch: RED 63fd00a9382c47f8e530a8c47b43f2988f80f9f7 rejects email_attachments.content projection in mail detail/thread. Fix 6d3bcc5afe0e6e0ccea9c03e03f2e7496f81947a uses selectinload(...).load_only(Attachment.filename, Attachment.parser_key, raiseload=True).
  • PostgreSQL smoke cleanup: 7615754fb9a49b3378db6d73f5093e9f53660e19 deletes seeded attachment then email rows before engine disposal.
  • Out-of-order preview responses: test-first bc24bf682ff6998610db39c90dc644cfeb8baad5 and fix 298bbba1fd8f3b4dcb9cdc7ac50bb6f2dd3e472e use per-asset request sequencing so stale completion cannot overwrite a newer recognized state.
  • Signed-session evidence: 501d019e1ae0efde3b5df333047fda4fdd88b971 exercises the real HMAC bearer verifier and rejects public identity headers alone; exact edd3134... adds browser evidence requiring naruon_session on mail-detail and attachment-preview requests.

Corrected parent prerequisite map

The previous body repeated #1404's stale statement that #1345 had to be adopted as the workspace-document organization prerequisite. That is no longer the live owner map.

Fresh #1345/#1417/#1645 succession audit establishes:

Accordingly #1406 inherits the same requirement through its parent: do not restack or copy #1345. Wait for #1404 to reconcile its temporary document-scope overlap against the protected #1417 result, then ordinary-restack this child on the resulting #1404 head while retaining only child-owned mail-preview behavior.

Remaining live finding

Duplicate filename attachment identity remains unresolved on the parent/child boundary. Two MIME parts with the same filename can receive the same opaque key because attachment identity is not in the digest. This must be repaired once in canonical parent #1404 and inherited here; #1406 must not invent competing key semantics.

Parent #1404 also retains the attachment workspace-identity gap and preview retry/staleness findings. This child must not bypass them.

Evidence and merge boundary

This is a non-default stacked branch. Current exact-head backend/frontend/PostgreSQL/browser/signed-session evidence and qualifying independent review must apply to the final parent topology; predecessor checks do not transfer. Do not manufacture a dummy commit or broaden workflow admission solely to create a receipt.

Keep Draft until #1404 and its canonical prerequisites are healthy, the duplicate-key owner finding is fixed and inherited, exact-head required execution is terminal-success, and qualifying post-last-push independent approval applies.

No force push, destructive rebase, self-approval, dummy requeue, stale-evidence transfer, bypass, or gate weakening.

List the current email's attachments with the same opaque asset_key as
the Data preview contract so a buyer can read ordered HWPX paragraphs
from mail without treating missing text as empty content.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a1f7f21f-f9c3-4897-978d-a596a8e1c1ac

📥 Commits

Reviewing files that changed from the base of the PR and between f218113 and b83a0da.

📒 Files selected for processing (11)
  • AGENTS.md
  • backend/api/emails.py
  • backend/tests/test_email_attachment_preview.py
  • docs/doctoring/hwp-hwpx-attachment-recognition.md
  • frontend/src/components/EmailDetail.test.tsx
  • frontend/src/components/EmailDetail.tsx
  • frontend/src/components/MailAttachmentPreview.test.tsx
  • frontend/src/components/MailAttachmentPreview.tsx
  • frontend/src/lib/email-threading.ts
  • frontend/tests/e2e/dashboard-flows.spec.ts
  • frontend/tests/e2e/helpers.ts

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


Important

Approval pending

CodeRabbit has no unresolved comments, but it skipped the latest review.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Email detail and thread responses now expose opaque attachment references. The dashboard renders selected attachments through the repository preview endpoint and handles HWPX recognition states without exposing internal identifiers.

Changes

Mail attachment preview

Layer / File(s) Summary
Attachment API contract
backend/api/emails.py, AGENTS.md
Email detail and thread responses include opaque asset keys, sanitized filenames, parser metadata, and empty attachment lists when applicable.
Attachment preview UI
frontend/src/lib/email-threading.ts, frontend/src/components/EmailDetail.tsx, frontend/src/components/MailAttachmentPreview.tsx
The selected email exposes typed attachments. MailAttachmentPreview loads and caches repository previews and renders recognized, pending, failed, and unavailable states.
Preview behavior validation and traceability
backend/tests/test_email_attachment_preview.py, frontend/src/components/*.test.tsx, frontend/tests/e2e/*, docs/doctoring/hwp-hwpx-attachment-recognition.md
Tests cover opaque metadata, scoped previews, HWPX paragraph rendering, empty attachments, recognition states, generic 404 handling, and end-to-end opening. Documentation records the preview slice and preserved error behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant EmailDetail
  participant MailAttachmentPreview
  participant RepositoryAssetPreviewPanel
  User->>EmailDetail: select email
  EmailDetail->>MailAttachmentPreview: provide attachment references
  MailAttachmentPreview->>RepositoryAssetPreviewPanel: request preview by asset_key
  RepositoryAssetPreviewPanel-->>MailAttachmentPreview: return preview state and paragraphs
  MailAttachmentPreview-->>User: display selected attachment
Loading

Merge Risk: ⚪ Minimal · up to b83a0

This PR adds recognized HWPX attachment previews to email while preserving existing preview behavior and unavailable/pending states. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4
✅ 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: opening recognized HWPX text from email attachments.
✨ 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 cursor/mail-hwpx-attachment-preview-7b5e

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.

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

PR governance metadata gate is not ready for b83a0da03b46a447f9710b5f91d245f5b1783dfa:

  • Draft PR: merge automation is paused.

cursoragent and others added 2 commits August 18, 2026 00:02
Bring Draft #1406 onto exact current #1404 f218113 so mail-attachment
reachability stays stacked on the live recognized-text preview parent.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Wire the inherited 다시 확인 control to re-fetch the same opaque mail
attachment preview so the stacked parent refresh stays reachable.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Aug 18, 2026
Bring Draft #1407 onto independently resolved live #1406
b83a0da. Previous parent 304d5af is stale.

Keep #1404/#1406 pending 다시 확인 refresh and mail reachability together
with the fail-closed Inkspan edit handoff. No rebase, squash, or force-push.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@seonghobae
seonghobae marked this pull request as ready for review August 18, 2026 01:32
@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@seonghobae
seonghobae marked this pull request as draft August 18, 2026 02:06
@seonghobae

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

The rolling-hour window from #1404 f2181137 (finished 04:14 UTC) has elapsed. Please review exact current head b83a0da03b46a447f9710b5f91d245f5b1783dfa, stacked on live #1404 f2181137. Predecessor evidence does not transfer. Keep Draft. This comment is not an approval.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@seonghobae Fresh review requested for exact head b83a0da03b46a447f9710b5f91d245f5b1783dfa. I will keep #1406 as Draft. I will not approve or merge it.

✅ Action performed

Review finished.

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.

@opencode-agent opencode-agent Bot added priority: medium Normal-priority or P2 work status: draft Draft pull request type: feature New or expanded product capability labels Aug 22, 2026
@seonghobae
seonghobae marked this pull request as ready for review September 5, 2026 05:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T05:55:44.568649Z 1ff9fc7 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ff9fc7a1d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread backend/api/emails.py
file_name = _safe_email_display_text(getattr(attachment, "filename", None))
refs.append(
EmailAttachmentRef(
asset_key=_opaque_asset_key(email, attachment),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include attachment identity in each opaque asset key

When one email contains two attachments with the same filename—which the attachment schema permits—both references receive the same key because _opaque_asset_key hashes only the owner, message ID, and filename. MailAttachmentPreview subsequently uses that key for React identity, selection, and caching, while the preview endpoint returns the first matching row, so clicking either attachment can display the wrong document. Include an immutable attachment-specific value in the key and lookup, then add a duplicate-filename case to backend/tests/test_email_attachment_preview.py.

AGENTS.md reference: AGENTS.md:L449-L454

Useful? React with 👍 / 👎.

Comment thread backend/tests/test_email_attachment_preview.py
Comment thread backend/api/emails.py Outdated
Comment thread frontend/src/components/MailAttachmentPreview.tsx Outdated
Comment thread backend/tests/test_email_attachment_preview.py
@seonghobae
seonghobae marked this pull request as draft September 5, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: medium Normal-priority or P2 work status: draft Draft pull request type: feature New or expanded product capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants