Commit Graph

41 Commits

Author SHA1 Message Date
Lorenz Leutgeb 0e3f3f03d2 cli: Improve formatting of Node IDs and addresses
Pay more attention to when a Node ID is displayed in compact form. As
this was sometimes used to save space, e.g. in `rad node status` in
combination with long node addresses (like .onion names), also implement
a compact format for node addresses and use that instead in some cases.
Progress notifications in spinners keep the short form.
2025-07-18 21:44:06 +01:00
Fintan Halpenny 010d5134e8 protocol: fix `Frame` docstring
The `[T]` and `[I]` are interpretted as links when running `cargo doc`. This
table is surrounded in a code fence to prevent this, but also provide a better
view of the table when rendered to HTML.
2025-07-17 08:57:50 +01:00
Lorenz Leutgeb 3c5668edd2 protocol: Reimplement encoding on top of `bytes` 2025-07-16 21:15:55 +02:00
Lorenz Leutgeb 1c20f64a26 node, protocol: Refactor
Mostly changes of `use`s and moving components to `radicle-protocol`,
with the goal of just getting `radicle-node` to work on top of the new
`radicle-protocol` crate.
2025-07-16 21:15:52 +02:00
Lorenz Leutgeb 61c468778a protocol: Create skeleton by moving from radicle-node
This commit will not build. If you are reading this while bisecting,
please skip this commit. It is not fixed to build to get clean renames.
2025-07-16 21:12:42 +02:00
Lorenz Leutgeb b9759c5868 radicle: Make `node::Link` copy and add `is_*`
This will allow us to replace `netservices::LinkDirection` with
`radicle::node::Link` in a drop-in manner.
2025-07-16 21:12:42 +02:00
Fintan Halpenny 8201225166 cli: test canonical tags
Add a test to exercise adding canonical reference rules and pushing new
canonical tags.

A change in `rad id` was required to allow adding a new payload to the document,
i.e. one that does not already exist.

Adding rules is also documented in the man page for `rad id`.
2025-07-16 16:54:43 +02:00
Fintan Halpenny ff365e2d8b radicle: disallow default branch
Ensure that the default branch is only ever synthesized from the `Doc`'s
`threshold` and `delegates` value. If the rule is ever written into a `RawDoc`,
then the update of the that `RawDoc` must go through the `update::veryify`
function, which checks that the rule is not present.
2025-07-16 16:41:16 +02:00
Fintan Halpenny a69397386a cli: extract document update logic
The business logic of modifying the identity document should not live in the CLI
code for updating said document.

Instead, we extract out that logic into separate update functions and these are
using from the CLI instead.
2025-07-16 16:41:16 +02:00
Fintan Halpenny 7f646666bc radicle: canonical references payload 2025-07-16 16:41:16 +02:00
Fintan Halpenny af6cf03acd radicle: canonical reference rules
Introduce the `rules` module beneath `canonical`. The implementation follows
the Canonical References RIP[^0].

A `Rule` defines the DIDs and threshold required to get the canonical tip
for a reference (or set of references). Since a `Rule` has some specific
validation rules, there can be two versions of a `Rule`. The `RawRule` is one
that can be easily constructed, serialized, and deserialized. It must then be
validated into a `ValidRule`, which validates any constraints, and can be used
in the computing of a canonical tip.

For convenience, a set of `ValidRule`s is wrapped into the `Rules` type, which
also has a further constraint that each rule refers to a specific `refspec`.

[0]: 1d1ce874f7
2025-07-16 16:41:16 +02:00
Fintan Halpenny fb8681f5bc radicle: `connect` returns `ConnectError`
Refactor the `connect` method to return a `ConnectError` so that it can be
reported via logging at call sites, and returned as an error from the node
handle.
2025-07-16 15:47:10 +02:00
Fintan Halpenny 29043134a3 radicle: hotfix release 0.16.1
Releasing a hotfix version for the inclusion of `ReviewEdit` and
`ReviewReaction` changes.
2025-07-15 15:18:05 +01:00
Sebastian Martinez 4e08eef8d5 radicle: add missing `review_react` methods 2025-07-15 11:37:04 +02:00
Fintan Halpenny 3a47003578 radicle: add ReviewEdit getter methods
Downstream clients require access to the data for a `ReviewEdit` – for example,
the desktop client builds a representation of `Action`s for TypeScript
generation.

To allow these kinds of use cases, methods are added to `ReviewEdit` to allow
access to its underlying data.
2025-07-15 09:55:45 +01:00
Fintan Halpenny b77809ae9d chore: prepare crates release
Prepare the crates for releasing to crates.io:
- radicle-remote-helper: 0.10 -> 0.11
- radicle-term: 0.12 -> 0.13
- radicle-cli: 0.13 -> 0.14
- radicle-node: 0.11 -> 0.12
- radicle-fetch: 0.11 -> 0.12
- radicle: 0.15 -> 0.16

It was also necessary to specify the `version` in the workspace Cargo.toml file,
since this is required for publishing to crates.io.
2025-07-14 15:38:09 +01:00
Fintan Halpenny fe6a11d0db radicle: fix schemars macro on FetchPackSizeLimit
While running `cargo-semver-checks`, there was an issue that was surfaced
regarding `serde(into)`, `serde(try_from)` and `schemars(transparent)` being
used, and they are incompatible.

This appeared to be a semver issue, on the side of `schemars`, since the issue
would only appear when adding `radicle` as a fresh dependency. The intuition for
this is that once `schemars` was updated locally, the same error appeared when
attempting to build the `radicle` crate.

To avoid this, `schemars` provides a `!` operator for the macro[^0]:

> You can also “unset” serde attributes by including them with a ! prefix in a
> schemars attribute, which will make schemars ignore the corresponding serde
> attribute item

[^0]: https://docs.rs/schemars_derive/latest/schemars_derive/derive.JsonSchema.html#attributes
2025-07-14 14:51:59 +01:00
Erik Kundt 4e429e4408 radicle: Fix doctests 2025-07-14 12:41:56 +02:00
Fintan Halpenny 34939253f7 radicle: improve reviews
The `Review::summary` was limited in behaviour, since it was only an
`Option<String>`.

The field is now changed to `NonEmpty<Edit>` so that it can enable an edit
history, as well as being able to supply embeds as part of the text.

`Reactions` are also introduced to `Review` and, necessarily, introducing an
`Action::ReviewReact`.

Note that some machinery was added under `actions` and `encoding` to enable
backwards-compatibility.
For `actions`, a new `ReviewEdit` is introduced to keep
track of the different versions of editing actions – supporting the old actions
while also introducing the new variant.
For `encoding`, the machinery exploits the fact that an `Option<String>` can be
converted into a `NonEmpty<Edit>` given that an `ActorId` and `Timestamp` are
available, and that `None` can be converted into an empty string. The struct
`patch::Review` now deserializes via this `encoding::review::Review` type and,
importantly, preserves backwards-compatibility.
2025-07-14 11:26:40 +02:00
Fintan Halpenny c30298fb8a radicle: implement std::error::Error for AnnouncerError 2025-07-09 14:40:53 +01:00
Fintan Halpenny e965d9a2c9 node: clean up `UploadError`
This change better separates the different errors that can occur during an
upload. It does this by:
- Separating the authorization error into its own enum and having a variant
  simply for that
- The `PacketLine` error was never constructed, so the error returned from the
  `upload_pack::pktline::git_request` is now wrapped in this variant.
- The error from `upload_pack::upload_pack` is now wrapped in an `UploadPack`
  variant.
- The `Io` variant is removed.
- Other redundant variants are also removed.
2025-07-09 13:11:04 +01:00
Lorenz Leutgeb 5a840983a8 node, cli: Refactor test environment 2025-07-09 11:47:50 +01:00
Fintan Halpenny 38ff2652b1 radicle: remove unnecessary constraints
The constraints on some of the `cob` related traits are unnecessary, so this
patch removes them.
2025-07-08 11:36:42 +02:00
Johannes Kühlewindt 895ca5d025 cli: rad node connect using only NodeId
Allow the `rad node connect` command to use only a `NodeId` when connecting.

The `NodeId` is used to connect to known addresses, and will stop at the first
address that is connected to.
2025-07-03 12:13:49 +01:00
Fintan Halpenny 76e00a34ea cli: change link direction symbols
The symbols used for [inbound] and [outbound] are part of the [Supplementary
Multilingual Plane](smp) (or Plane 1). This set of symbols are not as well
supported by font sets, as discovered by many reports of the characters missing.

There are two other arrow characters: [south east] and [north east] that serve
the same style and are part of the [Basic Multilingual Plane](bmp) (or Plane 0).
This set of characters is more widely supported.

[inbound]: https://www.compart.com/en/unicode/U+1F866
[outbound]: https://www.compart.com/en/unicode/U+1F865
[smp]: https://en.wikipedia.org/wiki/Plane_(Unicode)#Supplementary_Multilingual_Plane
[bmp]: https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
[north east]: https://www.compart.com/en/unicode/U+2197
[south east]: https://www.compart.com/en/unicode/U+2198
2025-07-02 11:10:09 +01:00
Lorenz Leutgeb 84427a56b5 radicle-term: Use crossterm instead of termion 2025-06-27 15:39:29 +02:00
Lorenz Leutgeb ee8ffcc799 radicle-term: Inline `termion::get_tty` for Unix 2025-06-27 15:39:29 +02:00
Lorenz Leutgeb ec47566cb0 radicle-term: Remove custom pager
I learned that there is an implementation of a pager in
`crates/radicle-term/src/pager.rs`. It does not make sense to me to
maintain a pager in `heartwood`, this is too far from the core of what
we are trying to achieve and adds unnecessary maintenance burden. We can
allow ourselves to defer to the paging done by `git` or just call the
user's `$PAGER`. Even though falling back to unpaged output might not be
the nicest thing, I still prefer that over maintaining the pager.

It also was frustrating to me that the pager does not support things
like search (like `less` does).

This also significantly decreases our dependence on `termion`.

The pager was originally implemented by cloudhead in

  40f4383bbc

and integrated into `rad diff` in

  6dd52c94fb

This commit restores the behaviour introduced in

  84a95848b0

(before there was a custom pager implementation).
2025-06-27 15:35:19 +02:00
Fintan Halpenny 6f34124d43 radicle: improve config errors
Improve the granularity of config errors mentioning the path location where the
configuration is expected to be loading from or saving to.
2025-06-24 13:51:55 +02:00
Sebastian Martinez 6686f86c67 radicle: fix small typo 2025-06-24 13:50:37 +02:00
Fintan Halpenny d8d00666d3 chore: remove radicle-tools
The `radicle-tools` binaries were specialised binaries for early development of
the `heartwood` set of crates. Choose to remove the crate so that it no longer
needs to build as part of our workspace.
2025-06-24 13:48:46 +02:00
Fintan Halpenny 42285e71cf chore: remove radicle-crdt
The `radicle-crdt` crate is no longer used by any of the other crates. Choose to
remove the crate so that it no longer needs to build and test as part of our
workspace.
2025-06-24 13:48:46 +02:00
Lorenz Leutgeb 78ba263d0a radicle-cli/issue: Improve comment templating
Writing a comment, only the most recent comment replied to is shown.
Editing a comment, current contents are not prepared. Manual copy required.

To improve:
 - Chase all replies to the root and quote them. Gracefully handle if
   this proces fails, i.e. a comment in the chain cannot be resolved.
 - If editing, copy the current contents.
2025-06-19 13:12:46 +02:00
Lorenz Leutgeb af35e6f4d0 radicle-cli: Warn when using old names of nodes 2025-06-18 16:21:21 +02:00
Lorenz Leutgeb 727e4e72c7 radicle-cli/debug: Use `BTreeMap` for consistent ordering
A `HashMap` does not guarantee a consistent iteration order. It is
desirable that all environment variables are printed in a consistent
order.

Use a `BTreeMap` which guarantees a consistent iteration order.
2025-06-18 15:55:54 +02:00
Lorenz Leutgeb 1df8cf102f radicle/bootstrap: Add rosa.radicle.xyz 2025-06-18 15:10:55 +02:00
Lorenz Leutgeb a354686bbc chore: Remove `seed.radicle.xyz`
The team node is not really special, remove occurrences.
2025-06-18 14:45:54 +02:00
Jakob Kirsch e30e66e009
radicle: add .external_template(false) to all other libgit2 calls
This complements 9d4aa59a12.
2025-06-14 00:28:06 +02:00
Fintan Halpenny ab62dce683 radicle: refactor Canonical
Changes for the `Canonical` type:
- Reorder arguments so that `delegates` and `threshold` are grouped
  after `refname`
- Add `Canonical::is_empty` to detect when `Canonical` was constructed
  with no tips
- Consume `Canonical` when calling `Canonical::quorum` to indicate
  that it should be the final step
2025-06-12 13:35:47 +02:00
Fintan Halpenny b2bcd561cf radicle: store threshold in Canonical
The Canonical type is generally constructed with the threshold, needed
for the quorum computation, in scope. To make it easier to use and
encapsulate its functionality, it now holds the threshold as an
additional field.
2025-06-12 13:19:48 +02:00
Lorenz Leutgeb 5bc2dc677b repo: Move workspace crates into `crates` subdirectory
This keeps the top level of the repo cleaner, e.g.
<https://github.com/radicle-dev/heartwood> scrolls less and
<https://app.radicle.xyz/nodes/rosa.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/>
might show more files at the top level.

This way we also don't have to explicitly name all crates in
`Cargo.toml`.
2025-06-09 15:09:21 +02:00