feat(attachments): recognize HWP and HWPX parser boundaries - #1353
feat(attachments): recognize HWP and HWPX parser boundaries#1353seonghobae wants to merge 32 commits into
Conversation
|
Important Approval pendingCodeRabbit has no unresolved comments, but it has not reviewed the latest commit. Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.
📝 WalkthroughWalkthroughThe attachment parser now recognizes HWPX and HWP files, validates bounded family signatures, preserves valid payloads for deferred processing, and rejects invalid payloads. Tests cover parser registration, ZIP and OLE boundaries, decoder behavior, fallback handling, and documentation records. ChangesAttachment recognition
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🟡 Moderate · up to The deferred decoder can currently accept unsupported expected content types without validating the attachment family, which could admit arbitrary bytes into downstream processing. This bounded correctness and safety issue should be fixed before merging. Sequence Diagram(s)sequenceDiagram
participant EmailImport
participant parse_email_attachment
participant PayloadValidators
participant DeferredWorker
EmailImport->>parse_email_attachment: attachment and content type
parse_email_attachment->>PayloadValidators: validate family-specific signature
PayloadValidators-->>parse_email_attachment: valid payload or error code
parse_email_attachment-->>EmailImport: pending status and base64 payload
DeferredWorker->>decode_deferred_attachment_payload: payload and expected content type
decode_deferred_attachment_payload-->>DeferredWorker: validated source bytes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@opencode-agent review current exact head |
|
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. |
|
@coderabbitai review |
|
Parent #1353 admission requires version.xml before a HWPX payload can remain pending. Worker fixtures omitted that member, so deferred revalidation failed closed before recognition. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Reconcile Ready PR #1353 onto current protected develop without changing HWP/HWPX attachment-recognition semantics. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
|
@coderabbitai review Please review the unchanged exact current head |
|
|
Stale review: all review-thread comments on this PR are resolved and the reviewer's cited commit predates the current head, which passes all non-metadata-gate required checks (verified via gh pr checks and the reviewThreads GraphQL query — 0 unresolved threads). Dismissing as superseded per AGENTS.md stale-review guidance.
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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. Comment |
|
@coderabbitai review Please re-run the review for the exact current head |
|
|
|
@opencode-agent @cwl-noema-review Please independently review the complete current PR diff at exact head |
# Conflicts: # backend/services/attachment_parser.py # backend/tests/test_attachment_parser.py
# Conflicts: # CHANGELOG.md
Product boundary
Naruon owns the email-attachment recognition contract feeding search, context synthesis, evidence provenance, and user-facing document state. This slice admits Korean HWP/HWPX attachments into deterministic deferred states without parsing HWPX XML inline, converting HWP binaries, running OCR/VLM, fetching external resources, or calling an LLM provider.
hwpx_xml_package_pendinghwp_conversion_pendingdecode_deferred_attachment_payload()remains compatible with the PDF worker while validating expected parser families.Current stack authority
develop@042b0c70531b229af3acbd0421a2f23098d848b3fix(test): install Starlette TestClient dependencycodex/starlette-testclient-dependency@52dfc863d1a5d6e4e80b6366f719dd09f2aa6172feat/hwp-hwpx-attachment-recognition5cf957708098d17b6d843353309d86b0b232fcd7The prior
50a4102c...source head remains the last test/import-style repair point. The current head is its ordinary direct child: compare50a4102c... → 5cf95770...is ahead 1 / behind 0 and changes onlydocs/doctoring/hwp-hwpx-attachment-recognition.md(+13/-4). That intervening documentation delta is adopted as valid lineage rather than treated as a race. Predecessor checks/reviews do not transfer.Current review repairs
HWPX import/worker contract
Fresh review verified a real boundary mismatch:
_is_hwpx_payload()admitted a package when it had either a manifest or a section, butrecognize_hwpx()requires at least one canonicalContents/sectionN.xmland otherwise fails withHWPX package has no section XML.44a268b988f9a3092368bd774a26582647e319a9adds a manifest-only HWPX package that must fail import admission. The predecessor implementation would accept it becausehas_manifestwas true.4281904b438ac50c2d6c40d14207119c383227a8requires at least one section at import admission, aligning queue admission with the recognizer without parsing XML inline.HWPX test import-style finding
50a4102c698f28209db68f92e36b52df158eeaf0imports the recognition module once ashwpx_moduleand derives local aliases, preserving module-level monkeypatch targets while removing mixed import styles.All other reviewed HWPX/HWP admission controls remain in scope: exact HWPX
mimetype, bounded ZIP metadata, aggregate member-name limits, HWP OLE +HWP Document Fileidentity, unsupported expected-type rejection, and.hwpx/.owpmlgeneric-MIME handling.Evidence boundary
Repository-owned workflow evidence observed on predecessor heads is not exact-head merge evidence for
5cf95770.... This PR targets a non-default parent branch, and the canonical repair for stacked-base activation remains Draft #1562. Do not duplicate that workflow change here and do not manufacture a dummy source commit to wake CI.Historical formal reviews are dismissed/comment-only and no qualifying independent post-last-push approval applies to the current head. Local/source-order receipts remain development evidence only.
Verification and merge boundary
Keep Draft until #1565 is resolved in normal ancestry, the unchanged final head has every applicable repository and organization-required check terminal-success, valid review findings/threads remain resolved, and a qualifying independent non-author post-last-push approval exists. After #1562 is protected-integrated, regenerate stacked-base evidence on the unchanged then-current head; predecessor, parent, status-only, model-only, skipped, absent, cancelled, or failed evidence does not transfer.
No force-push, destructive rebase, self-approval, admin bypass, gate weakening, dummy/no-op requeue commit, or source duplication of the #1562 CI owner repair.