omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(public-holidays-app): client fallback, null/non-list payload guards, and hermetic test suite

Open shitobu opened this issue 2 months ago • 1 comments

Description

A reliability and architecture review of plugins/omi-public-holidays-app identified several key areas needing hardening:

  1. Unmanaged Context HTTP Client Crash:

    • _request_json() accessed app.state.http_client directly. If invoked in unmanaged contexts or test environments without lifespan execution, this raised an unhandled AttributeError: 'State' object has no attribute 'http_client'. Added automatic fallback allocation.
  2. Fatal Crashes on Non-List Upstream Payloads:

    • When Nager.Date returns an error object (e.g. {"status": 404, "title": "Not Found"}), get_public_holidays and get_long_weekends iterated over the dictionary keys as strings, causing _format_holiday and _format_long_weekend to call .get() on strings and crash with AttributeError: 'str' object has no attribute 'get'.
    • In list_supported_countries, non-dict elements crashed while extracting countryCode and name.
  3. Defensive Formatting:

    • Hardened _format_holiday, _format_long_weekend, and _format_list against non-dict, non-list, or missing attributes, providing safe fallback values.
  4. Missing Checks Manifest Registration & Hermetic Test Suite:

    • The plugin had 0 unit tests and was completely unmonitored in .github/checks-manifest.yaml.

Proposed Fix

  • Add resilient fallback client handling in _request_json() and clean resource disposal in lifespan.
  • Validate upstream JSON payloads are lists before slicing and formatting.
  • Guard formatters against non-dict items.
  • Implement a 26-test hermetic test suite (test_main.py) running with standard library unittest in <0.3s without third-party dependencies.
  • Register omi-public-holidays-tests in .github/checks-manifest.yaml.

shitobu avatar Sep 15 '26 23:09 shitobu

Closing as already fixed on current main.

Current main public-holidays _request_json has client fallback and get_public_holidays isinstance(list) guards + test_main.py

aryanorastar avatar Sep 20 '26 16:09 aryanorastar