Commit Graph

778 Commits

Author SHA1 Message Date
Alexis Sellier 5ccf38079c
cli: Make `patch checkout` fetch missing objects
Before this change, `rad patch checkout` would fail if the patch commits
were not in the working copy.
2023-03-18 12:24:17 +01:00
Alexis Sellier 8f57d60706
cli: Don't rely on working copy for `patch show`
Since the patch may not have been pulled into the working copy,
we shouldn't rely on it for displaying patch information.
2023-03-18 12:24:17 +01:00
Alexis Sellier cf1acf7e24
Fix patch `description` method
The description is not actually optional, so don't return an `Option`.
2023-03-18 12:24:17 +01:00
Rūdolfs Ošiņš d40f40b9af
httpd: Use camelCase in query params
It's more ergonomic to consume in JS/TS.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-03-17 17:11:00 +01:00
Alexis Sellier ed1120f3eb
node: Don't relay redundant gossip messages
This change ensures that on `Subscribe`, we only relay the latest
announcement of each node, per announcement category.

Previously, we would relay all announcement, while only the last one
was relevant.
2023-03-17 17:10:10 +01:00
Sebastian Martinez 2c0cdcd1c5
httpd: Add timestamp to revisions json
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-17 13:54:48 +01:00
xphoniex a49eec9892
node: Add eventing system to `Handler` and `Service`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-16 22:26:57 +01:00
Alexis Sellier ebfd445034
node: Use correct scope when getting namespaces
We were using the default scope instead of the entry scope.
2023-03-16 15:38:05 +01:00
Alexis Sellier 88c545bfdd
node: Make sure to only read packet-line header
If there is an unexpected error, eg. `BrokenPipe` in the upload process
process of the worker, we may have more than four bytes to read from the
remote socket. This change ensures that we don't attempt to read more
into a buffer of size `4`.
2023-03-16 15:26:16 +01:00
Alexis Sellier c46bc0cc82
node: Start periodic tasks
This change ensures that we start the periodic tasks "loop" by
scheduling the first wakeup during initialization.
2023-03-16 15:26:13 +01:00
Alexis Sellier fdfe1d508b
node: Use deserializer when decoding messages
For whatever reason, we weren't using the deserializer for message
decoding. This meant that if a message came in two pieces, it would
cause decoding problems, since the first piece would be discarded.
2023-03-16 15:26:13 +01:00
Alexis Sellier 17e3c975fb
node: Better error message when protocol mismatch 2023-03-16 15:26:13 +01:00
Alexis Sellier c4a66c20d0
node: Fix potential protocol mismatch on fetch
It's possible that the daemon or stream closes the git connection
without reading the final `done` packet. If this is the case, we
try to read it after either of the connections is closed.

This may potentially mitigate the issue where the node then receives
the `done` packet while in gossip mode, and disconnects the remote
for misbehavior.
2023-03-16 15:26:13 +01:00
Alexis Sellier cf6890f6f1
Flesh out `HACKING.md` 2023-03-16 13:06:38 +01:00
Alexis Sellier af7a7ada3e
ci: Add git tracing to node deployment 2023-03-16 12:30:15 +01:00
Adam Szkoda 41b9b46d99
ci: Add `--tracking-scope all` 2023-03-16 12:29:35 +01:00
Adam Szkoda 70779ec148
ci: Enabled backtraces on the server 2023-03-15 16:47:33 +01:00
Alexis Sellier 98ee9c46a9
node: Fix state mismatch between service and wire
Due to never removing peers from the peer map in the wire
protocol module, it was possible for there to be multiple
connected peers with the same Node ID. Some might be in a
"connected" state, while others might be "disconnected".

This caused a bug where a peer, although connected would
be considered disconnected by the wire module, because
when searching for a peer with that Node ID, the disconnected
one would return first.

To fix this, we make sure to remove peers from the map once
the connection is dropped.
2023-03-15 16:46:27 +01:00
Alexis Sellier 5828b917f9
node: Fail fast when repository can't be read
It's not a good idea to have fallible operations run after `FetchOk`
is received, since there's no easy way to communicate the error
to the remote at that point. What would then happen is that the fetch
just "hangs", since nothing is there to cancel it.

Hence, we compute namespaces earlier in the process, and store the
namespaces in the session. If there is a failure, the fetch is
never initiated.
2023-03-15 16:22:43 +01:00
Alexis Sellier bd436d4369
cli: Open tracking DB in read-only mode 2023-03-15 12:59:49 +01:00
Alexis Sellier 05d7090326
node: Remove `Handle::inventory` method 2023-03-15 12:59:49 +01:00
Alexis Sellier caaa7581e6
node: Remove `Routing` command
Replaced by direct DB access.
2023-03-15 12:59:49 +01:00
Alexis Sellier 40c58b45ed
node: Move `routing` to `radicle` crate 2023-03-15 12:59:49 +01:00
Alexis Sellier b558c742e6
node: Rename `repo_entries` to `repo_policies`
Do the same thing for `node_entries` etc.
2023-03-15 12:59:49 +01:00
Alexis Sellier 9b6ede8fc5
cli: Use tracking DB access for `node` command 2023-03-15 12:59:49 +01:00
Alexis Sellier cf8113765c
node: Move tracking store to `radicle` crate 2023-03-15 12:59:49 +01:00
Alexis Sellier cf80f246b3
node: Fix bug in seed stats 2023-03-15 12:48:03 +01:00
Alexis Sellier 13998dcf46
cli: Flesh out `rad self` 2023-03-15 10:25:23 +01:00
Rūdolfs Ošiņš fdd6bca311
httpd: Fix status code in commit history endpoint
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-03-15 10:17:41 +01:00
Fintan Halpenny de8e92d48c
radicle: safe Reaction construction
The Reaction type needs to ensure that the `char` stored for its value
meets certain requirements -- via its `new` constructor.

To ensure Reaction is always constructed correctly, the `pub` accessor
is removed, and the Deserialize implementation is implemented by hand
-- as opposed to using derive.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-14 14:31:12 +01:00
Fintan Halpenny 0337574750
radicle: log when Ops::try_from fails
If Ops::try_from fails in from_history then it means that some
operations failed to be parsed.

If this happens, then a warning should be logged so that these failure
cases can be more easily traced.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-14 14:31:12 +01:00
Alexis Sellier cd12741bf2
node: Prevent redundant [re-]connections
It was possible to trigger multiple connection attempts to the same
peer, since we didn't track connection attempts that hadn't yet
returned to the service via `Service::attempted`.

With this change, we add an extra `Initial` state to sessions, so
that redundant connections are not attempted when one is already under
way.
2023-03-14 13:42:59 +01:00
Alexis Sellier 413238a1e0
node: Implement exponential back-off for reconnect
Instead of immediately attempting reconnection when a persistent
peer disconnects, wait some amount of time, increasing on every
attempt.
2023-03-13 17:43:49 +01:00
Alexis Sellier 94427ee22b
node: Call service on failed connection attempt
Before this change, we were not calling back into the service due
to the missing `NodeId`.
2023-03-13 16:31:00 +01:00
xphoniex 29b933e485
httpd: Use `RID` in tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
xphoniex 3ee76c2891
httpd: Separate `Error` types of git route and `/raw`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
xphoniex b80fc5437c
httpd: Move `404` test from `git` to root router
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
Alexis Sellier 3ae037f84e
Flesh out `CONTRIBUTING.md`
Add code guidelines and instructions.
2023-03-13 15:10:53 +01:00
Alexis Sellier 9c77332cba
cli: Implement `tag` and `untag`
These commands are added at the top level because they will eventually
also work on patches.
2023-03-13 15:08:14 +01:00
Alexis Sellier 2737369910
cli: Fix missing patch announcement 2023-03-13 14:37:01 +01:00
Alexis Sellier 7266729924
Make Patch `state` field similar to Issue
Since they are similar objects, they should have similar structure.
This also makes it easier to add state metadata like for issues.
2023-03-13 13:55:12 +01:00
Alexis Sellier f7aac06a8f
cli: Polish `assign` and `unassign` commands 2023-03-13 12:27:47 +01:00
Alexis Sellier 49a6dacd75
Flesh out `README` 2023-03-13 12:19:20 +01:00
Fintan Halpenny 646376828d
node: add tracking-scope option
The radicle-node was forced into using Scope::Trusted for its default
scope.

Allow the Scope to be specified at the command line using a
`--tracking-scope` option.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-13 12:13:12 +01:00
Alexis Sellier 8e5627d28a
node: Rename `tracked_repo` -> `repo_policies`
I was finding the current naming misleading, as the returned entries
could be for blocked repos/nodes.
2023-03-13 11:41:07 +01:00
Alexis Sellier 4f062ef2c6
node: Fetch missing inventory
Periodically, make sure we try to fetch inventory that is tracked
but missing from local storage.

We decide not to fetch immediately on `TrackRepo`, as this limits
the command's flexibility. For example, when `rad clone` is used,
we want to be able to fetch manually after tracking.
2023-03-13 11:38:33 +01:00
Alexis Sellier b33fb2a33d
cli-test: Improve testing framework logging
Show which file is being run.
2023-03-13 11:38:33 +01:00
Vincenzo Palazzo f8aa1daedb
cli: show the issue when it is created
Show the issue when it is created to give feedback to the user.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-03-12 19:26:28 +01:00
xphoniex 9f1896e07f httpd: Add root handlers for `/api/v1` and `/api`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-12 19:12:40 +01:00
Alexis Sellier 6e90444406 httpd: Basic alias support for git
Allows cloning via git using an alias instead of the full RID.

Eg. `git clone https://seed.radicle.xyz/heartwood.git`
2023-03-12 18:31:19 +01:00