Commit Graph

2244 Commits

Author SHA1 Message Date
Lars Wirzenius ebc8d037d9 ci(.radicle/ambient.yaml): CI plan for Radicle CI Ambient adapter
With this file, Radicle CI can use the Ambient adapter to run CI on
patches.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-16 12:25:51 +03: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 538648c542 cli: document disallow and edit options in manpages
There were missing descriptions for the `--disallow` and `--edit` options in the
`rad-id` manpages.
2025-04-15 10:44:00 +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 9ef9c5d59a radicle: add Op::load method
Adds an `Op::load` helper method for loading an `Entry`, given its `Oid` and the
`store` it is stored in.

This can be useful for downstream consumers to inspect operations on COBs given
a single `Oid`, without having to load the entire object and/or graph.

It can also be useful when looking at implementing COB stream primitives.
2025-04-11 12:52:09 +02:00
Fintan Halpenny c847a16e14 radicle: return iterator types for db policies
Instead of collecting the results and returning the collection as an
iterator, introduce `FollowPolicies` and `SeedPolicies` types, which
implement `Iterator`.

Note that a call in `service` changed due to the lifetime borrow. It
simply `collect`s into a `Vec` for the time being.
2025-04-11 12:35:55 +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 6940ac42be radicle: reverse lookup for AliasStore
Provide functionality to lookup the `NodeId`s associated with a given
`Alias`.

The use for this functionality is to allow callers to use aliases as
shorthands for `NodeId`s, but still refer to the exact identifier.

The implementation allows for searching using the `LIKE '%<pattern>%'`
queries in sqlite, so searches do not have to be exact matches.
2025-04-11 12:18:35 +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
Fintan Halpenny dd5f739630 radicle: generic Transaction::initial
The use of `Transaction` outside of the `radicle` crate requires that a newtype is used, if the upstream code wants to write methods, such as:

```
pub struct Transaction<R>(store::Transaction<MyCob, R>);

impl Transaction<R> {
  pub fn add_foo(&mut self, foo: Foo) -> Result<(), store::Error> { /* code */ }
  pub fn add_bar(&mut self, bar: Bar) -> Result<(), store::Error> { /* code */ }}
```

This works up until the point that it tries to re-use the
`Transaction::initial` method.

To make this possible, the method needs to know that it can be
converted to the upstream `Transaction` and back to `radicle`
`Transaction`.
2025-04-10 15:37:08 +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
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
Yorgos Saslis ffc86f8a96
build: ensure zigbuild install doesn't break reproducible build
In trying to rebuild the radicle 1.1.0 version now (2025-02-26), some months after 1.1.0 has been released, I see in my pipelines that the `cargo install cargo-zigbuild@0.19.3` instruction is now failing.

This is because `home@0.5.11` has been released and this *patch* version bump requires a newer version of rust (1.81) (0.5.9 was ok with 1.80). See https://github.com/rust-lang/cargo/issues/14944 for more details.

Adding `--locked` here prevents this issue from happening in the future.

Importantly: newer versions of other crates being picked up by cargo here means the build isn't bit-for-bit reproducible.

The error itself is:

```
[1/2] STEP 14/17: RUN curl -sSf -o zig.tar.xz         https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz &&     curl -sSf -o zig.tar.xz.minisig https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz.minisig &&     minisign -Vm zig.tar.xz -P RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U &&     xz -d -c zig.tar.xz | tar -x &&     mv zig-linux-x86_64-0.12.0/zig /usr/bin/zig &&     mv zig-linux-x86_64-0.12.0/lib /usr/lib/zig &&     cargo install cargo-zigbuild@0.18.3
Signature and comment signature verified
Trusted comment: timestamp:1713604063   file:zig-linux-x86_64-0.12.0.tar.xz     hashed
    Updating crates.io index
 Downloading crates ...
  Downloaded cargo-zigbuild v0.18.3
  Installing cargo-zigbuild v0.18.3
    Updating crates.io index
     Locking 83 packages to latest compatible versions
      Adding cargo-platform v0.1.9 (latest: v0.2.0)
      Adding cargo-zigbuild v0.18.3 (latest: v0.19.8)
      Adding cargo_metadata v0.18.1 (latest: v0.19.1)
      Adding dirs v5.0.1 (latest: v6.0.0)
      Adding dirs-sys v0.4.1 (latest: v0.5.0)
      Adding fs-err v2.11.0 (latest: v3.1.0)
      Adding getrandom v0.2.15 (latest: v0.3.1)
      Adding linux-raw-sys v0.4.15 (latest: v0.9.0)
      Adding redox_users v0.4.6 (latest: v0.5.0)
      Adding target-lexicon v0.12.16 (latest: v0.13.2)
      Adding thiserror v1.0.69 (latest: v2.0.11)
      Adding thiserror-impl v1.0.69 (latest: v2.0.11)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.14.1+wasi-0.2.3)
      Adding which v6.0.3 (latest: v7.0.2)
      Adding windows-sys v0.48.0 (latest: v0.59.0)
      Adding windows-targets v0.48.5 (latest: v0.53.0)
      Adding windows-targets v0.52.6 (latest: v0.53.0)
      Adding windows_aarch64_gnullvm v0.48.5 (latest: v0.53.0)
      Adding windows_aarch64_gnullvm v0.52.6 (latest: v0.53.0)
      Adding windows_aarch64_msvc v0.48.5 (latest: v0.53.0)
      Adding windows_aarch64_msvc v0.52.6 (latest: v0.53.0)
      Adding windows_i686_gnu v0.48.5 (latest: v0.53.0)
      Adding windows_i686_gnu v0.52.6 (latest: v0.53.0)
      Adding windows_i686_gnullvm v0.52.6 (latest: v0.53.0)
      Adding windows_i686_msvc v0.48.5 (latest: v0.53.0)
      Adding windows_i686_msvc v0.52.6 (latest: v0.53.0)
      Adding windows_x86_64_gnu v0.48.5 (latest: v0.53.0)
      Adding windows_x86_64_gnu v0.52.6 (latest: v0.53.0)
      Adding windows_x86_64_gnullvm v0.48.5 (latest: v0.53.0)
      Adding windows_x86_64_gnullvm v0.52.6 (latest: v0.53.0)
      Adding windows_x86_64_msvc v0.48.5 (latest: v0.53.0)
      Adding windows_x86_64_msvc v0.52.6 (latest: v0.53.0)
      Adding winsafe v0.0.19 (latest: v0.0.22)
 Downloading crates ...
  Downloaded anstyle v1.0.10
  Downloaded anstyle-query v1.1.2
  Downloaded cargo-platform v0.1.9
  Downloaded bitflags v2.8.0
  Downloaded cargo_metadata v0.18.1
  Downloaded is_terminal_polyfill v1.70.1
  Downloaded option-ext v0.2.0
  Downloaded scroll_derive v0.12.0
  Downloaded strsim v0.11.1
  Downloaded autocfg v1.4.0
  Downloaded anstream v0.6.18
  Downloaded camino v1.1.9
  Downloaded dirs-sys v0.4.1
  Downloaded heck v0.5.0
  Downloaded itoa v1.0.14
  Downloaded home v0.5.11
  Downloaded thiserror-impl v1.0.69
  Downloaded which v6.0.3
  Downloaded utf8parse v0.2.2
  Downloaded either v1.14.0
  Downloaded colorchoice v1.0.3
  Downloaded clap_lex v0.7.4
  Downloaded errno v0.3.10
  Downloaded dirs v5.0.1
  Downloaded fs-err v2.11.0
  Downloaded shlex v1.3.0
  Downloaded rustc_version v0.4.1
  Downloaded path-slash v0.2.1
  Downloaded thiserror v1.0.69
  Downloaded terminal_size v0.4.1
  Downloaded anstyle-parse v0.2.6
  Downloaded clap_derive v4.5.28
  Downloaded target-lexicon v0.12.16
  Downloaded fat-macho v0.4.9
  Downloaded semver v1.0.25
  Downloaded scroll v0.12.0
  Downloaded log v0.4.26
  Downloaded proc-macro2 v1.0.93
  Downloaded quote v1.0.38
  Downloaded anyhow v1.0.96
  Downloaded clap v4.5.31
  Downloaded ryu v1.0.19
  Downloaded serde_derive v1.0.218
  Downloaded unicode-ident v1.0.17
  Downloaded serde v1.0.218
  Downloaded memchr v2.7.4
  Downloaded serde_json v1.0.139
  Downloaded clap_builder v4.5.31
  Downloaded goblin v0.9.3
  Downloaded syn v2.0.98
  Downloaded rustix v0.38.44
  Downloaded libc v0.2.170
  Downloaded plain v0.2.3
  Downloaded cargo-options v0.7.5
  Downloaded linux-raw-sys v0.4.15
error: failed to compile `cargo-zigbuild v0.18.3`, intermediate artifacts can be found at `/tmp/cargo-installZ4q2vb`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Caused by:
  rustc 1.80.1 is not supported by the following package:
    home@0.5.11 requires rustc 1.81
  Try re-running `cargo install` with `--locked`
Error: building at STEP "RUN curl -sSf -o zig.tar.xz         https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz &&     curl -sSf -o zig.tar.xz.minisig https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz.minisig &&     minisign -Vm zig.tar.xz -P RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U &&     xz -d -c zig.tar.xz | tar -x &&     mv zig-linux-x86_64-0.12.0/zig /usr/bin/zig &&     mv zig-linux-x86_64-0.12.0/lib /usr/lib/zig &&     cargo install cargo-zigbuild@0.18.3": while running runtime: exit status 101
```

Signed-off-by: Yorgos Saslis <yorgos.work@proton.me>
2025-02-26 09:32:00 +02:00
Lorenz Leutgeb 3b5fac178e
crypto: RefCell instead of Mutex in Agent 2025-01-28 14:05:45 +01:00
Fintan Halpenny 62d000f7cb radicle: fix `parse_ref_*` documentation
The `parse_ref` and `parse_ref_namespaced` documentation used 4 space
indentation for the reference names. Unfortunately, `cargo test` attempts to
interpret this as code.

Use triple-backtick code fencing, with `text` and `no_run`, instead.
2025-01-16 11:08:35 +00:00
Fintan Halpenny ee0d19f2eb
man: make a note on draft patches
Include a note on making draft patches – whether via the remote helper, or via
the CLI – in the section on opening patches.
2025-01-14 14:05:21 +01: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
Lars Wirzenius 7d28d1e648
ci: don't build docs for depedencies
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-14 13:45:34 +01:00
Lars Wirzenius dfe89fb303
ci: only deny warnings, not all clippy lints
Change configuration of native CI to only deny warnings from the
compiler, but no all clippy lints.

Previously we ran "cargo clippy --all-targets --workspace -- --deny
clippy::all", which overrides the allows for specific clippy lints in
the source code. We don't want that.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-14 13:45:34 +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 985987468d
radicle: add `list_by_status` method to `cob::issue::Issues`
Provides the same `list_by_status` and `<status>` methods that
`cob::patch::Patches` has to `Issues`
2025-01-14 13:36:14 +01:00
Sebastian Martinez 7c902b6905
radicle: Add `resolves` and `labels` method to `cob::patch::Revision`
To be able to query the `BTreeSet` that shows which comments are
resolved by a specific revision and the `Iterator` of `Label` we require
some methods to obtain them.
2025-01-14 13:34:38 +01:00
Fintan Halpenny 6598243465
radicle: document `parse_ref` and `parse_ref_namespaced`
Provide better documentation for the two methods.

Solves the issue:
```
rad issue show 4603f55d97a0776f37bae2f9d2ba7d455d8a4c83
```

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2025-01-14 13:34:13 +01:00
Leah Neukirchen 41c33901ff
radicle: use rlim_t when working with limits
rlimit values have different types on Linux and FreeBSD, as well as
64-bit and 32-bit platforms, so stick to the type rlim_t provided by the
libc crate.
2025-01-14 13:29:03 +01:00
Lars Wirzenius c8062bc4a7
docs: note that node logs may also be in the system journal
See https://radicle.zulipchat.com/#narrow/channel/369873-support/topic/I.20cannot.20access.20logs.20on.20a.20node/near/480509559

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-14 13:27:33 +01:00
Lars Wirzenius 4c82bb4c4e
radicle: add some documentation for node::events::Event
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-14 13:24:11 +01:00
Lars Wirzenius 2929146c49
radicle: clarify RefsAt description
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-14 13:22:51 +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
Yorgos Saslis 87cb7bf52d
build: Update zig installation method
This simplifies the Dockerfile a little , as the zig package (0.12.0) is available on alpine 3.20
https://repology.org/project/zig/versions

parent image is also updated to current rust-toolchain

Signed-off-by: Yorgos Saslis <yorgos.work@proton.me>
2024-12-16 11:09:19 +01:00
cloudhead 87f6956e49
build: Fixes to release script 2024-12-16 11:08:27 +01:00
cloudhead d274b28ae0
scripts: Small fix to contributor count 2024-12-05 14:25:28 +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
Fintan Halpenny 61865b5b5a
cob: fix documentation
`no_run` will compile but not run the code. Use `ignore` instead, and also added
`rust` for syntax highlighting.
2024-12-04 12:40:40 +01:00
cloudhead 8e2fe6449e
scripts: Improve changelog script
* Add number of commits and contributors
* Default to the latest version tag as the "current"
2024-12-04 12:40:10 +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
cloudhead 289e59bbfa
term: Bump version to 0.12.0 2024-12-02 13:03:25 +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 70f0cc354d
cob: Fix `serde` instances for `ObjectId`
The type now serializes the same as `Oid`.
2024-11-28 15:19:56 +01:00
Lorenz Leutgeb f58af8fef4
cli: Use `term::Table::header` where possible 2024-11-28 14:35:24 +01:00
cloudhead bcba8f5a21
scripts: Add `--from-version` to changelog script
This allows generating changelogs from eg. version 1.1 to 1.2 combining
any pre-releases.
2024-11-27 17:25:02 +01:00