From 4fd30cc25f1cfec62e88ad8f0ad176d9d3d7504c Mon Sep 17 00:00:00 2001 From: TroyHernandez Date: Wed, 10 Jun 2026 12:25:38 -0500 Subject: [PATCH 1/3] Release prep for 0.3.0: refresh stale release docs cran-comments rewritten for 0.3.0 (was still describing 0.2.0): R 4.6.0 test environment, the full additive changelog, and an explicit update-frequency note (four weeks since 0.2.0, driven by the downstream mx.client E2EE layer; batched into one release). README: drop the which-version-is-on-CRAN assertion (stale inside a tarball), correct the canonical-JSON assertion count to 107. DESCRIPTION Date refreshed. Also harden mx_upload(): tolerate non-JSON error bodies (proxy/HTML) so the status check raises mx_error_* instead of a jsonlite parse error. --- DESCRIPTION | 2 +- R/media.R | 10 +++++++-- README.md | 5 ++--- cran-comments.md | 58 ++++++++++++++++++++++++++++++------------------ 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 03ef64e..3130f3c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: mx.api Type: Package Title: Minimal Matrix Client-Server API Version: 0.3.0 -Date: 2026-05-13 +Date: 2026-06-10 Authors@R: c( person("Troy", "Hernandez", role = c("aut", "cre"), email = "troy@cornball.ai", diff --git a/R/media.R b/R/media.R index 2377aad..5a2bc16 100644 --- a/R/media.R +++ b/R/media.R @@ -53,8 +53,14 @@ mx_upload <- function(session, path, content_type = NULL, filename = NULL) { Accept = "application/json" ) resp <- curl::curl_fetch_memory(url, handle = h) - parsed <- jsonlite::fromJSON(rawToChar(resp$content), - simplifyVector = FALSE) + # A proxy or misconfigured server can answer non-JSON (HTML, plain + # text); don't let the parse error mask the real failure -- fall + # through to mx_raise with whatever body came back. + parsed <- tryCatch( + jsonlite::fromJSON(rawToChar(resp$content), + simplifyVector = FALSE), + error = function(e) list(raw = rawToChar(resp$content)) + ) if (resp$status_code >= 400) { mx_raise(parsed$errcode %||% "HTTP", diff --git a/README.md b/README.md index 17a242e..9bc46b6 100644 --- a/README.md +++ b/README.md @@ -130,12 +130,11 @@ mx_canonical_json(1.5) #> Error: mx_canonical_json: non-integer number 1.5 disallowed ``` -97 assertions exercise the encoder (see `inst/tinytest/test_canonical_json.R`). +107 assertions exercise the encoder (see `inst/tinytest/test_canonical_json.R`). ## Status -**0.3.0** on `main`. The 0.2.0 release is on CRAN. The 0.3.0 delta is -additive: +**0.3.0**. Relative to 0.2.0 the delta is additive: - Generic event and state plumbing: `mx_send_event`, `mx_set_state`, `mx_get_state` (needed for `m.room.encrypted` / `m.room.encryption`). diff --git a/cran-comments.md b/cran-comments.md index 6a16cd6..3c51698 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -4,36 +4,50 @@ ## Test environments -* local Ubuntu 24.04, R 4.5.3 +* local Ubuntu 24.04, R 4.6.0 * GitHub Actions (ubuntu-latest, macos-latest) via r-ci * win-builder R-devel and R-release (`tinypkgr::check_win_devel()`) -## What's new in 0.2.0 - -This is the first feature update after the 0.1.0 initial CRAN release. -The delta is additive: five new exports, no changes to the existing -0.1.0 surface. - -* `mx_keys_upload()`, `mx_keys_query()`, `mx_keys_claim()`, and - `mx_send_to_device()` cover the Matrix Client-Server endpoints used - to coordinate end-to-end encryption. The package itself remains - crypto-free; these endpoints carry payloads that an external signer - produces. -* `mx_canonical_json()` is the byte-stable canonical JSON encoder - Matrix's signing rules require. It is exercised by 107 tinytest - assertions covering UTF-8 sort, integer-vs-float, NaN/Inf/NA - rejection, control-char escaping, duplicate-key rejection, and the - realistic `/keys/upload` payload shape. -* DESCRIPTION text expanded to mention the new transport surface and - to add URLs for the named homeserver implementations ('Synapse', - 'Conduit') alongside the existing 'Matrix' specification link. +## Update frequency + +0.2.0 was published 2026-05-13, so this update arrives after about four +weeks. The driver is a downstream package under development +('mx.client', GitHub) whose end-to-end-encryption layer needs the +generic event/state senders added here; batching that need together +with the rest of the roadmap (below) into one release seemed kinder to +CRAN than two small ones. + +## What's new in 0.3.0 + +Additive only; no changes to the existing 0.2.0 surface. + +* Generic room-event and state plumbing: `mx_send_event()`, + `mx_set_state()`, `mx_get_state()` (what an external + end-to-end-encryption layer needs to send `m.room.encrypted` events + and read `m.room.encryption` state). +* Media messages: `mx_send_media()` uploads a file and posts the + referencing message, deriving the msgtype from the MIME type; + `mx_send_file()` / `mx_send_image()` / `mx_send_audio()` / + `mx_send_video()` fix it explicitly. `mx_guess_mime()` is exported; + `mx_media_config()` reports the server's upload cap. `mx_upload()` + now streams from disk instead of reading files into memory. +* Bot lifecycle endpoints: `mx_room_invite()`, `mx_redact()`, + `mx_typing()`, `mx_profile()`, `mx_set_displayname()`, + `mx_set_avatar_url()`. +* Account data: `mx_get_account_data()` / `mx_set_account_data()`. +* Devices: `mx_devices()`, `mx_delete_device()` (user-interactive auth + payloads pass through verbatim). +* HTTP failures now signal classed conditions (`mx_error_`) + carrying the Matrix errcode, HTTP status, and parsed body; message + text is unchanged from previous releases. ## Notes on examples Examples that talk to a homeserver continue to use `\dontrun{}`: they require valid credentials plus a running Matrix homeserver, so they -cannot execute under `R CMD check --as-cran`. `mx_session()` and -`mx_canonical_json()` are pure functions with runnable examples. +cannot execute under `R CMD check --as-cran`. Pure functions +(`mx_session()`, `mx_canonical_json()`, `mx_guess_mime()`) have +runnable examples. ## Downstream dependencies From 5a203f2943991db929d65569ceb2bf2fcfb09385 Mon Sep 17 00:00:00 2001 From: TroyHernandez Date: Wed, 10 Jun 2026 12:40:04 -0500 Subject: [PATCH 2/3] cran-comments: record the Windows 10 / R 4.5.1 check Run on windows-hr: R CMD check --as-cran --no-manual, tests OK, 1 environmental NOTE (offline world-clock timestamp verification). --- cran-comments.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index 3c51698..a3317eb 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -5,17 +5,9 @@ ## Test environments * local Ubuntu 24.04, R 4.6.0 +* local Windows 10, R 4.5.1 (1 NOTE: "unable to verify current time", + an environmental artifact of the offline world-clock check) * GitHub Actions (ubuntu-latest, macos-latest) via r-ci -* win-builder R-devel and R-release (`tinypkgr::check_win_devel()`) - -## Update frequency - -0.2.0 was published 2026-05-13, so this update arrives after about four -weeks. The driver is a downstream package under development -('mx.client', GitHub) whose end-to-end-encryption layer needs the -generic event/state senders added here; batching that need together -with the rest of the roadmap (below) into one release seemed kinder to -CRAN than two small ones. ## What's new in 0.3.0 From 76ea8775189e07e7d1c6d5311e6567d754e17d34 Mon Sep 17 00:00:00 2001 From: TroyHernandez Date: Wed, 10 Jun 2026 12:46:32 -0500 Subject: [PATCH 3/3] cran-comments: Windows R 4.6.0 and R-devel (4.7.0 pre) both check OK Run on windows-hr alongside the earlier 4.5.1 pass; the newer versions produce zero NOTEs. --- cran-comments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index a3317eb..d98e9b7 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -5,8 +5,8 @@ ## Test environments * local Ubuntu 24.04, R 4.6.0 -* local Windows 10, R 4.5.1 (1 NOTE: "unable to verify current time", - an environmental artifact of the offline world-clock check) +* local Windows 10: R 4.6.0 and R-devel (4.7.0 pre-release), both OK; + R 4.5.1 with 1 environmental NOTE ("unable to verify current time") * GitHub Actions (ubuntu-latest, macos-latest) via r-ci ## What's new in 0.3.0