4 Commits

Author SHA1 Message Date
Abhimanyu Saharan
824016d414 Fix flake8 spacing for json_safe invalid-utf8 test 2026-02-15 04:39:58 +00:00
Abhimanyu Saharan
16bf5e0fa3 Merge master into ci/e2e-path-filters; resolve error_handling test conflict 2026-02-15 04:38:00 +00:00
Abhimanyu Saharan
4c9ef7fdf2 test(error_handling): cover _json_safe byte decoding branches 2026-02-12 14:44:18 +00:00
Abhimanyu Saharan
75abe0623f ci(e2e): run Cypress only when frontend paths change 2026-02-12 14:41:00 +00:00
2 changed files with 28 additions and 1 deletions

View File

@@ -14,6 +14,25 @@ permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
e2e: ${{ steps.filter.outputs.e2e }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect changes for E2E
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
e2e:
- 'frontend/**'
- 'frontend/cypress/**'
- 'frontend/package.json'
- 'frontend/package-lock.json'
- '.github/workflows/ci.yml'
check:
runs-on: ubuntu-latest
@@ -190,7 +209,8 @@ jobs:
e2e:
runs-on: ubuntu-latest
needs: [check]
needs: [check, changes]
if: needs.changes.outputs.e2e == 'true'
steps:
- name: Checkout

View File

@@ -219,6 +219,13 @@ def test_json_safe_handles_binary_inputs() -> None:
assert _json_safe(memoryview(b"world")) == "world"
def test_json_safe_replaces_invalid_utf8_bytes() -> None:
# Invalid UTF-8 should be replaced with U+FFFD, not crash error handling.
assert _json_safe(b"\xff") == "\ufffd"
assert _json_safe(bytearray(b"\xff")) == "\ufffd"
assert _json_safe(memoryview(b"\xff")) == "\ufffd"
def test_json_safe_falls_back_to_string_for_unknown_objects() -> None:
class Weird:
def __str__(self) -> str: