Skip to content

feat: report invalid GitHub JSON per section (BootUI 2.6.0) - #378

Draft
ffroliva wants to merge 68 commits into
mainfrom
feat/0.11.0-github-decoding
Draft

ffroliva wants to merge 68 commits into
mainfrom
feat/0.11.0-github-decoding

Conversation

@ffroliva

@ffroliva ffroliva commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Task 1.6 of the 0.11.0 plan (#367), row G4 of the BootUI 2.6.0 delta: an invalid GitHub response body is reported per
section, as BootUI's GitHubApiClient.get does, instead of failing the whole refresh.

  • src/sharpit/engine/collectors/github/client.py:
    • _Response.success is 2xx and message is None (BootUI ApiResponse.success());
    • bodies are decoded as UTF-8 with replacement (new String(body, UTF_8)); a blank body, JSON that is not an object
      or array, trailing data, NaN/Infinity, a number with more than 1000 digits or a property name longer than
      50,000 characters (Jackson 3 read limits; signs, decimal points and exponent markers are not counted), a decode
      error or a recursion error gives GitHub returned invalid JSON for <label>.;
    • transport failures and oversized bodies still abort the refresh ("Network request failed or timed out while
      refreshing GitHub data.").
  • Effect per section: invalid rate limits give ERROR with the scopes still read from the headers; another invalid
    section adds a warning and the report is PARTIAL; Copilot gives unavailableReason, and a 204 stays NO_DATA; a
    repository quota (cache, artifacts) is unavailable with the reason and adds no warning (BootUI
    addRepositoryQuota).
  • docs/reference/matrix-updates/0.11.0-github.tsv: op:github.refresh.invalid-json (matched) and
    op:github.refresh.json-depth (adapted: Jackson 3 rejects nesting deeper than 500; the standard Python parser has no
    depth hook, and the 2 MiB body cap already bounds the work).

Behaviour change for users: a successful response with an empty body (other than Copilot's 204) used to count as an
empty result; it is now reported as invalid JSON for that section, as BootUI does.

Review scope

The branch was cut from the 0.11.0 integration line, so against main the diff also shows the earlier 0.11.0 pull
requests (Wave 0, #368 to #377). The changes of this pull request are in src/sharpit/engine/collectors/github/client.py,
tests/engine/collectors/github/test_github_client.py and docs/reference/matrix-updates/0.11.0-github.tsv.

Red evidence

Finding Test Red
A 2xx body that is blank, scalar, trailing, NaN/Infinity, HTML or too deeply nested failed the whole refresh test_malformed_optional_response_preserves_independent_sections[...], test_malformed_rate_limit_response_returns_safe_error[...], test_malformed_copilot_response_is_unavailable_without_discarding_other_sections[...] assertion: Network request failed... instead of the invalid-JSON text (40 cases, run against the earlier client.py)
NaN/Infinity constants were reported as a network failure test_github_non_json_number_constants_report_error (rewritten) assertion: status and message
Raw bytes were passed to json.loads, which guesses UTF-16/32, strips a BOM and rejects invalid UTF-8 invalid-UTF-8 title, BOM and UTF-16 body cases assertion
Numbers with more than 1000 digits were parsed 1001-digit integer and float cases assertion
The limit counted the whole literal; Jackson counts digits only (review) test_github_number_digit_limit_matches_jackson[negative-1000-digits, fraction-1000-digits, exponent-999-digits], corrected test_github_number_literal_length_matches_jackson[float-1001] assertion: valid body reported invalid
Property names over 50,000 characters were accepted (review) test_github_property_name_length_matches_jackson[rejected] assertion

failedRateLimitResponseKeepsHttpStatus and copilotNoContentRemainsNoData are ported as guards; they pass before and
after the change. The 5000-digit number case moved from the coercion test to the invalid-JSON tests: measured with
Jackson 3.1.7 and 3.1.8, readTree accepts 1000 digits and rejects 1001 and 5000.

Verification

uv run ruff check, uv run ruff format --check, uv run pyright (0 errors);
uv run pytest -q -n 4 tests/engine/collectors/github tests/fastapi -k github (303 passed). The full suite runs in CI.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
… file

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…e protocol

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
The Origin header is parsed as scheme://host[:port] with an http or https scheme, as BootUI 2.6.0 does: a path (a trailing slash included), query, fragment, userinfo, control character, trailing colon, unsupported scheme or a port above 65535 makes the origin unreadable, and an unreadable origin is cross-site. The value is no longer trimmed.\n\nA port of more than five digits is refused before int() converts it, in the origin and in the request's own Host, so a very long port is a cross-site refusal and no longer an unhandled ValueError. Adds a property test of the origin parser.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…UI 2.6.0)

A write that carries Sec-Fetch-Site must send same-origin or none (ASCII, case-insensitive); same-site, cross-site, an empty value and any unknown value are refused. A present but empty Origin header is an unreadable origin and is cross-site, no longer read as absent. A same-site navigation GET still loads the shell, and an API path still requires the request's own scheme, host and port. A request whose own origin cannot be formed stays cross-site where that comparison applies.\n\nDocuments the rule in SECURITY.md and the BootUI contract note, and records the deviations in the 0.11.0 guard matrix fragment.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Record the two deviations of the inactivity log from BootUI 2.6.0 in a matrix fragment, update the MVP plan text that still described the old log line, extract the inactivity logging of install() into a helper to keep its complexity at the pinned count, and wrap one over-long test assertion.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED must log exactly one record, the fixed warning, as BootUI does. The count of the remaining configuration warnings stays.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED is already reported by the fixed inactive warning. Counting its settings warning as well produced a second WARNING record, where BootUI logs one.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…tests

Port BootUiInactiveStartupDiagnosticTests.deliberateDisablementIsSilentAtInfo, cite the BootUI tests the other inactivity tests port, and keep the expected log texts in one test module. A single Inactivity alias types the inactivity category. The matrix row for the warning count records that it leaves out the invalid SHARPIT_ENABLED warning.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>

# Conflicts:
#	tests/fuzz/test_trust_boundary_fuzz.py
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…ootUI's URI rules

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…tector

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…I does

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>

# Conflicts:
#	docs/reference/matrix-updates/0.11.0-github.tsv
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant