From 2ce8eb0ce43313c22fbba32f2f11dc9bb3d103f3 Mon Sep 17 00:00:00 2001 From: Niels Mokkenstorm Date: Mon, 20 Jul 2026 13:57:03 +0200 Subject: [PATCH] chore(deps): unpin atproto client 0.3.0 and codegen 0.4.2 onto structured transport errors --- server/gleam.toml | 3 ++- server/manifest.toml | 10 ++++++---- .../src/at_record_server/atproto_client.gleam | 16 +++++++++++++--- .../at_record_server/catalog_entities.gleam | 11 ++++++----- .../src/at_record_server/catalog_import.gleam | 5 +++-- server/src/at_record_server/edit_inbox.gleam | 7 ++++--- .../at_record_server/musicbrainz_client.gleam | 9 ++++++--- server/src/at_record_server/oauth/authed.gleam | 18 ++++++++---------- server/src/at_record_server/oauth/tokens.gleam | 8 +++++--- .../src/at_record_server/oauth/transport.gleam | 1 + server/src/at_record_server/promotion.gleam | 7 ++++--- server/src/at_record_server/wiring.gleam | 2 +- server/test/actor_shelf_test.gleam | 5 +++-- server/test/cover_proxy_test.gleam | 3 ++- server/test/discogs_scan_test.gleam | 8 ++++++-- server/test/edit_inbox_test.gleam | 7 +++++-- server/test/graph_handler_test.gleam | 4 +++- server/test/promotion_test.gleam | 5 ++++- server/test/support.gleam | 3 ++- shared/gleam.toml | 5 +++-- shared/manifest.toml | 12 +++++++----- web/manifest.toml | 11 ++++++----- 22 files changed, 100 insertions(+), 60 deletions(-) diff --git a/server/gleam.toml b/server/gleam.toml index 28d4748..0488b05 100644 --- a/server/gleam.toml +++ b/server/gleam.toml @@ -11,7 +11,7 @@ gleam_httpc = ">= 5.0.0 and < 6.0.0" gleam_json = ">= 3.1.0 and < 4.0.0" gleam_erlang = ">= 1.3.0 and < 2.0.0" at_record_shared = { path = "../shared" } -atproto_client = ">= 0.1.0 and < 1.0.0" +atproto_client = ">= 0.3.0 and < 1.0.0" gleam_time = ">= 1.8.0 and < 2.0.0" gleam_http = ">= 4.3.0 and < 5.0.0" envoy = ">= 1.0.0 and < 2.0.0" @@ -22,6 +22,7 @@ gleam_otp = ">= 1.2.0 and < 2.0.0" pog = ">= 4.1.0 and < 5.0.0" simplifile = ">= 2.5.0 and < 3.0.0" stratus = ">= 3.0.0 and < 4.0.0" +atproto_core = ">= 0.1.1 and < 1.0.0" [dev_dependencies] gleeunit = ">= 1.0.0 and < 2.0.0" diff --git a/server/manifest.toml b/server/manifest.toml index e1dc30d..8bd2c67 100644 --- a/server/manifest.toml +++ b/server/manifest.toml @@ -7,8 +7,9 @@ # You should check this file into your source control repository. packages = [ - { name = "at_record_shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["atproto_client", "gleam_json", "gleam_stdlib"], source = "local", path = "../shared" }, - { name = "atproto_client", version = "0.1.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_http", "gleam_json", "gleam_stdlib", "gleam_time", "gose", "kryptos"], otp_app = "atproto_client", source = "hex", outer_checksum = "97A6C830B0CF6F3EB9BA6ECF92C7F4E57366919F417DA35FD325431C03B95E19" }, + { name = "at_record_shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["atproto_client", "atproto_core", "gleam_json", "gleam_stdlib"], source = "local", path = "../shared" }, + { name = "atproto_client", version = "0.3.0", build_tools = ["gleam"], requirements = ["atproto_core", "gleam_crypto", "gleam_http", "gleam_json", "gleam_stdlib", "gleam_time", "gose", "kryptos"], otp_app = "atproto_client", source = "hex", outer_checksum = "EF865263E9B1F3F7DFCF474C2C193D328A8E2A2F4D4612D48B31DE14944863EC" }, + { name = "atproto_core", version = "0.1.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_json", "gleam_stdlib"], otp_app = "atproto_core", source = "hex", outer_checksum = "A06B327466847AC6ABB05EC81428C02A1B77E651788DFFA390D66C69EB2F3875" }, { name = "backoff", version = "1.1.6", build_tools = ["rebar3"], requirements = [], otp_app = "backoff", source = "hex", outer_checksum = "CF0CFFF8995FB20562F822E5CC47D8CCF664C5ECDC26A684CBE85C225F9D7C39" }, { name = "bigi", version = "4.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "bigi", source = "hex", outer_checksum = "44FEDF1DF5C1F426A80B67C32B976D0828D66524E11BDC2DD22B78D37C883BA7" }, { name = "directories", version = "1.2.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_stdlib", "platform", "simplifile"], otp_app = "directories", source = "hex", outer_checksum = "D13090CFCDF6759B87217E8DDD73A75903A700148A82C1D33799F333E249BF9E" }, @@ -38,14 +39,15 @@ packages = [ { name = "pgo", version = "0.20.0", build_tools = ["rebar3"], requirements = ["backoff", "opentelemetry_api", "pg_types"], otp_app = "pgo", source = "hex", outer_checksum = "2F11E6649CEB38E569EF56B16BE1D04874AE5B11A02867080A2817CE423C683B" }, { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, { name = "pog", version = "4.1.0", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_otp", "gleam_stdlib", "gleam_time", "pgo"], otp_app = "pog", source = "hex", outer_checksum = "E4AFBA39A5FAA2E77291836C9683ADE882E65A06AB28CA7D61AE7A3AD61EBBD5" }, - { name = "simplifile", version = "2.5.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "6C72DCCDF25C38A5931740B30E823969F33106831FD1637719B5EDBCA30027A4" }, + { name = "simplifile", version = "2.6.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A33C345F0A4FFB91DCCD4220114534A58C387964A5F17B3E472CEBD1ADA9FFB4" }, { name = "stratus", version = "3.0.0", build_tools = ["gleam"], requirements = ["exception", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gramps", "logging"], otp_app = "stratus", source = "hex", outer_checksum = "21C93D657E4E7964E36EACDE83609459F259289DF403B5FEBD3C60612594BE24" }, { name = "wisp", version = "2.2.2", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "5FF5F1E288C3437252ABB93D8F9CF42FF652CE7AD54480CFE736038DC09C4F22" }, ] [requirements] at_record_shared = { path = "../shared" } -atproto_client = { version = ">= 0.1.0 and < 1.0.0" } +atproto_client = { version = ">= 0.3.0 and < 1.0.0" } +atproto_core = { version = ">= 0.1.1 and < 1.0.0" } envoy = { version = ">= 1.0.0 and < 2.0.0" } gleam_crypto = { version = ">= 1.6.0 and < 2.0.0" } gleam_erlang = { version = ">= 1.3.0 and < 2.0.0" } diff --git a/server/src/at_record_server/atproto_client.gleam b/server/src/at_record_server/atproto_client.gleam index 0720fbf..c9c3c8c 100644 --- a/server/src/at_record_server/atproto_client.gleam +++ b/server/src/at_record_server/atproto_client.gleam @@ -2,7 +2,8 @@ //// failures on any method, but response timeouts only on idempotent methods, so //// a `createRecord` POST can't be silently duplicated. -import atproto/xrpc.{type Client, Client} +import atproto/xrpc.{type Client, type TransportError, Client} +import atproto_core/xrpc as core_xrpc import gleam/http.{type Method} import gleam/http/request.{type Request} import gleam/http/response.{type Response} @@ -21,7 +22,7 @@ pub fn client() -> Client { fn send( req: Request(BitArray), tries: Int, -) -> Result(Response(BitArray), String) { +) -> Result(Response(BitArray), TransportError) { case httpc.configure() |> httpc.timeout(timeout_ms) |> httpc.dispatch_bits(req) { @@ -39,11 +40,20 @@ fn send( ) send(req, tries - 1) } - False -> Error(string.inspect(e)) + False -> Error(httpc_error_to_transport(e)) } } } +fn httpc_error_to_transport(error: httpc.HttpError) -> TransportError { + case error { + httpc.ResponseTimeout -> core_xrpc.Timeout + httpc.FailedToConnect(_, _) -> + core_xrpc.ConnectionFailed(string.inspect(error)) + httpc.InvalidUtf8Response -> core_xrpc.Other(string.inspect(error)) + } +} + fn retryable(method: Method, error: httpc.HttpError) -> Bool { case error { httpc.FailedToConnect(_, _) -> True diff --git a/server/src/at_record_server/catalog_entities.gleam b/server/src/at_record_server/catalog_entities.gleam index c0d5d20..defcedb 100644 --- a/server/src/at_record_server/catalog_entities.gleam +++ b/server/src/at_record_server/catalog_entities.gleam @@ -24,6 +24,7 @@ import at_record_server/provenance import at_record_server/release_similarity import atproto/repo import atproto/xrpc.{type Client} +import atproto_core/xrpc as core_xrpc import gleam/dict.{type Dict} import gleam/dynamic/decode import gleam/int @@ -312,7 +313,7 @@ fn backfill_artist( ), record:, )) - Error(xrpc.BadStatus(status: 429, ..)) -> Error(RateLimited) + Error(core_xrpc.BadStatus(status: 429, ..)) -> Error(RateLimited) Error(e) -> { wisp.log_warning( "artist mbid backfill failed for " @@ -505,7 +506,7 @@ fn create( { Ok(created) -> Ok(defs.CatalogRef(uri: created.uri, cid: created.cid, external_ids: None)) - Error(xrpc.BadStatus(status: 429, ..)) -> Error(RateLimited) + Error(core_xrpc.BadStatus(status: 429, ..)) -> Error(RateLimited) Error(e) -> { wisp.log_warning(context <> ": " <> xrpc_error(e)) Error(Failed) @@ -515,8 +516,8 @@ fn create( fn xrpc_error(e: xrpc.XrpcError) -> String { case e { - xrpc.RequestFailed(m) -> m - xrpc.BadStatus(status:, ..) -> "status " <> int.to_string(status) - xrpc.DecodeFailed(m) -> m + core_xrpc.RequestFailed(te) -> xrpc.transport_error_to_string(te) + core_xrpc.BadStatus(status:, ..) -> "status " <> int.to_string(status) + core_xrpc.DecodeFailed(m) -> m } } diff --git a/server/src/at_record_server/catalog_import.gleam b/server/src/at_record_server/catalog_import.gleam index d55224a..b53ac18 100644 --- a/server/src/at_record_server/catalog_import.gleam +++ b/server/src/at_record_server/catalog_import.gleam @@ -21,6 +21,7 @@ import at_record_server/promotion import at_record_server/provenance import atproto/blob import atproto/xrpc.{type Client} +import atproto_core/xrpc as core_xrpc import gleam/dict import gleam/int import gleam/list @@ -441,7 +442,7 @@ fn backfill_one( |> event_log.append(client, session, _) |> result.map_error(fn(e) { case e { - xrpc.BadStatus(status: 429, ..) -> "rate limited" + core_xrpc.BadStatus(status: 429, ..) -> "rate limited" _ -> "write failed" } }) @@ -694,7 +695,7 @@ fn write_genesis_event( entity_failed: outcome.report.failed, details_missing: details_missing, ) - Error(xrpc.BadStatus(status: 429, ..)) -> + Error(core_xrpc.BadStatus(status: 429, ..)) -> Stopped("PDS rate limited; run again later", outcome.report.failed) Error(_) -> Stopped("PDS write failed; run again to resume", outcome.report.failed) diff --git a/server/src/at_record_server/edit_inbox.gleam b/server/src/at_record_server/edit_inbox.gleam index b5df681..53d9d2c 100644 --- a/server/src/at_record_server/edit_inbox.gleam +++ b/server/src/at_record_server/edit_inbox.gleam @@ -18,6 +18,7 @@ import at_record_server/oauth/sessions.{type OauthSession} import atproto/constellation import atproto/repo import atproto/xrpc.{type Client, type XrpcError} +import atproto_core/xrpc as core_xrpc import gleam/dynamic/decode import gleam/int import gleam/list @@ -247,8 +248,8 @@ fn current_fields( fn xrpc_error(e: XrpcError) -> String { case e { - xrpc.RequestFailed(m) -> m - xrpc.BadStatus(status:, ..) -> "status " <> int.to_string(status) - xrpc.DecodeFailed(m) -> m + core_xrpc.RequestFailed(te) -> xrpc.transport_error_to_string(te) + core_xrpc.BadStatus(status:, ..) -> "status " <> int.to_string(status) + core_xrpc.DecodeFailed(m) -> m } } diff --git a/server/src/at_record_server/musicbrainz_client.gleam b/server/src/at_record_server/musicbrainz_client.gleam index d9844a4..816ad54 100644 --- a/server/src/at_record_server/musicbrainz_client.gleam +++ b/server/src/at_record_server/musicbrainz_client.gleam @@ -92,7 +92,10 @@ fn fetch_hint(client: Client, barcode: String) -> Option(ReleaseHint) { Ok(resp) -> parse_barcode_hint(resp.body) Error(e) -> { wisp.log_warning( - "musicbrainz hint lookup failed for barcode:" <> barcode <> ": " <> e, + "musicbrainz hint lookup failed for barcode:" + <> barcode + <> ": " + <> xrpc.transport_error_to_string(e), ) None } @@ -199,12 +202,12 @@ fn by_discogs_url(client: Client, discogs_id: Int) -> Option(MbRelease) { } } -fn log_failure(discogs_id: Int, error: String) -> Nil { +fn log_failure(discogs_id: Int, error: xrpc.TransportError) -> Nil { wisp.log_warning( "musicbrainz lookup failed for discogs:" <> int.to_string(discogs_id) <> ": " - <> error, + <> xrpc.transport_error_to_string(error), ) } diff --git a/server/src/at_record_server/oauth/authed.gleam b/server/src/at_record_server/oauth/authed.gleam index 12ab772..dc48822 100644 --- a/server/src/at_record_server/oauth/authed.gleam +++ b/server/src/at_record_server/oauth/authed.gleam @@ -9,7 +9,8 @@ import at_record_server/oauth/session_store import at_record_server/oauth/sessions.{type OauthSession, OauthSession} import at_record_server/oauth/tokens import at_record_server/oauth/transport -import atproto/xrpc.{type Client} +import atproto/xrpc.{type Client, type TransportError} +import atproto_core/xrpc as core_xrpc import gleam/bit_array import gleam/crypto import gleam/http @@ -66,7 +67,7 @@ fn dpop_send( base: Client, session: OauthSession, req: Request(BitArray), -) -> Result(Response(BitArray), String) { +) -> Result(Response(BitArray), TransportError) { let method = http.method_to_string(req.method) |> string.uppercase let target = htu(req) let ath = @@ -110,14 +111,11 @@ fn send_once( target: String, ath: String, nonce: Option(String), -) -> Result(Response(BitArray), String) { - use proof <- result.try(dpop.proof( - session.dpop_key, - method:, - url: target, - nonce:, - ath: Some(ath), - )) +) -> Result(Response(BitArray), TransportError) { + use proof <- result.try( + dpop.proof(session.dpop_key, method:, url: target, nonce:, ath: Some(ath)) + |> result.map_error(fn(m) { core_xrpc.Other("dpop proof: " <> m) }), + ) req |> request.set_header("authorization", "DPoP " <> session.access_token) |> request.set_header("dpop", proof) diff --git a/server/src/at_record_server/oauth/tokens.gleam b/server/src/at_record_server/oauth/tokens.gleam index 5100419..2de6a91 100644 --- a/server/src/at_record_server/oauth/tokens.gleam +++ b/server/src/at_record_server/oauth/tokens.gleam @@ -9,6 +9,7 @@ import at_record_server/oauth/store.{type PendingFlow} import at_record_server/oauth/transport import atproto/oauth/metadata import atproto/xrpc +import atproto_core/xrpc as core_xrpc import gleam/dynamic/decode import gleam/int import gleam/list @@ -155,8 +156,9 @@ fn decoder() -> decode.Decoder(Tokens) { fn describe(e: xrpc.XrpcError) -> String { case e { - xrpc.DecodeFailed(m) -> "decode token response: " <> m - xrpc.RequestFailed(m) -> m - xrpc.BadStatus(status:, body:, ..) -> int.to_string(status) <> ": " <> body + core_xrpc.DecodeFailed(m) -> "decode token response: " <> m + core_xrpc.RequestFailed(te) -> xrpc.transport_error_to_string(te) + core_xrpc.BadStatus(status:, body:, ..) -> + int.to_string(status) <> ": " <> body } } diff --git a/server/src/at_record_server/oauth/transport.gleam b/server/src/at_record_server/oauth/transport.gleam index 661893a..3506c9d 100644 --- a/server/src/at_record_server/oauth/transport.gleam +++ b/server/src/at_record_server/oauth/transport.gleam @@ -66,4 +66,5 @@ fn attempt( |> request.set_header("dpop", proof) |> request.set_body(uri.query_to_string(form)) |> xrpc.send_text(client, _) + |> result.map_error(xrpc.transport_error_to_string) } diff --git a/server/src/at_record_server/promotion.gleam b/server/src/at_record_server/promotion.gleam index e80eab8..50cd147 100644 --- a/server/src/at_record_server/promotion.gleam +++ b/server/src/at_record_server/promotion.gleam @@ -19,6 +19,7 @@ import atproto/blob.{type Blob} import atproto/constellation import atproto/repo import atproto/xrpc.{type Client} +import atproto_core/xrpc as core_xrpc import gleam/dict.{type Dict} import gleam/dynamic/decode import gleam/int @@ -469,8 +470,8 @@ fn barcodes(values: List(String)) -> Option(List(catalog_release.Identifier)) { fn xrpc_error(e: xrpc.XrpcError) -> String { case e { - xrpc.RequestFailed(m) -> m - xrpc.BadStatus(status:, ..) -> "status " <> int.to_string(status) - xrpc.DecodeFailed(m) -> m + core_xrpc.RequestFailed(te) -> xrpc.transport_error_to_string(te) + core_xrpc.BadStatus(status:, ..) -> "status " <> int.to_string(status) + core_xrpc.DecodeFailed(m) -> m } } diff --git a/server/src/at_record_server/wiring.gleam b/server/src/at_record_server/wiring.gleam index 6111489..2768786 100644 --- a/server/src/at_record_server/wiring.gleam +++ b/server/src/at_record_server/wiring.gleam @@ -62,7 +62,7 @@ fn text_sender(client: Client) { fn(r) { case xrpc.send_text(client, r) { Ok(resp) -> Ok(#(resp.status, resp.body)) - Error(e) -> Error(e) + Error(e) -> Error(xrpc.transport_error_to_string(e)) } } } diff --git a/server/test/actor_shelf_test.gleam b/server/test/actor_shelf_test.gleam index 6f014d5..e6dd464 100644 --- a/server/test/actor_shelf_test.gleam +++ b/server/test/actor_shelf_test.gleam @@ -9,6 +9,7 @@ import at_record_server/catalog_deps.{type Deps, Deps} import at_record_server/context.{type Context} import at_record_server/handlers/shelf import atproto/xrpc +import atproto_core/xrpc as core_xrpc import gleam/bit_array import gleam/dict import gleam/dynamic/decode @@ -128,7 +129,7 @@ fn network_client(records_body: String) -> xrpc.Client { } fn failing_resolver_client() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error("resolver unreachable") }) + xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("resolver unreachable")) }) } fn pds_unreachable_client() -> xrpc.Client { @@ -136,7 +137,7 @@ fn pds_unreachable_client() -> xrpc.Client { case req.host { "resolver.test" -> Ok(response.Response(200, [], bit_array.from_string(resolve_body()))) - _ -> Error("pds unreachable") + _ -> Error(core_xrpc.Other("pds unreachable")) } }) } diff --git a/server/test/cover_proxy_test.gleam b/server/test/cover_proxy_test.gleam index 627e776..a09d871 100644 --- a/server/test/cover_proxy_test.gleam +++ b/server/test/cover_proxy_test.gleam @@ -6,6 +6,7 @@ import at_record_server/context.{type Context} import at_record_server/handlers/cover_proxy import atproto/xrpc +import atproto_core/xrpc as core_xrpc import envoy import gleam/bit_array import gleam/http/response @@ -48,7 +49,7 @@ fn network_client() -> xrpc.Client { } fn failing_resolver_client() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error("resolver unreachable") }) + xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("resolver unreachable")) }) } fn resolves_but_blob_fetch_fails_client() -> xrpc.Client { diff --git a/server/test/discogs_scan_test.gleam b/server/test/discogs_scan_test.gleam index 907f5f5..a953ddc 100644 --- a/server/test/discogs_scan_test.gleam +++ b/server/test/discogs_scan_test.gleam @@ -13,6 +13,7 @@ import at_record_server/oauth/config import at_record_server/oauth/session_store import at_record_server/oauth/sessions import atproto/xrpc +import atproto_core/xrpc as core_xrpc import gleam/bit_array import gleam/http import gleam/http/request @@ -65,7 +66,9 @@ fn mb_returns_exact_match() -> xrpc.Client { } fn mb_fails() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error("musicbrainz unreachable") }) + xrpc.Client(send: fn(_req) { + Error(core_xrpc.Other("musicbrainz unreachable")) + }) } fn a_session() -> sessions.OauthSession { @@ -212,7 +215,8 @@ pub fn network_miss_falls_through_to_the_discogs_chain_test() { } pub fn network_stage_failure_falls_through_to_discogs_test() { - let failing_client = xrpc.Client(send: fn(_req) { Error("unreachable") }) + let failing_client = + xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("unreachable")) }) let #(ctx, cfg) = test_context_with_users(failing_client, discogs_always_misses, [ a_known_user(), diff --git a/server/test/edit_inbox_test.gleam b/server/test/edit_inbox_test.gleam index e9c41b5..7c97e6a 100644 --- a/server/test/edit_inbox_test.gleam +++ b/server/test/edit_inbox_test.gleam @@ -10,6 +10,7 @@ import at_record_server/oauth/sessions.{type OauthSession} import atproto/constellation.{type Backlink, Backlink, BacklinksPage} import atproto/uri import atproto/xrpc +import atproto_core/xrpc as core_xrpc import gleam/int import gleam/list import gleam/option.{None, Some} @@ -26,7 +27,7 @@ fn session() -> OauthSession { /// A client whose every request fails, so `handle_resolver.resolve_handle` /// degrades to `None` without needing a live PLC directory. fn no_network_client() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error("offline") }) + xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("offline")) }) } /// [1, 2, .., count] @@ -381,7 +382,9 @@ pub fn a_failed_backlinks_lookup_skips_that_release_rather_than_failing_test() { let owned = own_release(1, None) let deps = Deps( - backlinks: fn(_subject, _source) { Error(xrpc.RequestFailed("down")) }, + backlinks: fn(_subject, _source) { + Error(core_xrpc.RequestFailed(core_xrpc.Other("down"))) + }, fetch_release: fn(_) { panic as "fetch_release must not be called" }, fetch_edit: fn(_) { panic as "fetch_edit must not be called" }, release_mbid: fn(_, _) { panic as "release_mbid must not be called" }, diff --git a/server/test/graph_handler_test.gleam b/server/test/graph_handler_test.gleam index 26c8075..18590b7 100644 --- a/server/test/graph_handler_test.gleam +++ b/server/test/graph_handler_test.gleam @@ -89,7 +89,9 @@ fn create_record_response(rkey: String) -> String { |> json.to_string } -fn ok_response(body: String) -> Result(response.Response(BitArray), String) { +fn ok_response( + body: String, +) -> Result(response.Response(BitArray), xrpc.TransportError) { Ok(response.Response(200, [], bit_array.from_string(body))) } diff --git a/server/test/promotion_test.gleam b/server/test/promotion_test.gleam index a04b0ad..4826fdd 100644 --- a/server/test/promotion_test.gleam +++ b/server/test/promotion_test.gleam @@ -12,6 +12,7 @@ import at_record_server/oauth/sessions.{type OauthSession} import at_record_server/promotion.{OwnRelease, Promoted} import atproto/constellation.{Backlink, BacklinksPage} import atproto/xrpc +import atproto_core/xrpc as core_xrpc import gleam/bit_array import gleam/dict import gleam/dynamic/decode @@ -278,7 +279,9 @@ pub fn unverified_backlink_falls_through_to_mint_test() { pub fn constellation_outage_still_mints_test() { let deps = Deps( - backlinks: fn(_, _) { Error(xrpc.RequestFailed("down")) }, + backlinks: fn(_, _) { + Error(core_xrpc.RequestFailed(core_xrpc.Other("down"))) + }, fetch_release: fn(_) { panic as "no candidates to verify" }, fetch_edit: fn(_) { panic as "fetch_edit must not be called" }, release_mbid: fn(_, _) { None }, diff --git a/server/test/support.gleam b/server/test/support.gleam index 7cb2d3c..1a99396 100644 --- a/server/test/support.gleam +++ b/server/test/support.gleam @@ -18,6 +18,7 @@ import at_record_server/oauth/sessions import at_record_server/oauth/sessions_memory import at_record_server/oauth/store import atproto/xrpc +import atproto_core/xrpc as core_xrpc import gleam/dict import gleam/dynamic/decode import gleam/json @@ -33,7 +34,7 @@ pub fn xrpc(rest: String) -> String { } pub fn unreachable_client() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error("unused") }) + xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("unused")) }) } pub fn unreachable_catalog_deps() -> catalog_deps.Deps { diff --git a/shared/gleam.toml b/shared/gleam.toml index 3eade57..785b354 100644 --- a/shared/gleam.toml +++ b/shared/gleam.toml @@ -6,11 +6,12 @@ licences = ["MIT"] [dependencies] gleam_stdlib = ">= 1.0.0 and < 2.0.0" gleam_json = ">= 3.1.0 and < 4.0.0" -atproto_client = ">= 0.1.0 and < 1.0.0" +atproto_client = ">= 0.3.0 and < 1.0.0" +atproto_core = ">= 0.1.1 and < 1.0.0" [dev_dependencies] gleeunit = ">= 1.0.0 and < 2.0.0" -atproto_codegen = ">= 0.2.0 and < 1.0.0" +atproto_codegen = ">= 0.4.2 and < 1.0.0" atproto_sdl = ">= 0.3.0 and < 1.0.0" atproto_lexicon = ">= 0.2.0 and < 1.0.0" argv = ">= 1.1.0 and < 2.0.0" diff --git a/shared/manifest.toml b/shared/manifest.toml index 5a3cc36..5862fd4 100644 --- a/shared/manifest.toml +++ b/shared/manifest.toml @@ -8,8 +8,9 @@ packages = [ { name = "argv", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "3277D100448BDB4A29B6D58C0F36F631CBC349E8BDD09766C6309DF202831140" }, - { name = "atproto_client", version = "0.1.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_http", "gleam_json", "gleam_stdlib", "gleam_time", "gose", "kryptos"], otp_app = "atproto_client", source = "hex", outer_checksum = "97A6C830B0CF6F3EB9BA6ECF92C7F4E57366919F417DA35FD325431C03B95E19" }, - { name = "atproto_codegen", version = "0.3.0", build_tools = ["gleam"], requirements = ["argv", "atproto_lexicon", "gleam_erlang", "gleam_stdlib", "justin", "simplifile"], otp_app = "atproto_codegen", source = "hex", outer_checksum = "CA1DA478624BA2E3F7E54627BC1784F5F4093BDA12C50BF45CDD2E802D3BBD9B" }, + { name = "atproto_client", version = "0.3.0", build_tools = ["gleam"], requirements = ["atproto_core", "gleam_crypto", "gleam_http", "gleam_json", "gleam_stdlib", "gleam_time", "gose", "kryptos"], otp_app = "atproto_client", source = "hex", outer_checksum = "EF865263E9B1F3F7DFCF474C2C193D328A8E2A2F4D4612D48B31DE14944863EC" }, + { name = "atproto_codegen", version = "0.4.2", build_tools = ["gleam"], requirements = ["argv", "atproto_lexicon", "gleam_erlang", "gleam_stdlib", "justin", "simplifile"], otp_app = "atproto_codegen", source = "hex", outer_checksum = "28050EF01215BE1CF76F2CA253EF6BD536D52C7508ADFF79670C22242F83FAFD" }, + { name = "atproto_core", version = "0.1.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_json", "gleam_stdlib"], otp_app = "atproto_core", source = "hex", outer_checksum = "A06B327466847AC6ABB05EC81428C02A1B77E651788DFFA390D66C69EB2F3875" }, { name = "atproto_lexicon", version = "0.2.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_json", "gleam_stdlib", "simplifile"], otp_app = "atproto_lexicon", source = "hex", outer_checksum = "12531B8DE5180D2D29B199C60340555242EE50B04C16661DEBDFEF5D49DAB04F" }, { name = "atproto_sdl", version = "0.3.1", build_tools = ["gleam"], requirements = ["argv", "atproto_lexicon", "filepath", "gleam_stdlib", "simplifile"], otp_app = "atproto_sdl", source = "hex", outer_checksum = "7FE2BE91C2EECC45E068BCE6AA48D880A2CFA057357F7D3E82B09AE08898DD84" }, { name = "bigi", version = "4.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "bigi", source = "hex", outer_checksum = "44FEDF1DF5C1F426A80B67C32B976D0828D66524E11BDC2DD22B78D37C883BA7" }, @@ -25,13 +26,14 @@ packages = [ { name = "gose", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib", "gleam_time", "kryptos"], otp_app = "gose", source = "hex", outer_checksum = "F1F172D428A07BC6F3229F8363B85E6E8C79A5E9E28F27B07C2EFBF1F6B08114" }, { name = "justin", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "8B1C62269E8607D0A0ED698B7903984CE0BF7B6B3C0DEA3C6C8302B39402837B" }, { name = "kryptos", version = "1.4.0", build_tools = ["gleam"], requirements = ["bigi", "gleam_stdlib", "gleam_time"], otp_app = "kryptos", source = "hex", outer_checksum = "734DAB837962A4A45788F8E6350EF4A6DF20A1F54734736CD1FF3A03FFCE4C97" }, - { name = "simplifile", version = "2.5.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "6C72DCCDF25C38A5931740B30E823969F33106831FD1637719B5EDBCA30027A4" }, + { name = "simplifile", version = "2.6.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A33C345F0A4FFB91DCCD4220114534A58C387964A5F17B3E472CEBD1ADA9FFB4" }, ] [requirements] argv = { version = ">= 1.1.0 and < 2.0.0" } -atproto_client = { version = ">= 0.1.0 and < 1.0.0" } -atproto_codegen = { version = ">= 0.2.0 and < 1.0.0" } +atproto_client = { version = ">= 0.3.0 and < 1.0.0" } +atproto_codegen = { version = ">= 0.4.2 and < 1.0.0" } +atproto_core = { version = ">= 0.1.1 and < 1.0.0" } atproto_lexicon = { version = ">= 0.2.0 and < 1.0.0" } atproto_sdl = { version = ">= 0.3.0 and < 1.0.0" } gleam_http = { version = ">= 4.3.0 and < 5.0.0" } diff --git a/web/manifest.toml b/web/manifest.toml index e172205..a13cd0b 100644 --- a/web/manifest.toml +++ b/web/manifest.toml @@ -8,8 +8,9 @@ packages = [ { name = "argv", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "3277D100448BDB4A29B6D58C0F36F631CBC349E8BDD09766C6309DF202831140" }, - { name = "at_record_shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["atproto_client", "gleam_json", "gleam_stdlib"], source = "local", path = "../shared" }, - { name = "atproto_client", version = "0.1.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_http", "gleam_json", "gleam_stdlib", "gleam_time", "gose", "kryptos"], otp_app = "atproto_client", source = "hex", outer_checksum = "97A6C830B0CF6F3EB9BA6ECF92C7F4E57366919F417DA35FD325431C03B95E19" }, + { name = "at_record_shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["atproto_client", "atproto_core", "gleam_json", "gleam_stdlib"], source = "local", path = "../shared" }, + { name = "atproto_client", version = "0.3.0", build_tools = ["gleam"], requirements = ["atproto_core", "gleam_crypto", "gleam_http", "gleam_json", "gleam_stdlib", "gleam_time", "gose", "kryptos"], otp_app = "atproto_client", source = "hex", outer_checksum = "EF865263E9B1F3F7DFCF474C2C193D328A8E2A2F4D4612D48B31DE14944863EC" }, + { name = "atproto_core", version = "0.1.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_json", "gleam_stdlib"], otp_app = "atproto_core", source = "hex", outer_checksum = "A06B327466847AC6ABB05EC81428C02A1B77E651788DFFA390D66C69EB2F3875" }, { name = "bigi", version = "4.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "bigi", source = "hex", outer_checksum = "44FEDF1DF5C1F426A80B67C32B976D0828D66524E11BDC2DD22B78D37C883BA7" }, { name = "booklet", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "booklet", source = "hex", outer_checksum = "08E0FDB78DC4D8A5D3C80295B021505C7D2A2E7B6C6D5EAB7286C36F4A53C851" }, { name = "directories", version = "1.2.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_stdlib", "platform", "simplifile"], otp_app = "directories", source = "hex", outer_checksum = "D13090CFCDF6759B87217E8DDD73A75903A700148A82C1D33799F333E249BF9E" }, @@ -23,7 +24,7 @@ packages = [ { name = "gleam_fetch", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "284CE88E37436699545F9F65D413E1DFB6C1EA3FE3824B6EA2018D0ECF088FFC" }, { name = "gleam_http", version = "4.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "82EA6A717C842456188C190AFB372665EA56CE13D8559BF3B1DD9E40F619EE0C" }, { name = "gleam_httpc", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "C545172618D07811494E97AAA4A0FB34DA6F6D0061FDC8041C2F8E3BE2B2E48F" }, - { name = "gleam_javascript", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "EF6C77A506F026C6FB37941889477CD5E4234FCD4337FF0E9384E297CB8F97EB" }, + { name = "gleam_javascript", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "D542C4B4F40E942F5D3372D524419FA521A7BB92D621AF696CC286E89D882D55" }, { name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" }, { name = "gleam_otp", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "BA6A294E295E428EC1562DC1C11EA7530DCB981E8359134BEABC8493B7B2258E" }, { name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" }, @@ -40,7 +41,7 @@ packages = [ { name = "justin", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "8B1C62269E8607D0A0ED698B7903984CE0BF7B6B3C0DEA3C6C8302B39402837B" }, { name = "kryptos", version = "1.4.0", build_tools = ["gleam"], requirements = ["bigi", "gleam_stdlib", "gleam_time"], otp_app = "kryptos", source = "hex", outer_checksum = "734DAB837962A4A45788F8E6350EF4A6DF20A1F54734736CD1FF3A03FFCE4C97" }, { name = "logging", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "BC5F18CE5DD9686100229FE5409BDC3DD5C46D5A7DF2F804AD2D8F0DD6C5060E" }, - { name = "lustre", version = "5.7.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "38C6FCBD7B7BACE994D5BF643202BB69B02576D44250B4C5DCE738387C0E8F87" }, + { name = "lustre", version = "5.7.1", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "663A2D1A3458914CA537A42AC07E601DD3FD85415EBDAF4717F2DFF6E86F90F9" }, { name = "lustre_dev_tools", version = "2.3.6", build_tools = ["gleam"], requirements = ["argv", "booklet", "filepath", "gleam_community_ansi", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_httpc", "gleam_json", "gleam_otp", "gleam_regexp", "gleam_stdlib", "glint", "group_registry", "justin", "lustre", "mist", "polly", "simplifile", "tom", "wisp"], otp_app = "lustre_dev_tools", source = "hex", outer_checksum = "7A650A107C7E767D902A8CB608460B927DE0CDD47D5BA04DED71F9F622FE6AD9" }, { name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" }, { name = "mist", version = "6.0.3", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "1B07F321D5FA0CB162D81496F2DE96AEB6EF8980F4F38230A4CC3F849497E020" }, @@ -48,7 +49,7 @@ packages = [ { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, { name = "polly", version = "3.1.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_erlang", "gleam_otp", "gleam_stdlib", "simplifile"], otp_app = "polly", source = "hex", outer_checksum = "51FB565D81FF6212FDF3306D44419601F2A7C4EDD1F00FC9DA5C376A00AED4FE" }, { name = "rsvp", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_fetch", "gleam_http", "gleam_httpc", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "rsvp", source = "hex", outer_checksum = "A38F2DB9657E84A584278DB50FD903693FF370C22C191753B773546FEB2465F0" }, - { name = "simplifile", version = "2.5.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "6C72DCCDF25C38A5931740B30E823969F33106831FD1637719B5EDBCA30027A4" }, + { name = "simplifile", version = "2.6.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A33C345F0A4FFB91DCCD4220114534A58C387964A5F17B3E472CEBD1ADA9FFB4" }, { name = "snag", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "274F41D6C3ECF99F7686FDCE54183333E41D2C1CA5A3A673F9A8B2C7A4401077" }, { name = "tom", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "DCF04CB7AB35D58CFC598C66EA2E1816D160759802C89B2BA6238780D59BC256" }, { name = "wisp", version = "2.2.2", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "5FF5F1E288C3437252ABB93D8F9CF42FF652CE7AD54480CFE736038DC09C4F22" }, -- 2.54.0