Commit Graph

2090 Commits

Author SHA1 Message Date
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
cloudhead c8fbcf2a7a
helper: Revert patches correctly
When pushing to the default branch and updating the canonical head,
check to see if any merged patches are reverted due to this change.

If so, make sure the COB cache reflects this.
2024-08-23 15:59:59 +02:00
Lorenz Leutgeb 0dd06b91c1
nix: Correctly set `RUST_SRC_DIR` 2024-08-22 11:12:10 +01:00
Lorenz Leutgeb 621c5a4563
rust: Migrate to `rust-toolchain.toml`
See
 - https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file
2024-08-22 11:12:10 +01:00
Lorenz Leutgeb b398e54b83
nix: Update flake to get to reach Rust 1.80 2024-08-22 11:12:09 +01:00
cloudhead 757483f351
radicle: Fix patch COB `review` action
When two `review` actions were posted by the same author, for the same
revision, an error was returned, cancelling evaluation for that author.
This caused certain patches to for eg. lose their merge status.

To remedy this, we *allow* multiple `review` actions per revision, but
simply take the last one as the "current" review. Since this makes the
`review.edit` action redundant, we remove that action completely. This
is safe, as none of the tools created review edits.
2024-08-21 17:37:58 +02:00
cloudhead 8922388caa
scripts: Add install command in changelog 2024-08-20 17:39:04 +02:00
Sebastian Martinez c0aecbac3a
Relax version requirement for `radicle` dependencies
Since a few crates rely on the `radicle` crate, dependency updates that
affect multiple crates like `git2` are not able to resolve the
dependencies and fail, if the version is fixed to e.g. `0.12.0`
2024-08-20 16:35:04 +02:00
Sebastian Martinez beac367056
Update `radicle-surf` to 0.22.0 2024-08-20 16:35:04 +02:00
Sebastian Martinez cae66b6168
Update `radicle-git-ext` to 0.8.0 2024-08-20 16:35:04 +02:00
Sebastian Martinez f71da0ee95
Update `git2` to 0.19.0 2024-08-20 16:35:04 +02:00
Fintan Halpenny eb432b9bc1
cli: announce on issue edit and comment
The `rad issue edit` and `rad issue comment` subcommands were not included in
the announce check. Since these are considered write commands, they should also
announce when executed.
2024-08-20 16:32:02 +02:00
cloudhead ab6ca14c88
tools: Add optional revision to `rad-merge` 2024-08-20 16:23:32 +02:00
Fintan Halpenny 86a0443916
crdt: run cargo fmt 2024-08-09 12:41:01 +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
cloudhead a61affa9fb
node: Don't fail if we can't load a COB to cache
This change simply logs an error if there is a problem loading a COB
from storage, instead of bailing on the cache update process.

We also ensure that objects that can't be loaded from storage are
removed from the cache.
2024-08-09 11:59:53 +02:00
cloudhead 1d1b9c3d49
radicle: Don't use transactions in cache
The `transaction` method was being used for single queries. This
was unnecessary.
2024-08-09 10:54:04 +02:00
cloudhead 9db69a40a6
radicle: Remove cache entries before caching
In case of a bug or failed cache update, there may be objects in the
cache that are no longer in storage.

When doing a full re-cache, remove all existing entries from the repo
first.
2024-08-09 10:48:46 +02:00
cloudhead bfc949d094
cli: Log errors when COBs can't load 2024-08-09 10:47:54 +02:00
cloudhead 2b75045661
scripts: Add a script to create a radicle env
Creates a new profile with a repo and drops you in.
2024-08-07 10:41:28 +02:00
cloudhead 73f3c49689
cli: Don't fail on `rad ls` if project is invalid 2024-08-07 10:40:46 +02:00
cloudhead 16560950ec
radicle: Fix log when delegate is not found 2024-08-06 16:36:27 +02:00
cloudhead a496190198
cli: Suggest the user to reset the cache
If there is an error loading a patch or issue, suggest resetting the
cache.
2024-08-06 14:43:59 +02:00
cloudhead c6a8a00055
Update `rust-toolchain` to 1.80
Fix new clippy warnings.
2024-08-06 14:37:21 +02:00
cloudhead 0e08452323
node: Ensure we don't prune our own routes
Filter out routing entries of our own node when prunning.
2024-08-06 14:17:12 +02:00
Fintan Halpenny 52554af4f1
cli: add `rad unblock` command
Add the `rad unblock` command for reversing the effect of blocking an NID or RID.

In both cases, the entry is removed from the DB, if the policy was set to block
-- otherwise it is a no-op.
2024-08-06 14:12:44 +02:00
Ivan Stanković 468d5a46ee
cli: Only get the signer where needed in `rad id`
Requesting a signer may prompt the user for key password, which
is not really needed with commands like `list` and `show`.
2024-08-06 14:02:46 +02:00
cloudhead 84e3ba1482
Validate project names properly in all places
We were only validating names when passed as a flag to `rad init
--name`.
2024-07-31 16:05:31 +02:00
cloudhead ee1c867800
cli: Add way to init from existing repositories
This adds an option to `rad init` to initialize a working copy with
an existing radicle repository in storage:

    rad init --existing <rid>

This sets up the remote(s) and configures the repo for you.
2024-07-29 11:49:19 +02:00
cloudhead 74336f961a
cli: Write comments into draft patch review
We tidy things up with an explicit `Brain` type that stores the accepted
state of the code.

Review comments are added to the patch draft.
2024-07-24 16:46:24 +02:00
cloudhead 7cecabed42
Add `id` to `Revision`, forbid duplicate reviews
Some changes to the `Patch` state needed for code review.
2024-07-24 16:46:24 +02:00
Fintan Halpenny 81a3bc3d1b
cli: `rad id` allow missing default branch
If a peer had created any references but was also missing the
canonical branch, the `rad id update` command will fail when adding
that peer as a delegate.

Instead, missing delegates and missing default branches are tracked
during verification. If the number of missing delegates means the
`threshold` cannot be met, then the errors are returned.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-07-24 16:43:36 +02:00
Fintan Halpenny dc34eafdf4
remote-helper: allow patch creation from detached HEAD
The patch creation flow would be partially interrupted when creating a
patch via a detached HEAD state. The creation of an upstream branch
would fail since there is no branch to set an upstream for. It would
result in the following error:

    ✓ Patch 6035d2f582afbe01ff23ea87528ae523d76875b6 opened
    To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
     ! [remote rejected] HEAD -> refs/patches (git: reference 'HEAD' is neither a local nor a remote branch.; class=Invalid (3))
    error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi'

To fix this, the reference that's resolved is checked to see if it a
local branch. If not, it will return early.

The behaviour is tested in the `rad-patch-detached-head` example.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-07-23 17:13:30 +02:00
Derick Eddington 1c46f19592 node: Fix `main` to print early errors
Otherwise, previously, when an error occurred before `logger::init()`
then no message about the error would be shown, because `log` ignores
messages generated before the logger is initialized.  E.g. when
`$RAD_HOME/config.json` is missing, invoking `radicle-node`
directly (i.e. not via `rad node start`) would fail without any
explanation being logged nor printed.  There also are some other
possible errors that can occur before `logger::init()` where no message
would've been shown.

The fix is to detect if the logger is enabled, which it won't be when it
hasn't been initialized, and if not then fallback to printing directly
to stderr.

To show the lower-level source of an error, like previously, and to
avoid now needing more conditionals with more format strings for all
possibilities of `err.source().is_some()` and `log_enabled!()`, the
"alternate" form (`{:#}`) of formatting `anyhow::Error` is now used.
This also introduces a change in behavior such that the entire chain of
source errors will now be shown, instead of only the first in the chain,
which seems more desirable for errors that cause fatal exiting of
`radicle-node`.  Note that this form still formats as only a single
line, like previously.

The prefix "Error: " is used for the new fallback printing, because in
this case it's not a log message (though, it might be written to the log
file), and because that prefix is consistent with how Rust errors that
cause immediate termination are usually printed directly.  For the
opposite case, the "Fatal: " prefix serves to distinguish it as being
fatal among the many other various log messages.

While it would be possible to instead return `anyhow::Result<()>` from
`main`, to achieve the printing of early errors (and exiting with
failure code), that would cause undesirable duplication, for non-early
errors that occur after `logger::init()`, of the error message where it
would be written to both the log file and to stderr which often is the
same as the log file.

Signed-off-by: Derick Eddington <kcired@pm.me>
2024-07-22 12:37:57 -07:00
Lars Wirzenius a04381f4e5 chore: update deny.toml to current deny version
"cargo deny" changed their configuration file in a release made in
February. While the heartwood deny.toml still works, it triggers a
bunch of deprecation warnings now. Change deny.toml to follow
the new defaults and locations for configuration fields so that no
warnings about that are triggered.

Add the "MPL-2.0" license to list of allowed licenses. It was
previously allowed by virtue of being an OSI license, but that setting
has been deprecated.

This still leaves many actual errors and warnings in the code base,
such as duplicate versions of the same dependency, or licenses that
are not explicitly allowed, and one security advisory.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 14:39:47 +03:00
Fintan Halpenny 29e681210b
node: test multiple offline inits
Ensure that when a node initialises multiple repositories, those
repositories can successfully be fetched by another peer once they
connect.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-07-22 10:48:10 +02:00
Lorenz Leutgeb 723e2741f5
node: Socket Activation with systemd 2024-07-22 10:44:22 +02:00
Derick Eddington 6f8d75a00d
node: Fix "signals" thread
Fix "signals" thread to continue upon other signals.

Otherwise, previously, when one of the non-shutdown signals was
received, that would cause the "signals" thread to finish, but then a
subsequent signal that should cause shutdown would not because the
thread no longer existed to do so.  E.g. when SIGHUP or SIGWINCH was
received first and ignored and then SIGTERM or SIGINT was received next,
the program should still be shutdown, but it wouldn't be.  This is now
fixed by simply looping to continue handling subsequent signals.

Logging is now done for:
- Receiving of SIGHUP, at log level `debug`, because the default action
  for that signal would be to terminate the process but that is not done
  by `radicle_signals`.  Someone sending that signal might want to debug
  why the process isn't being terminated.
- Disconnection of the signal-notifications channel, at log level
  `warn`, because, even though that should be impossible, if it somehow
  occurs then a warning is warranted.

Logging is not done for receiving of SIGWINCH, because the default
action for that signal would be to ignore it, which is what
`radicle-node` does.

A wildcard pattern is not used in the match arms, so that any future
changes to the `Signal` variants will require reviewing their handling
in the "signals" thread.

Signed-off-by: Derick Eddington <kcired@pm.me>
2024-07-22 10:38:42 +02:00
cloudhead 123f7eb6bb
Update `radicle` crate to 0.12.0 2024-07-18 16:22:14 +02:00
RadsammyT 1848c2b85d
cli: Handle interrupts during an active spinner 2024-07-18 15:47:18 +02:00
Rūdolfs Ošiņš a831e18a72
node: Change node web config metadata fields
- Remove the `name` field as it is not required in the new design.
- Rename `imageUrl` to `bannerUrl` to hint users that it's going to be
  used as a header image.
- Add a new field `avatarUrl` so node operators can customize their
  node further.
2024-07-18 13:56:31 +02:00
cloudhead 4a497fa66f
node: Move the session lookup outside the loop
Small code change that was not possible before.
2024-07-16 19:58:47 +02:00
cloudhead 189046bb5d
node: Randomize order of missing inventories 2024-07-16 19:58:47 +02:00
cloudhead aac23dde0c
node: Add a max capacity to fetch queues 2024-07-16 19:58:44 +02:00
cloudhead 3c1c35f259
node: Have multiple fetch queues
In the current design it's possible for one peer to fill the fetch queue
so that fetches from other peers are delayed.

To improve fairness, we move to a queue per peer. We then try to dequeue
from all peers in a random order for good measure.
2024-07-16 17:11:46 +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
cloudhead 297646412a
cli: Use pretty diffs for code review
We use the pretty diff renderer for code review.
2024-07-12 16:39:23 +02:00
cloudhead 823ece875e
cli: Improve pretty diff printing
Refactor, cleanup, improve tests etc.
2024-07-12 16:36:04 +02:00
Alexis Sellier 795ee35f37
cli: Output tree hash after review update 2024-07-11 14:17:17 +02:00