Skip to content

test(twitter-app): add hermetic test suite for tweet detector and register check in manifest - #14209

Open
1234adi1234 wants to merge 1 commit into
BasedHardware:mainfrom
1234adi1234:fix/twitter-app-hardening
Open

1234adi1234 wants to merge 1 commit into
BasedHardware:mainfrom
1234adi1234:fix/twitter-app-hardening

Conversation

@1234adi1234

@1234adi1234 1234adi1234 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds automated hermetic regression testing for the Twitter plugin's intelligent tweet detection pipeline:

  1. Hermetic Test Suite: Authored plugins/omi-twitter-app/test_tweet_detector.py runnable under standard library Python (python3 -S) with stubs for openai and dotenv. Tests trigger phrase matching (tweet now, post this tweet), non-trigger phrase rejection, ending phrase detection (that's the tweet, end tweet), and clean content extraction.
  2. Preflight Manifest Registration: Registered twitter-app-tweet-detector-tests in .github/checks-manifest.yaml.

Verification

  • Ran hermetic tests: python3 -S -m unittest plugins/omi-twitter-app/test_tweet_detector.py (7 tests passed in 0.001s).
  • Ran preflight: bash scripts/pr-preflight --lane ci (passed 11/11 checks clean in 22.13s).

Review in cubic

@Git-on-my-level

Copy link
Copy Markdown
Collaborator

Thanks @1234adi1234 - well-scoped, clean test addition. Verified locally: all 7 tests pass under plain python3 and under python3 -S, with no credentials needed.

Per-file notes:

  • plugins/omi-twitter-app/test_tweet_detector.py - the hermetic loader is done right: patch.dict(sys.modules) injects openai/dotenv stubs before exec_module, so the module-level AsyncOpenAI client in tweet_detector.py instantiates against a Mock and never touches real config. Coverage is sensible: normalize_text case/whitespace folding, detect_trigger positives plus the "Just reading some tweets" near-miss negative, detect_end, and extract_tweet_content across the three interesting cases (plain trigger, end-phrase stripping, no trigger -> None). Every assertion matches current tweet_detector.py behavior.
  • .github/checks-manifest.yaml - the new twitter-app-tweet-detector-tests entry is correctly placed under checks: (not exempt:), its id is unique among the 195 registered checks, the command invokes the file directly (which has the __main__ unittest.main() guard), triggers cover both plugins/omi-twitter-app/** and the manifest itself, and lanes [local, ci] match the neighboring clickup entry's pattern.

Minor, non-blocking: the AI-assisted paths (ai_check_completeness, ai_extract_tweet_from_segments, ai_clean_tweet) are the most regression-prone part of the detector and remain unexercised - fine to omit from a hermetic suite, but a good follow-up if those are ever refactored. Optionally the manifest command could pass -S to match the docstring's hermeticity claim, though the suite passes either way.

Positive signal - leaving for human maintainer review before merge.

Automated maintainer-assistant feedback on behalf of the Omi 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.

@1234adi1234

Copy link
Copy Markdown
Contributor Author

@Git-on-my-level Thank you for the review and verification! All checks are green. Whenever convenient, please feel free to merge. Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants