Commit Graph

209 Commits

Author SHA1 Message Date
Fintan Halpenny e9cf91e1bc cob: bump major version
The addition of the `Namespace` parameter in the traits requires a
major version bump for `radicle-cob`
2025-06-02 11:31:48 +02:00
Fintan Halpenny f4c8ff7a64 chore: prepare crates release
This prepares the crate versions for a new release. The version bumps were
determined by the `cargo-semver-checks` tool.

However, there were some issues with the `radicle-fetch` crate – where when
attempting to check it, it was unable to compile due to the previous version
expecting the kind of `Doc` with a generic parameter. I believe this is due to
the version for `radicle` being specified as simply `0`. This prompted changing
the version specifications to use `major.minor` for all the internal crates.
This, for example, would mean that `radicle-fetch` that relies on `0.15` can use
`>=0.15.0,<0.16.0` – allowing any patch versions but must require a minor
version bump.
2025-05-30 12:58:18 +02:00
n4ch7 b608a78806 cli: `rad config schema` emits JSON Schema
Leverage `schemars` to generate a JSON Schema from our structs for
configurations and those occurring within them.

The output of `rad config schema` can be used by editors to provide a
smoother editing experience for the configuration file. Discovery
attributes (both keys and values) is greatly improved with the schema
helping in the background.

Refer to:
 - https://json-schema.org
 - https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings
 - https://schemastore.org
2025-05-22 11:00:46 +02:00
Fintan Halpenny 1f4fcc5e6a radicle: move to `signature` crate
The motivation of this change is to move away from tying signing to be
specifically for ed25519. The reason being that the protocol will want move
towards two different kinds of signing – the node signing artifacts, and an
author signing artifacts.

This change captures the former, node signing, by introducing a `Device` type
that is the `NodeId` – a PublicKey underneath the hood – and a signing
mechanism. This allows the replacement of the `Signer` trait being used – which
always assumed a `PublicKey`. Instead, the `Device` is constructed with
`NodeId`.

In `radicle-cob`, a signer is expected to implement
`signature::Signer<ExtendedSignature>`, and everywhere in `radicle`,
`radicle-node`, `radicle-cli`, and `radicle-remote-helper` is expected the
signer is expected to implement `signature::Signer<Signature>`.

A `Device` implements both of these but only requires
`signature::Signer<Signature>` to do so – since an `ExtendedSignature` is
essentially `(PublicKey, Signature)`, and the `NodeId` of the `Device` can be
used.
2025-05-22 09:09:57 +02:00
Fintan Halpenny a90aabb1fe node: rate limiter for channel reads
This introduces rate limits for the `ChannelReader` to limit DDoS attacks and
attempts to upload repositories that are larger than a node is will to permit.

The limiter sets the total number of bytes it is will to accept in a single
exchange, defaulting to 500MB. This means that initial fetches will prevent
large repositories, but is plenty for new packfile data to be sent in subsequent
fetch exchanges.

The limit can be configured within the node's config file, under the limits.
2025-04-25 20:27:51 +02:00
Sebastian Thiel 72913b8c15
fetch: integrate the latest `gix-protocol` into `radicle-fetch`
Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
2025-04-17 14:09:22 +02:00
Derick Eddington 47c785b916
signals: Use `signals_receipts` crate instead
This resolves issues:
- 111cf90 (`handler` is not async-signal-safe)
- c8e0300 (`libc::signal` should not be used)
- b91c6c3 (Mutex can cause signals to be missed)

See also: patch 8e05702.

The API of `radicle-signals` is the same as before, and so uses of it
don't need to be and aren't changed.  The behavior is slightly different
in that:

- If the channel is full then signals will not be lost, which is an
  improvement.  This is achieved without blocking in the signal handler.
  This is possible because of the counters approach along with the
  internal receipts-processing thread of the `signals_receipts` crate.

- `install()` and `uninstall()` might block very briefly if necessary to
  acquire the mutex, which is now internal to and managed by the
  `signals_receipts` crate, only if there are concurrent calls to them
  (which is unlikely), but such blocking is guaranteed to be bounded to
  be very brief.  This is done so they no longer can fail to do their
  purpose, which is an improvement.  They still return errors if the
  handling is already installed or uninstalled, respectively, which
  preserves the previous use cases.

- The new `finish()` function is introduced.  This is provided in case
  it's ever needed to completely clean-up the facility, by terminating
  the internal receipts-processing thread, to be like it hadn't been
  installed before.

- The user must ensure that the notifications channel is disconnected,
  by dropping the receiver(s), when doing `uninstall()` or `finish()`.
  Such dropping usually occurs naturally, and already occurs for all the
  preexisting uses of `radicle_signals`.  (The `signals_receipts` crate
  is capable of a more robust approach, but this commit doesn't use
  that, to avoid changing the preexisting uses of `radicle_signals`.)

- The `TryFrom` impl for `Signal` is of `SignalNumber` which is `c_int`,
  instead of `i32`, because `c_int` (the type of signal numbers) might
  not be `i32` on all platforms (POSIX only requires `c_int` to be at
  least 32-bit).

The version of `radicle_signals` is incremented, to reflect those
changes and the substantially different internal implementation.

The new dependency on the `base64` crate is needed by the
`signals_receipts` crate for it to work on macOS, because its dependency
on the `sem_safe` crate uses `base64` as part of creating anonymous
semaphores on macOS (which lacks support for unnamed semaphores (in
violation of POSIX)).

Signed-off-by: Derick Eddington <kcired@pm.me>
Signed-off-by: Lorenz Leutgeb <lorenz@leutgeb.xyz>
2025-04-16 20:09:44 +02:00
Ivan Stanković a5665412f6
Cargo.lock: update crossbeam-channel to 0.5.15
Version 0.5.13 was yanked, resulting in the following warning when
building with --locked:

    warning: package `crossbeam-channel v0.5.13` in Cargo.lock is yanked
    in registry `crates-io`, consider running without --locked
2025-04-14 10:37:12 +02:00
Fintan Halpenny 170915ffcf nix: Nix flake maintenance
The nix flake's checks were failing for various reasons. The following fixes are
applied to get it up to date again.

- Update to release-24.11, since `crane` requires it – also to keep up-to-date
- Add `.json` to the source filters to allow for testing patch migration
- Ensure that the `rad` and `git-remote-rad` binaries are built for the nextest
  check. N.b. the binaries need to be in the target dir of `radicle-cli` since
  that is where the nextest check runs from.
- Add `cargo-audit` and `cargo-deny`, to the devShell, to allow for running those
  tools locally
- Bump `gix-path` to 0.10.11 to avoid a vulnerability[^0]

[^0]: https://rustsec.org/advisories/RUSTSEC-2024-0371
2025-04-10 15:29:08 +02:00
Fintan Halpenny c2863c08ab radicle: extend emoji support
Extend the ranges of emojis that are supported, listed
[below](#new-emojis-supported).

To ensure that single `char` emojis are supported, the `emojis` crate
is added as a dev dependency, using it to check that a `Reaction` can
be constructed for the two groups `SmileysAndEmotion` and
`PeopleAndBody`.

### New Emojis Supported

'🩵' 0x1FA75
'🩶' 0x1FA76
'🩷' 0x1FA77
'🫀' 0x1FAC0
'🫁' 0x1FAC1
'🫂' 0x1FAC2
'🫃' 0x1FAC3
'🫄' 0x1FAC4
'🫅' 0x1FAC5
'🫆' 0x1FAC6
'🫠' 0x1FAE0
'🫡' 0x1FAE1
'🫢' 0x1FAE2
'🫣' 0x1FAE3
'🫤' 0x1FAE4
'🫥' 0x1FAE5
'🫦' 0x1FAE6
'🫨' 0x1FAE8
'🫩' 0x1FAE9
'🫰' 0x1FAF0
'🫱' 0x1FAF1
'🫲' 0x1FAF2
'🫳' 0x1FAF3
'🫴' 0x1FAF4
'🫵' 0x1FAF5
'🫶' 0x1FAF6
'🫷' 0x1FAF7
'🫸' 0x1FAF8
2025-04-10 15:18:31 +02:00
Fintan Halpenny d9c76893a1
cli: bump version to 0.12.1 2024-12-04 12:47:00 +01:00
Lorenz Leutgeb 7616dcb793
cli/cob: Output JSON Lines 2024-12-03 12:36:02 +01:00
Lorenz Leutgeb b4f18f43d3
cli: Bump to 0.12.0 2024-11-29 16:31:52 +01:00
Lorenz Leutgeb 1fa1cafee9
cli: Update tree-sitter
Bump `tree-sitter` from 0.20 to 0.24 and replace `tree-sitter-toml` with
the fork `tree-sitter-toml-ng`.
2024-11-29 16:09:53 +01:00
cloudhead fd892d006f
Update `radicle` to 0.14 2024-11-29 15:25:09 +01:00
cloudhead d39ba83cfc
Update `Cargo.lock` 2024-09-03 12:42:10 +02:00
cloudhead 4e112aaeaa
Update `radicle` crate to 0.13.0 2024-08-28 13:01:35 +02:00
cloudhead 2d241e5f7d
Update `radicle-crypto` crate to 0.11.0 2024-08-28 13:01:35 +02:00
cloudhead c112f3fbc9
Update `radicle-cob` crate to 0.12.0 2024-08-28 12:55:30 +02:00
Sebastian Martinez beac367056
Update `radicle-surf` to 0.22.0 2024-08-20 16:35:04 +02:00
Fintan Halpenny e1470fccd7
fetch: update gix-pack and gix-odb
The `gix-fs` crate was flagged as vulnerable[^0]. To update it to `>=0.11.0`, it
was necessary to update the `gix-pack` and `gix-odb` crate versions to `0.51`
and `0.61`, respectively.

This in turn updated `fastrand` which changed its algorithm[^1], which meant
that some test outputs were reordered or matched new values.

[0]: https://rustsec.org/advisories/RUSTSEC-2024-0350
[1]: https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md#version-210
2024-08-09 12:41:01 +02:00
Lorenz Leutgeb 723e2741f5
node: Socket Activation with systemd 2024-07-22 10:44:22 +02:00
cloudhead 123f7eb6bb
Update `radicle` crate to 0.12.0 2024-07-18 16:22:14 +02:00
cloudhead 27eff8095d
node: Don't depend on `gix` directly
This avoids pulling in the same dependency twice.
2024-07-16 15:57:27 +02:00
Alexis Sellier e56a70b0d3
node: Update `io-reactor` dependency
The previous version contained a bug which caused disconnections
to not be forwarded to the service.
2024-07-06 11:12:13 +02:00
cloudhead 92c9e21873
Bump `radicle` crate to 0.11.1 2024-06-26 14:49:10 +02:00
cloudhead a4989b7ce7
Remove `radicle-httpd` crate
The HTTP daemon is moved to the `radicle-explorer` repository. Hence,
all traces of it are removed from this repository.
2024-06-06 11:14:00 +02:00
cloudhead ab532be033
Bump crate versions
We bump the versions of the crates required to publish a new version of
`radicle-httpd` in preparation of moving it out of the repo.
2024-06-05 16:51:55 +02:00
cloudhead a85e7f7442
node: Set TCP_KEEPALIVE on sockets
Ensures dead connections are not kept around longer than necessary.
Note that the ping/pong mechanism is more expensive and checks that the
session is active and healthy, while TCP_KEEPALIVE is lower level,
cheaper, and checks that the connection is still alive.
2024-05-22 14:46:08 +02:00
Lorenz Leutgeb a4e10f0344
fetch: upgrade gix crates
Upgrade the family of `gix` crates and resolve any breaking API changes.

Fixes RUSTEC-2024-0335[[0]].

[0]: https://rustsec.org/advisories/RUSTSEC-2024-0335.html

Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-05-17 13:27:18 +02:00
Fintan Halpenny c8a24d5584
node: report upload-pack progress
Emit the `UploadPack` events from the `upload_pack` method.

A wrapper type, `Reporter`, is introduced for implementing a `Write` instance
that will parse the given bytes as `gix_protocol::RemoteProgress`, if possible,
and emit it via the `Emitter`, and then write the bytes to the underlying
writer. This allows any subscribers to see the progress of an upload-pack, i.e.
`Compressing objects`, `Counting object`, `Enumerating objects`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-05-15 10:07:56 +01:00
Dr Maxim Orlovsky a3cce22f7a
node: Patch dependencies for Tor/socks5 support 2024-05-06 22:19:36 +02:00
cloudhead 40f4383bbc
term: Implement content-aware pager
This is a pager (like `less`) that takes an `Element`, and dynamically
re-renders the element when the terminal size changes. This ensures that
the content is always properly wrapped and rendered.
2024-05-03 14:31:05 +02:00
cloudhead 2801403182
signals: Move signal handling to its own crate
We're going to share this code with `radicle-term`.
2024-05-03 14:30:51 +02:00
cloudhead e5df616ead
node: Protect against non-monotonic clocks
Many (most?) system clocks are not monotonic, and even though we're
getting a `LocalTime`, which *is* monotonic when using `now()`, it is
constructed from a `SystemTime` which isn't.
2024-04-30 10:56:37 +02:00
Sebastian Martinez 7fc3b73e88
Update radicle-surf to 0.21 2024-04-24 11:51:25 +02:00
cloudhead c07522365a
cargo: Run `cargo update` on workspace 2024-04-23 17:43:21 +02:00
cloudhead f17df88229
term: Update `inquire` crate 2024-04-15 17:12:36 +02:00
cloudhead a5212a7a88
term: Fix editor command with args
We add support for `EDITOR` being set to a command with arguments, eg.
`code --wait`.

Fixes dd6861f.
2024-04-04 10:52:36 +02:00
cloudhead 9cdf0aa1fd
Update radicle crates to 0.9.0 2024-03-26 11:56:27 +01:00
cloudhead f1f1313b6d
node: Update `netservices` to 0.8.0
The previous version was relying on a broken method from `socket2` that
switched non-blocking sockets to blocking.
2024-03-21 12:40:58 +01:00
Sebastian Martinez bdd1b238fc
Bump `radicle-surf` to 0.19.0 2024-03-11 12:27:27 +01:00
cloudhead b0fbbeed6b
node: Upgrade dependencies
Fixes issue with improperly closed connections.
2024-02-26 11:47:03 +01:00
cloudhead e12bff0871
cli: Update and remove some dependencies 2024-02-02 09:57:45 +01:00
cloudhead ebdaf0edd9
General dependency update
Left out some of the `gix-*` dependencies to be done separately after
review.
2024-01-18 13:30:26 +01:00
cloudhead ccc675b304
cli: Have a way of enabling logging in helper
Log to stderr if RUST_LOG is enabled in the remote helper.
2024-01-17 17:34:30 +01:00
cloudhead 045b3e7175
node: Increase process ulimit on start
Users have been having issues with the process soft file limit.
We set that to a reasonably high value to avoid problems.
2024-01-17 17:34:25 +01:00
cloudhead 25ca4c8b92
node: Upgrade `netservices` and `io-reactor`
There was an issue with the old version due to the use of `RawFd` as
peer IDs, since they are not unique for the lifetime of a process.

With this change, we use the new `ResourceId` type, though these are not
immediately available, as they are generated when the resource is
registered.
2024-01-11 12:03:53 +01:00
Sebastian Martinez 5331cf3bcf
radicle: Move `DataUri` to `common::DataUri` 2023-12-22 15:09:20 +01:00
Fintan Halpenny 47a440a384
radicle: expose shared logger
To be able to use log setup across the different components of
heartwood, expose a `logger` module from `radicle`. This also includes
a `test` logger.

These modules are guarded behind a `logger` feature flag, so that
other crates are not bringing any uneeded dependencies.

This allows logging to be setup in `radicle-cli-test` so that when a
test fails, the log output is present for debugging purposes.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-20 15:11:10 +01:00