Skip to content

Add RFC 9457 problem+json parsing#286

Merged
JE-Chen merged 1 commit into
devfrom
feat/http-problem-batch
Jun 21, 2026
Merged

Add RFC 9457 problem+json parsing#286
JE-Chen merged 1 commit into
devfrom
feat/http-problem-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

Parses RFC 9457 application/problem+json error responses. http_request returned a non-2xx body unparsed, so flows and assert_http had no structured way to read a standardized API error.

  • ProblemDetails (frozen): type (default about:blank), title, status (coerced to int), detail, instance, extensions.
  • is_problem(headers) — case-insensitive Content-Type check.
  • parse_problem(response)ProblemDetails or None; falls back to text when json is absent.
  • raise_for_problem(response) → raises HttpProblemError (carrying the document) for a problem response.

Layers

  • Headless core: utils/http_problem/ (pure stdlib json, zero PySide6).
  • Facade: 5 symbols + __all__.
  • Executor: AC_parse_problem.
  • MCP: ac_parse_problem (read-only).
  • Script Builder: under Data.
  • Tests: test/unit_test/headless/test_http_problem_batch.py (9 tests, no Qt/network).
  • Docs: v78_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest test/unit_test/headless/test_http_problem_batch.py → 9 passed.
  • ruff check je_auto_control/ clean; pylint 10.00/10; bandit clean; radon CC clean.
  • Package stays Qt-free.

http_request returned a non-2xx body unparsed, so flows and assert_http
had no structured way to read a standardised API error. Add parse_problem
/ is_problem / raise_for_problem and ProblemDetails for the RFC 9457
application/problem+json document (registered members plus vendor
extensions). Wired through facade, executor (AC_parse_problem), MCP, and
the Script Builder with a headless test batch and EN/Zh docs.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 48 complexity · 0 duplication

Metric Results
Complexity 48
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 4881b29 into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/http-problem-batch branch June 21, 2026 14:20
@sonarqubecloud

Copy link
Copy Markdown

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