Commit Graph

726 Commits

Author SHA1 Message Date
Lorenz Leutgeb 6147a8a2fb
cli: Add `rad cob log` format options
Add `--format json` and `--format pretty`.
2024-05-22 11:54:25 +02:00
Lorenz Leutgeb 72dad241e2
cli: `rad cob {show → log}` 2024-05-22 11:47:09 +02:00
cloudhead 30c9b0db0b
cli: Add `rad node debug` command 2024-05-21 16:00:30 +02:00
Lars Wirzenius 749e823985
cli: use Rust stdlib to get path to current exe
This is more portable than reading /proc/self/exe, which only works on
Linux.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-21 13:51:27 +02:00
cloudhead 191278f0d9
cli: Use current local tip in `rad sync status`
In the case of an out-of-sync local node, we were showing the wrong tip.
Additionally, mark your tip as unannounced if it isn't announced. This
isn't fool-proof, but can be useful to debug certain issues.
2024-05-21 13:32:40 +02:00
cloudhead f78e5a4281
node: Update sync status for private repos
Only public repos were being updated on node initialization.
2024-05-21 13:32:40 +02:00
Fintan Halpenny 740106d759
cli: upload-pack events
Introduce an `UploadPack` type for keeping track of relevant data from
upload-pack events and displaying progress to the terminal.

It keeps track of the number of remotes that are being uploaded to as well as
the throughput of transmitted data.

The `Progress` events are logged rather than being displayed since they don't
provide any useful details to the user.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-05-17 21:05:43 +02:00
cloudhead 8402b85ad9
cli: Simplify private repo fetching
* Remove `rad sync --force` flag
* Remove `rad clone --private` flag

These flags are no longer necessary. Simplify specifying which seed
to fetch from with `--seed` is enough.
2024-05-16 15:46:24 +02:00
cloudhead ca7db1620c
node: Improve Tor configuration flexibility
*Breaking change* The `tor` configuration field is no longer
supported. Users must remove that field from their config.

Allows for a mixed mode, where regular addresses bypass the Tor proxy,
while onion addresses go through it.

When `onion.mode` is set to "forward", Tor connections are fowarded to
the global proxy, and if it isn't set, to the OS's DNS resolution.

For mixed mode, a global proxy simply isn't set, so that IP/DNS is not
proxied.
2024-05-16 14:53:52 +02:00
Fintan Halpenny cb2cbf014a
cli: reject `rad id` proposals that do not verify
To ensure that the `rad id` command does not modify the project payload without
it being able to be deserialized into the `Project` type, the command performs
this check throught the `project` method, and returns an error if this fails.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-05-16 10:11:48 +01:00
RadsammyT d5045417d6
cli: remove op check for `--repo` in `rad inbox`
As a response to Issue # c4134924cf2ce84444c6f7235a27651ad49311b5.
A no-op command in rad inbox defaults to show, but the inbox argument parser
only permits --repo in instances where the operation is explicity declared.

Here, the check for an explicit operation is removed so one is never required.
2024-05-16 12:07:08 +02:00
Lars Wirzenius 0d00528d48
cli: add SHELL environment variable to "rad debug" output
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-16 12:06:04 +02:00
Fintan Halpenny f038b7ee5c
cli: watch for upload-pack events in `rad init`
To improve the user experience of `rad init`, the events listener waits for
upload-pack messages indefinitely. The spinner reports back the upload progress
over time.

This process can be cancelled via Ctrl+C without affecting the announcement,
since that is happening in the background.

To also improve the experience, the remote NIDs that have successfully synced
are reported to the terminal.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-05-15 10:07:56 +01:00
Fintan Halpenny 027bfbef67
node: stream timeout semantics for `Node::call`
The timeout for a `UnixStream` will interrupt a `read` even when more data is
available. The preference would be that the timeout applies to each read, where
the timeout is reset again once a read is successful. This better supports
streaming semantics expected for the `Handle::subscribe` method.

To achieve this, the `LineIter` type holds the `UnixStream` and timeout
`Duration`. The `Iterator` implementation can then use `read_line` to progress
the stream one line at a time, and the timeout only applies to each read.

Co-authored-by: Alexis Sellier <alexis@radicle.xyz>
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-05-15 10:07:56 +01:00
cloudhead 21cced05c1
node: Allow for "WAL" mode in sqlite
This solves concurrency issues between the node and http daemon.
2024-05-14 16:34:30 +02:00
cloudhead 2ca1e74707
cli: Have way to delete payload field in `rad id`
Allow for deleting a field by setting it to `null`.
2024-05-13 16:12:41 +02:00
Alexis Sellier c5395f0674
cli: Improve `rad stats` output
Use daily/weekly figures.
2024-05-10 13:13:03 +02:00
Fintan Halpenny e8f2f88bf6
cli: Add test for unknown field in identity doc
Add a test to confirm that the identity can still be deserialized when an
unknown field is added.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-05-07 10:21:07 +02:00
cloudhead fddd0680fa
cli: Make ruby syntax highlighting non-optional
The current verison of the crate no longer requires C++ and builds fine.
2024-05-05 00:50:54 +02:00
cloudhead 6dd52c94fb
cli: Use new pager for `rad diff` 2024-05-03 14:31:08 +02:00
cloudhead a54180199e
node: Further increase the rate-limit defaults
The rate-limitter gets hit on connect, due to historical gossip messages
being exchanged. This results in a high initial burst that needs to be
accounted for.
2024-05-02 13:43:09 +02:00
cloudhead a9b94b0ad6
node: New relay configuration for nodes
Relay now has three values: "always", "never" and "auto".

The first two operate like the previous `true`/`false`. The
new (default) value turns relaying on for nodes with public (external)
addresses and off for nodes without. This should reduce redundant traffic on
the network, that was causing the rate limiters to trigger.
2024-05-02 11:45:29 +02:00
cloudhead abf89438ea
node: Increase default rate-limiter config
With the increase in traffic on the network after launch, the old
defaults don't make sense anymore.

Longer term, we should look into throttling outgoing messages as well,
prioritizing original messages over relayed messages.
2024-05-01 11:06:28 +02:00
cloudhead 9cd08a01db
cli: Small improvements to `rad auth` error output 2024-04-30 22:07:04 +02:00
cloudhead b31fbde159
node: Add `log` to node config 2024-04-29 15:59:17 +02:00
cloudhead a3ffe51ddf
Rename `RAD_SEED` to `RAD_KEYGEN_SEED`
More explicit.
2024-04-26 10:38:54 +02:00
cloudhead fe5757d122
Tidy up environment variables
* Try to use constants instead of strings
* Move crypto seed override out of radicle-crypto
* Use GIT_COMMITTER_DATE for commit overrides
* Use RAD_LOCAL_TIME as general time override
* Allow variables to be used in release mode
2024-04-26 10:38:54 +02:00
cloudhead deeb39c558
node: Support "transparent" Tor
This allows for configuring your node such that `.onion` addresses
encountered are treated as regular DNS names.
2024-04-26 10:37:41 +02:00
cloudhead 85b321f943
cli: Use correct color for private repos 2024-04-24 21:11:26 +02:00
cloudhead 2b771921d5
node: Type-safe timestamps
Use a struct to represent timestamps, to improve type safety.
2024-04-24 12:19:40 +02:00
Sebastian Martinez 7fc3b73e88
Update radicle-surf to 0.21 2024-04-24 11:51:25 +02:00
cloudhead ae709b00ed
cli: Enable HTML syntax highlighting in diffs 2024-04-20 15:59:20 +02:00
cloudhead 0b5fa51a92
helper: Allow pushing a raw SHA-1 2024-04-18 17:09:45 +02:00
Fintan Halpenny 3556758386
cli: fix rad inbox clear output
If multiple ids are specified for `rad inbox clear`, it would report
that only 1 item was cleared, when in fact multiple were.

This was found to be due to the SQL code returning a change count of
`1`. This is likely due to the way the statement is being reset each
time. The `sqlite` library does not seem to easily support the usage
of `IN` in a `WHERE` clause. So instead, the `count` is aggregated in
the loop and returned instead.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-04-09 16:09:44 +02:00
Fintan Halpenny 8bf871903a
node: handle removal of cob from cache
When a `Patch` or `Issue` is entirely removed from the Git repository,
then there is no update to be made -- instead it should also be
removed from the cache.

This covers the case where the original author of the COB deletes the
COB.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-04-09 16:06:51 +02:00
cloudhead e3ecf4d7a0
cli: Add partial clone fail test
Ensure `rad clone` is successful as long as one fetch succeeds.
2024-04-09 15:54:08 +02:00
cloudhead 2eb665678e
cli: `rad sync` UX improvements
* Add `--force` flag to force a fetch even if the node is not a seed.
* Don't fail if we can't connect to a node during a fetch.
* More accurately exit when we hit our replica count.
2024-04-09 10:43:35 +02:00
cloudhead e9b79fb6d0
cli: Improve UX for cloning/fetching private repos
When `--private` is passed to `clone`, we force a fetch from nodes that
aren't known seeds.

When it isn't specified, we skip nodes that aren't known seeds, even if
they are in the preferred seeds list. Previously, we would still fetch
from them, which would cause errors.
2024-04-08 22:15:56 +02:00
cloudhead bd8e0ebcda
cli: Add tool in case `sqlite3` is unavailable
Adds the `rad node db exec <query>` command.

Easy way to run sqlite queries if the sqlite3 CLI is not available or
too old.
2024-04-06 17:55:59 +02:00
cloudhead 6be77ca9c3
radicle: Implement `remote_refs_at`
Implement this function on `RemoteRepository`, and move `repositories`
to the trait level.

This function will be used to quickly get the `RefsAt` of all repository
remotes.
2024-04-05 21:59:28 +02:00
cloudhead 36808234a6
cli: Don't allow announcing without a fork 2024-04-04 14:13:34 +02:00
Fintan Halpenny ea69168f44
cli: explain public to private changes
Add an example of changing a public repository to a private
repository, noting that any replicated data will be public, but any
new changes will not be replicated.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-04-03 15:41:48 +02:00
Sebastian Martinez d38846baae
cli: Display better errors in `patch ready`
Instead of doing nothing and going to sync no change, we should display
some error to the users that we haven't been able to apply the changes.
2024-04-03 15:19:31 +02:00
Sebastian Martinez 0a78b9cc5b
cli: Display correct merge author in rad patch show output 2024-04-03 15:11:34 +02:00
Fintan Halpenny cd9b46fe51
radicle: fault tolerant thresholds
There are two areas where we can be more tolerant of delegate namespaces
being missing or not validating:
1. Calculating the canonical HEAD
2. Fetching from a remote

In 1. the protocol is tolerant in that if the local node does not have
the default branch for a delegate, it will still attempt to use any of
the delegates it does have to reach the threshold.

This is made safe by ensuring that if the threshold is being updated
then the node performing the update must have a threshold of delegates
locally in their storage. It also made safe by 2.

In 2. the protocol is tolerant by allowing delegates to be missing
from the serving side, as long as they can still meet a threshold of
delegates. This is further tolerant, when validating the received
data, a threshold of delegates are valid to consider the fetch
successful -- otherwise it will fail.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-04-03 14:30:05 +02:00
cloudhead 7e13e0759f
node: Simplify handling of fetch completion
* Don't branch based on whether it was a user-requested fetch or not.
* Only announce inventory on clones of public repos.
2024-04-03 14:25:02 +02:00
cloudhead 6744ffc325
node: Improvements to test reliability 2024-04-03 14:25:02 +02:00
cloudhead f01aac8828
cli: Add `inbox` to help output 2024-03-26 13:13:14 +01:00
cloudhead 9cdf0aa1fd
Update radicle crates to 0.9.0 2024-03-26 11:56:27 +01:00
cloudhead e695d06bbb
node: Logging improvements & other small things 2024-03-25 12:05:05 +01:00