Commit Graph

852 Commits

Author SHA1 Message Date
Lorenz Leutgeb 05368e84fa cargo: Make schemars a workspace dependency
The `schemars` crate is a dependency of multiple workspace crates in the
same version. Its version number is repeated multiple times in the
respective `*/Cargo.toml` files. This requires more maintenance effort
and risks versions drifting.

As long as all crates depend on the same version, it makes more sense to
have `schemars` as a workspace dependency.

See: <https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table>
2025-06-03 15:10:30 +02:00
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 e6ef767f36 radicle: remove job cob
The Job COB is defined as separate crate: [radicle-job]. So this change removes
its definition and use from the `heartwood` repository.

[radicle-job]: https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z2UcCU1LgMshWvXj6hXSDDrwB8q8M
2025-06-02 10:59:55 +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
Fintan Halpenny caf9e241a6 cli: fix outputs
- `format!` was missing for the `"No seeds found"` message, so the `{rid}` was not being formatted.
- Missing a space between the seed and the timing.
2025-05-30 12:46:48 +02:00
Fintan Halpenny 924b93283c cli: change announcement message
We ensure that the message of total synced seeds changes when we go over the
replication factor target. This can happen if the node is still waiting to
announce to a preferred seed, and other results are still being returned.
2025-05-30 09:46:53 +02:00
Fintan Halpenny 5b4cbc2cd8 radicle: introduce announcer
Similar to the `Fetcher` sans-IO approach, an `Announcer` sans-IO approach is
introduced. The previous `Handler::announce` was already quite close to using a
sans-IO approach, but using internally held state. This change makes the
business logic more reusable – and testable.

Similarly to the `Fetcher`, the `Announcer` is configured and then driven by
telling it when nodes have been synchronized with. It will continuously check if
it has reached its target, yielding to the caller to decide whether to keep
going. In contrast, it also provides a way to mark the process as timed out,
since announcing relies on waiting for events to come back in a timely manner.
2025-05-26 12:31:03 +02:00
Fintan Halpenny fa9c6cd142 radicle: move PrivateNetwork to `node::sync`
This construction can be used more generally, for example in announcements, so
it is moved one level up.
2025-05-26 12:31:03 +02:00
Fintan Halpenny cc96b9ed7d cli: improve rad clone
This change improves the `rad clone` command in a few different ways.

The first improvement is to check if the repository already exists before
fetching. If it does exist, then there is no need for the fetch to be performed,
and can move straight to the checkout.

If the repository does not exist, then the fetch is performed, as per usual.
However, it uses a replication factor of 1, so that the fetch finishes as soon
as it has the repository in local storage.

The change also improves the output when failures occur while attempting to
perform the checkout phase. It will print the failure that occurred and provide
a hint message in each case to help debug the failure, or push the caller in the
direction of performing the correct action.

This required some changes in `test/commands.rs` setup. Some tests were using
the `rad-clone.md` to setup a clone, which would have different output if the
repository did not need to be fetched. In those cases, the `rad` method for
performing the clone is used instead.
2025-05-26 11:56:56 +02:00
Lorenz Leutgeb 1a67ac18f3 cli: reword sync replicas help
Reword the help message of `--replicas` and `--max-replicas`, while also
improving the documentation on how the fetch and announce functionality works.
2025-05-23 17:22:48 +01:00
Fintan Halpenny eec4dd4505 radicle: improve sync fetching
This patch changes separates the business logic of fetching from the process of
fetching itself. It does this through a sans-IO approach, where a `Fetcher`
provides the necessary state to help drive a fetch forward, without performing
any of the IO itself.

What the `Fetcher` cares about is:
- What nodes are going to be attempted to be fetched from
- In what order should they be attempted
- When should the fetching process be considered finished

The `Fetcher` is then used in `radicle-cli` to drive forward the `sync::fetch`
function, allowing it to only care about the IO.
2025-05-23 17:22:48 +01: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
Lorenz Leutgeb 5a2f26eaa7 cli/node/status: Redesign
- Print link direction.
 - Shorten NIDs.
 - Use single chars to indicate status, legend is provided via hint.

On nodes with only outgoing connections, link direction won't be very
interesting. But on seed nodes it sometimes *is* of interest in which
direction the connections are going.

Also, I hope that in the future we will enable more and more nodes to
connect directly to each other.

The table header "Dir." is an abbreviation for "Link Direction".
2025-05-22 10:45:32 +02:00
Lorenz Leutgeb ee12f76cbe cli/tests: Fix nextest running via Nix 2025-05-22 10:25:59 +02:00
Fintan Halpenny 9988b63bb2 cob: abstract namespace identifier
This change is to help separate the fact the namespacing by a `NodeId` is a
Radicle specific concern. The identifier can, in theory, be any kind of path
component, as long it is valid in Git.

The motivation for the change is to help separate the idea of a device's
`NodeId` vs an agent being an author – for future agent repository work.
2025-05-22 09:09:57 +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
Lars Wirzenius 105b65c2ac workspace: set rust-version (MSRV)
This declares the minimum supported Rust version, independently of the
`rust-toolchain.toml` file, which specifies the Rust version and
toolchain components the crate/workspace should be built with. The
MSRV affects other crates that depend on anything in this workspace,
but the toolchain file does not seem to affect them. This means the
MSRV is useful for those who build or develop dependents.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-16 13:49:38 +02:00
Lorenz Leutgeb 5553a14752 cli/tests: Relax expectations in `rad-clone-partial-fail.md`
This test often fails on my machine(s) because it prints a different
error message, not "connection reset". I think it is fair to relax this
a little.
2025-04-29 20:37:56 +02:00
Lorenz Leutgeb e4d23fe56a
cli: Introduce `cob [create|update]` 2025-04-28 16:19:02 +02:00
Sekhat Temporus 3018223328
cli: Allow multiple RIDs for `rad unseed`
To keep expectations similar to the seed command after the changes in
the companion patch:

rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/patch/3be0e68b8948e65431a288f225454bafd93de34a
2025-04-26 10:01:11 +02:00
Sekhat Temporus 6bbe919c4b
cli: allow multiple RIDs for `rad seed`
Closes rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/issue/f9ec8a2
2025-04-26 09:45:39 +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
Lorenz Leutgeb f13afe491d remote-helper: Print `git range-diff` invocation 2025-04-24 16:51:38 +02:00
Richard Levitte 10daedf96d cli: Add 'rad node inventory --nid <nid>'
This gives the possibility to see the inventory of another node than self.
This does replicatee the functionality of 'rad node routing --nid', but
feels like a more intuitive command to try.
2025-04-22 11:41:30 +02:00
Lorenz Leutgeb dc1ff882c5
cli/sync: Also print node addresses 2025-04-17 14:20:21 +02:00
Fintan Halpenny 96637aca7e
chore: update rust-toolchain
Update the rust toolchain version to 1.85.

Note that this is not the latest, however, it is the latest available in nixpgs,
so this version is good enough for now.
2025-04-17 10:39:34 +02:00
tippfehlr c05434ebd5 cli: add emoji picker to `rad issue react`
The help shows that `--emoji` is optional, however it was not.
Instead of making `--emoji` mandatory, I added an emoji picker
for the emojis featured in the web ui.

`--emoji` is now (really) optional, but can be used to react
with other emojis not included in the selector or the web ui.
2025-04-16 17:12:06 +02:00
Fintan Halpenny 2af090ea1e cli: fallible comment selector
The usage of the `comment_select` used `unwrap`. It would be better to have the
function be fallible instead and provide a somewhat helpful message.
2025-04-16 16:02:58 +02:00
Richard Levitte 9abedf449b
cli: Don't use 'signer' where not necessary
In the 'clone' command, a 'signer' is instanciated just to get the
public key.  In the 'job' command, a 'signer' is instanciated early,
even when the subcommand doesn't use it.

That's unnecessary, and infers the potential use of RAD_PASSPHRASE.
In those cases, avoid instanciating a 'signer'.
2025-04-15 12:42:35 +02:00
Fintan Halpenny 7de82b5025 radicle: use `Alias` in `follow`
Ensure that the validated `Alias` type is used for inserting into the
policy database.
2025-04-11 12:35:55 +02:00
Fintan Halpenny 3dba4fbc91 cli: cargo fmt
Missed a `cargo fmt` for the feedback print statements
2025-04-10 16:17:01 +02:00
Lorenz Leutgeb a9a4aac322
docs, cli: Mention feedback, also via e-mail 2025-04-10 15:04:52 +02:00
Fintan Halpenny a723068246 cli: provide error context for ssh-agent connect
Provide more context to the ssh-agent error for easier debugging when `rad auth`.
fails.
2025-04-10 14:48:37 +02:00
Fintan Halpenny 4cced3ddb8
cli: add remaining patch actions
Add the remaining `Patch` actions to the CLI interface. These include:

- React to a revision
- Edit a comment
- React to a comment
- Redact a comment

The `react` subcommand is added in a straight-forward manner.

The comment commands are slightly less straight-forward. In order to
keep to one layer of subcommands, these variants are done through the
`rad patch comment` subcommand. They are accessed via options:
`--edit`, `--react`, and `--redact`, respectively. Each of these
options takes the `CommentId` for which the action is affecting. The
`message`, `react` (introduced for `rad patch react`), and `undo`
variables repurposed for this subset of actions.
2025-01-14 14:00:57 +01:00
Yorgos Saslis a1cd0e2fdc
cli: Add `--title` and `--description` edit option
These were missing, causing an `invalid option` error.

Signed-off-by: Yorgos Saslis <yorgos.work@proton.me>
2025-01-14 13:44:16 +01:00
Fintan Halpenny f0390e00d9
cli: print success to console on `rad issue state`
Indicate that the `rad issue state` operation was successful to the
user by printing a message to the console.

Solves:

    rad issue show 71020de8478b15b3f7a619f2f93d3cfb8771cde2
2025-01-14 13:41:13 +01:00
Fintan Halpenny ffbdabe432
cli: add comment edit for rad issue
Add the ability to edit an issue comment to the `rad issue` command.

This is achieved by adding an `--edit` option to `rad issue
comment`. Note that if `--reply-to` and `--edit` are both specified,
then this results in an error.
2025-01-14 13:39:09 +01:00
Sebastian Martinez b6cf6fea8d
cli: Fix `rad ls` help message
If the user wants to see all `seeded` repositories, we should tell them
to use the `--seeded` option instead of the `--all` option.

Since `--all` also shows repos that aren't being seeded.
2025-01-14 12:18:40 +01:00
Fintan Halpenny d9c76893a1
cli: bump version to 0.12.1 2024-12-04 12:47:00 +01:00
Fintan Halpenny 19bbdbca24
cli: fix syntax highlighting
There was mishap in updating the parameters of highlight configuration – so many
string types!

This is fixed by adding the correct `name` parameter, reusing the `language`
variable that is being matched on.
2024-12-04 12:47:00 +01:00
cloudhead 7ed72ec918
cli: Fix some clippy lints 2024-12-04 12:46:47 +01:00
cloudhead 5fe3d5a7ab
cli: Handle broken pipe in `cob show`
When piping the output in for eg. `head -n 1`, the `head` utility
might close down the pipe at some point, yielding a broken pipe error.
We catch that and simply return if that's the case.
2024-12-03 12:36:57 +01:00
Lorenz Leutgeb 7616dcb793
cli/cob: Output JSON Lines 2024-12-03 12:36:02 +01:00
Lorenz Leutgeb 8865b5596e
cli/cob: Allow showing multiple COBs at once 2024-12-03 12:12:50 +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
Lorenz Leutgeb f58af8fef4
cli: Use `term::Table::header` where possible 2024-11-28 14:35:24 +01:00
cloudhead 47b200988c
cli: Fix `rad cob migrate` test 2024-11-27 10:19:51 +01:00
Arnaud Bailly 0ecdc76422
cli: Improve `rad node logs` error message
If the rad node is spawned by systemd there won't be any logs file
to read and `rad node logs` command will fail with the standard
error message from fs.
2024-11-27 10:19:04 +01:00
cloudhead 3ad84420bd
cli: Implement `rad cob migrate`
Adds the new `migrate` sub-command to migrate the COB database.
Checks for version when opening the COBs database and suggests the
command on out of date version.

Also adds the 2nd migration to the COBs cache, which updates the patch
JSON schema.
2024-11-22 21:27:45 +01:00