Skip to content

Add conditional HTTP requests and cache validators#300

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

Add conditional HTTP requests and cache validators#300
JE-Chen merged 1 commit into
devfrom
feat/http-conditional-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

What

http_request never sent If-None-Match/If-Modified-Since nor read Cache-Control, so every poll re-downloaded an unchanged resource.

  • store_validators(response){etag, last_modified, date, cache_control}.
  • parse_cache_control(headers) → directive dict (max-age int, flags True).
  • conditioned_call(call, validators) — adds If-None-Match/If-Modified-Since to a build_call dict.
  • is_fresh(validators, age_seconds) — explicit age, no wall clock; no-store/no-cache never fresh.
  • is_not_modified(response) — detects 304.

Completes the stdlib HTTP-semantics lane (problem+json, SSE, link header, multipart, content negotiation, cookie jar, conditional requests).

Layers

  • Headless core: utils/http_conditional/ (pure stdlib, zero PySide6).
  • Facade: 5 symbols + __all__.
  • Executor: AC_parse_cache_control, AC_store_validators.
  • MCP: ac_parse_cache_control, ac_store_validators (read-only).
  • Script Builder: both under Data.
  • Tests: test/unit_test/headless/test_http_conditional_batch.py (9 tests).
  • Docs: v92_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest test/unit_test/headless/test_http_conditional_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 never sent If-None-Match / If-Modified-Since nor read
Cache-Control, so every poll re-downloaded an unchanged resource. Add
store_validators, parse_cache_control, conditioned_call, is_fresh (by an
explicit age), and is_not_modified so a flow can revalidate and honour 304
Not Modified. Wired through facade, executor (AC_parse_cache_control /
AC_store_validators), 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 42 complexity · 0 duplication

Metric Results
Complexity 42
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 a60e9b1 into dev Jun 21, 2026
16 checks passed
@JE-Chen
JE-Chen deleted the feat/http-conditional-batch branch June 21, 2026 19:14
@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