Repository navigation
fix(plugins): harden Stack Overflow question URL parsing and owner NoneType defense - #14546
Merged
kodjima33 merged 1 commit intoSep 18, 2026
Conversation
…neType defense - Support question URL parsing and domain site extraction in get_question and get_top_answers - Guard against NoneType in answer owner object to prevent 500 AttributeErrors on deleted accounts - Defensively sanitize question queries, limits, and tags against non-finite values and malformed payloads - Add hermetic test suite covering URL extraction, sanitization, and API error handling - Register omi-stack-overflow-tests in checks-manifest.yaml Failure-Class: none
Contributor
Author
|
Hi @kodjima33 @aaravgarg, quick 10-second review summary for ready-to-merge:
|
kodjima33
approved these changes
Sep 18, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Confirmed still-broken on main (_format_answer does item.get('owner', {}).get('display_name') which raises AttributeError when owner is explicit None, not just absent). Fixes #14545, scoped root cause, green CI, 26 new hermetic tests: 4/5 (diff size is the only miss). Merging.
This was referenced Sep 19, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure class (fixes)
Failure-Class: none
Fixes #14545
Summary of Changes
This pull request hardens the
omi-stack-overflow-appplugin against unhandledNoneTypecrashes, adds flexible URL / identifier target parsing across Stack Exchange sites, cleans dirty inputs, and introduces a hermetic test suite with CI contract enforcement:Defensive Guard Against Deleted/Anonymous Owner (
AttributeError):_format_answer, safely verifyisinstance(owner, dict)" before extractingdisplay_name.ownerisbull, defaults cleanly to"unknown"instead of raisingAttributeError: 'NoneType' object has no attribute 'get'and crashing with 500.Full Question URL & Site Domain Extraction:
_parse_question_targetinget_questionandget_top_answers.11227809), prefixed formats (#11227809,question: 11227809), full URLs (https://stackoverflow.com/questions/11227809/...), short URLs (https://superuser.com/q/12345), and automatically infers network sites (stackoverflow,superuser,serverfault,askubuntu,smathoverflow, etc.) whensite` is not explicitly passed.Dirty Input Sanitization & HTML Unescape Ordering:
bool,Inf,NaN, and float strings._clean_textagainst invisible unicode formatting and adjustedunescapeordering so code tags inside HTML-escaped text (e.g.<div>>) are not stripped as HTML markup.Hermetic Test Suite (26 Tests):
plugins/omi-stack-overflow-app/test_main.pycontaining 26 hermetic unit tests.CI Contract Registration:
omi-stack-overflow-testsunder.github/checks-manifest.yamlin bothlocalandcilanes.Verification
All 26 hermetic tests and repository checks pass cleanly:
``@bash
python plugins/omi-stack-overflow-app/test_main.py
Ran 26 tests in 0.010s -> OK
python .github/scripts/run_checks.py --lane local --base 27ef82c
Manifest checks passed: 15 check(s).