Skip to content

fix(builders): harden stream pagination, RFC 8058 builders, and PEP 440 semver - #176

Draft
skupriienko wants to merge 1 commit into
wave-3-boot-slots-poolingfrom
wave-4-builders-semver
Draft

skupriienko wants to merge 1 commit into
wave-3-boot-slots-poolingfrom
wave-4-builders-semver

Conversation

@skupriienko

@skupriienko skupriienko commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Stack (v1.9.2 Hardening Rollout)

Wave PR Base <- Head Scope
Wave 1 #173 master <- wave-1-tooling-hygiene CRIT-03, CRIT-04, CRIT-05, HIGH-06
Wave 2 #174 wave-1-tooling-hygiene <- wave-2-transport-redaction CRIT-01, CRIT-02, HIGH-01 (lock), HIGH-02, HIGH-03, HIGH-04 (path), OPT-09
Wave 3 #175 wave-2-transport-redaction <- wave-3-boot-slots-pooling OPT-01..OPT-07, OPT-10, OPT-11, HIGH-01 (warn_unclosed)
-> Wave 4 (This PR) #176 wave-3-boot-slots-pooling <- wave-4-builders-semver HIGH-04 (bool/stream), HIGH-05, HIGH-07, OPT-08
Wave 5 #177 wave-4-builders-semver <- wave-5-typing-stateful-tests MOD-02, MOD-04

Merge in order: #173 -> #174 -> #175 -> #176 -> #177.

Note

Stacked PR workflow note: ClusterFuzzLite PR fuzzing runs immediately on all PRs. Workflows scoped to branches: [master] (CI, PR Validation, Continuous Security Verification, CodeQL) trigger automatically as parent PRs merge into master and GitHub retargets this PR's base branch to master.


Summary

Wave 4 of 5 for v1.9.2 (stacked on #175 / wave-3-boot-slots-pooling). Hardens Endpoint.stream() pagination boundaries (bool rejection, Offset normalization, max_items cap, malformed JSON MailjetApiError), adds RFC 8058 One-Click Unsubscribe and inline ContentID / cid: validation plus single-encode 102 KB Gmail clipping and 50-message / 15 MB batch guards in builders.py, fixes PEP 440 prerelease semver parsing (1.9.1rc2 -> (1, 9, 1)), and adds optional orjson compact JSON parity plus an ASCII domain normalization fast path.


Actions

  • Pagination Stream Boundaries (mailjet_rest/endpoint.py, HIGH-04):
    • Rejected bool arguments for chunk_size and max_items, normalized case-insensitive Offset filter keys, enforced max_items early termination, and wrapped non-JSON or non-dict .stream() payloads in MailjetApiError.
  • RFC 8058, Inline cid: & Gmail Clipping Builders (mailjet_rest/builders.py, mailjet_rest/types.py, HIGH-05):
    • Added MessageBuilder.set_one_click_unsubscribe() enforcing https:// URLs with List-Unsubscribe and List-Unsubscribe-Post: List-Unsubscribe=One-Click.
    • Added ContentID support in add_inlined_attachment() with missing cid: reference warnings under ENABLE_SPAM_GUARD, added single-encode 102,400-byte Gmail clipping boundary warnings on HTMLPart, and enforced <= 50 messages and <= 15 MB total JSON payload caps in SendPayloadBuilder.build().
  • PEP 440 Prerelease Semver Parsing (mailjet_rest/utils/version.py, HIGH-07):
    • Added parse_semver_triplet() and updated clean_version() so prerelease tags (1.9.1rc2, 1.9.2a1, 1.9.2.dev3) parse cleanly to (1, 9, 1) / (1, 9, 2) without merging trailing digits.
  • Compact orjson & ASCII Domain Fast Path (mailjet_rest/utils/guardrails.py, OPT-08):
    • Added optional orjson serialization parity with stdlib json (separators=(",", ":")) and an ASCII domain fast path with RFC 1035 domain and label length bounds in normalize_domain().
  • Unit, Property & Stream Fuzz Tests (tests/unit/test_wave4_builders_semver.py, tests/property/*, tests/fuzz/fuzz_pagination_stream.py):
    • Added comprehensive tests covering stream bounds, malformed stream responses, RFC 8058 validation, cid: warnings, 102 KB boundary warnings, 1rc2 semver assertions, and orjson parity.

Verification & Testing

  • Verified offline checks across the v1.9.2 stack: ruff check ., ruff format --check ., mypy --strict mailjet_rest, pyright mailjet_rest, slotscheck -m mailjet_rest, bandit -c pyproject.toml -r mailjet_rest, and pytest -n auto -W error tests/unit tests/property tests/regression.
  • Live Mailjet API network tests (pytest -m network, samples/smoke_readme_runner.py) were skipped locally due to absent MJ_APIKEY_PUBLIC / MJ_APIKEY_PRIVATE credentials.

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