Commit Graph

1115 Commits

Author SHA1 Message Date
Alexis Sellier ff7338de17
node: Always send node announcement on handshake
Previously, we only sent the announcement when there were external
addresses. But it contains other information like the node alias,
therefore we always send it.

Since the proof-of-work can be expensive to compute everytime, we add
the ability to load the local node announcement from the file system.

We also change the proof-of-work parameters so that they are relaxed
when running in debug mode, instead of when running tests.

Finally, we remove the boolean validation of the PoW. Instead, we store
the work per-node, in the database, to be used in the future in case of
DoS attacks or network congestion.
2023-06-07 11:39:23 +02:00
Alexis Sellier e86e061a12
remote-helper: Patch message option when pushing
Allows for setting a patch message during a push. Eg.:

    $ git push -o patch.message="My Title" -o patch.message="My description" \
      rad HEAD:refs/patches

Works the same way as the `-m` flag of `git commit`.
2023-06-07 11:37:39 +02:00
Sebastian Martinez 6578fedfbb
cli: Add issue id to `show_issue` function
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-06-06 11:11:20 +02:00
Sebastian Martinez d2202a07ab
httpd: Add `validate` fn to auth module
Check for AuthState and expiry.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-06-02 17:34:24 +02:00
Slack Coder 65763a2ad2
cli: Enable redacting patch revisions
Use `rad patch redact <revision-id>` to redact (delete) a patch
revision.
2023-06-02 17:30:13 +02:00
xphoniex 13bea902b2
radicle: Create `Aliases` and use it in `httpd`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 14:50:49 +02:00
xphoniex 0cae3c0967
radicle: Implement `AliasStore` for address `Book` 2023-06-02 14:49:30 +02:00
xphoniex f526465f1b
radicle: Make addresses.db accessible from profile
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 14:49:20 +02:00
xphoniex 738d0dcbad
node: Introduce `AliasStore` trait
httpd: use the `AliasStore` trait

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 14:48:33 +02:00
Alexis Sellier 4652f309b4
Update to Rust 1.70 2023-06-02 14:40:44 +02:00
xphoniex fd91cf4d28
node: Add access to routing.db on `profile`
httpd: Use routing.db to return `trackings` of an RID

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 13:42:44 +02:00
Slack Coder 1c9670b90f
cli: Fix `rad issue edit`
Make the `rad issue edit` subcommand accessible to users.
2023-06-01 14:00:33 +02:00
Erik Kundt 474d21741e
tui: Fix global navigation subscriptions 2023-06-01 13:55:49 +02:00
Alexis Sellier 97f122c451
cli-test: Build radicle binaries automatically
To avoid having to call `cargo build` before running the tests, we build
the necessary binaries automatically using the `escargot` crate.
2023-05-31 17:21:12 +02:00
Erik Kundt 21533f37eb tui: Add issue page with placeholder 2023-05-30 22:02:44 +02:00
Erik Kundt 56a61b61c9 tui: List issues 2023-05-30 21:30:19 +02:00
Alexis Sellier 5f731fad0e
dag: Improve trait bounds 2023-05-30 16:31:01 +02:00
Alexis Sellier b60569d3cb
cob: Test deterministic traversal order
We test to make sure that in the event of concurrent operations,
traversal order is deterministic.

This required some changes to the testing infrastructure. We're also
able to simplify the `Actor` type that now has redundant functionality.
2023-05-30 16:31:01 +02:00
Alexis Sellier 0e14dacb99
cob: Simplify graph evaluation
Simplify graph traversal and evaluation by building in some of the
functionality into `radicle-dag`, namely the pruning fold.

We avoid building vectors of graph nodes this way, and simply iterate
over the graph in one go.
2023-05-30 16:31:01 +02:00
Erik Kundt 0361ca3818 tui: Use table model in patch browser 2023-05-30 15:03:12 +02:00
Erik Kundt 0a673bc552 tui: Remove page state for patches 2023-05-30 15:03:12 +02:00
Erik Kundt d01028502e tui: Use table model for labeled container 2023-05-30 15:03:12 +02:00
Erik Kundt de6bb8fdb0 tui: Implement table item patches 2023-05-30 15:03:09 +02:00
Erik Kundt 5d7bf9f663 tui: Introduce table item and table model 2023-05-30 14:39:52 +02:00
Sebastian Martinez c2dd778183
cli: Add `--json` flag to `rad web`
This allows third party integrations to read the obtained sessionId and
the signed payload without having to implement it on their own.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-05-30 10:39:37 +02:00
Slack Coder 22c7945e7b
cli: Strip html comments 2023-05-30 10:34:36 +02:00
Erik Kundt a4be8f4fa9
tui: Consolidate widgets and components 2023-05-29 22:07:10 +02:00
Slack Coder 02f5596c05
cli: Add state filters for `rad issue list`
Allow filtering the issues by their state.
2023-05-29 19:50:33 +02:00
xphoniex c25450d310
httpd: Return `alias` field on `merges` of a patch
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-29 12:48:11 +02:00
Slack Coder 3af53626f0
cli: Reorder method arguments
Reorder the method arguments in the commands to make them consistent.
2023-05-29 12:42:55 +02:00
Slack Coder f2d4b9acc2
cli: Support `rad issue edit`
Support editing an issue via the command line.
2023-05-29 12:22:51 +02:00
Slack Coder 478b61f875
cli: Refactor `rad issue open`
Lift the issue editing logic into its own function.
2023-05-29 12:22:50 +02:00
xphoniex 15070c4074
httpd: Add author to revision of a patch
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-29 12:11:13 +02:00
Alexis Sellier 01ab91db86
cli: Fix sort order for patch listing 2023-05-29 12:02:59 +02:00
Alexis Sellier aa8394a838
cob: Make errors more consistent across COBs
Though these are perhaps not the final error types, we name them the same
across COBs and have them work the same way.

All COB modules now have a `Error` enum.

In a future change, we may want the `FromHistory` trait to support
multiple error types, eg. one for `apply` and one for `validate`.
2023-05-29 11:33:29 +02:00
Alexis Sellier eeaf380067
cob: Add validation step when loading COBs
This adds a simple `validate` function to COBs that is run on load. It
allows COBs to check whether they are valid, once all operations are
loaded, and return an error if not.
2023-05-29 11:27:04 +02:00
Alexis Sellier c400961cec
Update `io-reactor` and related dependencies 2023-05-27 20:43:56 +02:00
Alexis Sellier e6baeab0c9
cob: Guarantee there is always a latest revision
We change `Patch::latest` to always return something, because a patch is
malformed if it doesn't have at least one revision, and thus would not
load in the first place.

This also implies that there is a latest revision in the face of
concurrent updates.

Note that currently, traversal order for concurrent updates is still random.
This will be fixed in another patch.
2023-05-26 10:31:00 +02:00
Alexis Sellier 37d6c03026
radicle: Fix a documentation issue 2023-05-26 10:31:00 +02:00
Alexis Sellier e41d67544c
cob: Add `reviewers` field on `Patch`
We aren't ready to support this yet from an end-user perspective, but
we add it in the COB already to prepare.
2023-05-26 10:31:00 +02:00
Alexis Sellier ac60069a33
cob: Remove `description` from `Patch`
Since patches always have a "root" revision, use that revision's description
as the patch description.
2023-05-26 10:31:00 +02:00
Alexis Sellier e18f01cab4
radicle: Be more lenient when applying merge ops
Before this change, if a merge op referred to a commit that was not on
the default branch, the merge op and all descendant ops would be pruned.

This is a bad idea because the state of the default branch can change
*after* the merge op is created, which is out of the control of the
merge op author.

Therefore, instead of exiting, we keep processing ops (but ignore the
merge), in case the merge is invalid for this specific reason.
2023-05-25 11:29:54 +02:00
Alexis Sellier ac06e319cd
remote-helper: Delete patch branches after merge
This cleans up the branches that were created during patch open, when a
patch is merged.
2023-05-25 10:07:02 +02:00
Alexis Sellier 4722b9b417
scripts: Add `delete-remote-branches` script
This is useful for cleaning up remote branches that are no longer used.
2023-05-25 10:07:02 +02:00
Alexis Sellier 4176d62e38
remote-helper: Add `no-sync` push option
This is mainly useful for scripting, when for eg. you want to push
multiple things and sync only once, at the end.
2023-05-25 10:07:02 +02:00
Alexis Sellier 664aa570e6
node: Spawn a thread for each control connection
Previously, only one connection to the node control socket could be
handled at a time. This usually worked fine, but if one connection hangs
for whatever reason, no other process can access the node.
2023-05-24 11:33:55 +02:00
Alexis Sellier b8c2f2a647
node: Rename `InvalidPacketLine` error variant
In case of timeout on reading the packet-line, we would get this error.
It would be confusing, as the packet-line wasn't invalid, just never
received.
2023-05-24 11:33:55 +02:00
Alexis Sellier 366e61a053
cli: Improve error output of commands
Previously, we would sometimes get very repetitive error messages. This
change prevents that from happening.
2023-05-24 11:33:55 +02:00
Alexis Sellier 5fa677c5fb
node: Fix worker fetch deadlock
It turns out it's possible to create a deadlock when using
`child.wait()` with `Stdio::piped()`, if we don't read the output while
the child process is running. This is because the pipe has an internal
kernel buffer that will eventually fill up, causing the child process to
block on writing to stdout and never exit.

To remedy this situation, we read the stdout in a thread while the child
process is running.
2023-05-23 16:12:52 +02:00
Alexis Sellier 4bf15bf7ca
remote-helper: Don't use external command for sync
We use the library function which gives us more control over the output
and removes the need to create a sub-process.
2023-05-23 16:11:42 +02:00