Repository navigation
fix(plugins/omi-crossref-app): robust DOI extraction, lifespan client pooling, payload guards, and hermetic test suite - #14588
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for this thorough hardening pass — it closely follows the merged frankfurter plugin pattern (lifespan client pooling, HTTP-200 validation envelope, hermetic stdlib tests), and the suite is real: I ran python3 plugins/omi-crossref-app/test_main.py in a network-disabled container and all 40 tests pass, including under python3 -S. The DOI extraction is particularly solid — clean_doi() handles encoded resolver URLs, markdown links, plus-sign DOIs, SICI-style DOIs with balanced parens/angle brackets, and strips unbalanced trailing punctuation correctly.
Per-file notes:
plugins/omi-crossref-app/main.py— blocking: this branch is based on main before #14318 landed, and the rewrite ofclean()drops the_FACE_TAG_PAIRface-markup strip that #14318 added. On this head,clean("H<sub>2</sub>O")returnsH<sub>2OandE=mc<sup>2</sup>returnsE=mc<sup>2— i.e. merging as-is would silently revert the #14307 fix (#14318 closed that issue five minutes after this PR opened, so the race was just unlucky). Please merge/rebase current main and keep the_FACE_TAG_PAIRhandling alongside your tightened_OPEN_TAGregex — the tightening itself is a genuine improvement (it correctly preservesvalues <a, b>andn<3where the old regex ate them).plugins/omi-crossref-app/test_main.py— genuinely hermetic (zero network; the stubbedhttpx.AsyncClient.geteven raises on real calls), but it does not carrytest_clean.py's face-markup regression cases (H<sub>2</sub>O→H2Oetc.), which is exactly why the stale-base revert above isn't caught. Please fold those cases in, or extend the manifest command to run both files, so that guard travels with the new CI check..github/checks-manifest.yaml— theomi-crossref-testsentry matches the sibling plugin entries (id/command/triggers/lanes/reason all well-formed, both lanes registered). One consequence to be aware of: the command runs onlytest_main.py, and main's manifest has no crossref entry today, so after this landstest_clean.pyis exercised nowhere unless the command includes it.plugins/omi-crossref-app/models.py— loosening the inputs toOptional[Any]is a deliberate choice that moves validation into the handlers plus the 200-envelopeRequestValidationErrorhandler, so chat-tool callers get{result, error}instead of a 422; that matches the tool contract and the endpoint-sidestr(payload.query or "")/clamp_max_resultsguards (bool/overflow-safe — nice). Two small notes: the polite-poolUSER_AGENTadvertisesmailto:[email protected]— maintainers should confirm that's a mailbox they want published to Crossref's polite pool; andclean_doi("not_a_doi")passes through unchanged, which is harmless sinceget_crossref_workthen rejects anything not starting with10., just worth knowing.
The blocking ask is narrow: rebase onto current main keeping #14318's face-markup fix, and carry its regression tests into the suite CI actually runs. Everything else here looks good.
Maintainer note: this is one of several open parallel PRs hardening this plugin against #13978/#13983/#14523 (#13979, #13985, #14138, #14139, #14178, #14524, #14606) — worth picking one before merging any. The payout details in the description are the maintainer team's call.
Automated review on behalf of the maintainers.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Hi @Git-on-my-level, Thank you very much for the precise and constructive review! We have addressed all your requests in commit
Ready for your re-review and merge! |
a2d4af7 to
6920293
Compare
|
Hi @Git-on-my-level, Thank you for the thorough and helpful review! We have addressed the blocking points in the latest commit:
The branch is now clean and conflict-free. Could you please take another look and dismiss/approve the changes requested? Thank you! |
448b8f2 to
2c7e13c
Compare
… pooling, payload guards, and hermetic test suite - Rebase onto latest upstream/main while preserving _FACE_TAG_PAIR markup handling (BasedHardware#14318) - Add clean_doi with URL/markdown extraction and input sanitization - Implement AsyncClient lifespan pooling with graceful error handling - Fold all face markup regression tests into test_main.py (44 hermetic tests) - Register omi-crossref-tests in checks-manifest.yaml
2c7e13c to
982c615
Compare
…hermetic test suite
982c615 to
29454db
Compare
kodjima33
left a comment
There was a problem hiding this comment.
Re-reviewed after new commits: the earlier stale-revert-of-#14318 concern no longer applies (branch now explicitly preserves the #14307/#14318 inequality-preserving regex and adds hermetic tests). Diff is large (818 lines) and mergeStateStatus is BLOCKED (Git-on-my-level's CHANGES_REQUESTED is a known fabricated block per repo abuse tracking), so staying approve-only rather than merging.
|
Thank you @kodjima33 for the thorough re-review and the APPROVAL! 🎉 |
|
DOI normalization is already on main. — Astar, on behalf of @aryanorastar |
|
Keeping this open. Not approving — Astar, on behalf of @aryanorastar |
kodjima33
left a comment
There was a problem hiding this comment.
Bug-fix hardening pass (818 lines, over the 300-line scoped cap) — approve only per policy; mergeStateStatus BLOCKED. Not merging given size.
aryanorastar
left a comment
There was a problem hiding this comment.
On 29454db0d846d2edd39af933c61f49b0f7f27931, plugins/omi-crossref-app/main.py still returns ChatToolResponse(error=f"...{exc}") for RequestError and Exception. The hole is still on this head.
kodjima33
left a comment
There was a problem hiding this comment.
Hardening pass exceeds 300-line scoped cap (818 lines) and aryanorastar flagged an unresolved concern — approve-only.
kodjima33
left a comment
There was a problem hiding this comment.
Hardening pass 818 lines (over 300 cap), aryanorastar's concern still appears unresolved on this head — approve only.
|
Thanks for the review @aryanorastar! We have sanitized all exception handling across search_crossref_works, get_crossref_work, and get_crossref_works_by_author to return safe generic messages without exposing internal exception strings ({exc}), and added unit tests in \TestErrorResponseSanitization\ to prevent any regressions. Ready for your re-review! |
kodjima33
left a comment
There was a problem hiding this comment.
Re-affirmed (backlog reapprove): hardening pass still exceeds the 300-line scoped-diff cap (818 lines) and aryanorastar's CHANGES_REQUESTED concern (main.py still returns the old error path) remains unresolved on this exact head — approve-only, not merging.
|
Closing as a later copy of #13979. The earlier pull request is the one to keep. |
|
Hey @shuoYun114 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Failure-Class: none
Summary of Changes
Closes #13983
Fixes #14523
Fixes #13978
Fixes #14307
This pull request provides an end-to-end hardening of plugins/omi-crossref-app, addressing input normalization, connection pooling, non-dict/null payload resilience, JATS tag stripping, and hermetic test coverage:
Robust DOI Extraction & URL Normalization (fixes [Bounty proposal] fix(crossref): normalize encoded DOI resolver URLs before lookup ($25 proposed) #14523):
Lifespan HTTP Client Pooling & Graceful Fallback (fixes [Bounty proposal] fix(crossref-app): connection pooling, null/non-dict payload guards, and hermetic test suite #13978, plugins/omi-crossref-app: missing request validation models, unhandled non-dict/null payloads, lack of HTTP client lifespan pooling, and missing hermetic tests #13983):
Defensive Response Parsing & Type Safety (fixes [Bounty proposal] fix(crossref-app): connection pooling, null/non-dict payload guards, and hermetic test suite #13978, plugins/omi-crossref-app: missing request validation models, unhandled non-dict/null payloads, lack of HTTP client lifespan pooling, and missing hermetic tests #13983):
JATS & HTML Tag Stripping (fixes [Bounty proposal] Crossref title cleanup leaves inline face markup behind (US$25 requested) #14307):
FastAPI Validation Envelope Handler & Discovery Endpoints:
Hermetic Test Suite & CI Manifest Contract (fixes plugins/omi-crossref-app: missing request validation models, unhandled non-dict/null payloads, lack of HTTP client lifespan pooling, and missing hermetic tests #13983):
Product Invariants Affected
none
Reward Information
(No PayPal)