Commit Graph

459 Commits

Author SHA1 Message Date
Slack Coder a6d59b3c0e
cli: alter use subcommands for patch
Make `rad patch` accept subcommands for specifying its operation in
place of the '--command' notation.

For instance `rad patch update` versus `rad patch --update`.  Also make
the default operation list active patches, replacing patch creation.
Patch creation is now done via `rad patch open`.

Make these changes in a way consistent with other commands like `rad
delegate`.

Add '--no-confirm' to patch to support this subcommand's documentation
test.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-17 10:08:44 +01:00
Alexis Sellier 6d420813f5
node: Fix attempted session state
We shouldn't be marking attempted peers as "connected". We should wait
for the connection to be properly established.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2023-01-13 15:44:01 +01:00
Alexis Sellier 438ae84304
node: Implement E2E node test
There are few unrelated changes in this commit that I wasn't able to
split out, mostly due to laziness, so I'll list them here:

* The node startup logic is moved out of the main function, and into a
  dedicated functionin `client.rs`.
* There is a tentative worker implementation that is untested, and
  handles git replication both ways. It's likely lacking in various ways
  but I wanted to get it in there anyway.
* `Address` was moved from `radicle-node` to `radicle`, because it's
  needed to send `Connect` commands from the node handle.
* The `netservices` dependency was updated.
* Finally, there is a first end-to-end node test, which currently
  doesn't use NoiseXK, but uses the new reactor in `netservices`.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-12 20:34:31 +01:00
xphoniex 7962ac0a8e
httpd: Add api tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-12 20:30:53 +01:00
Slack Coder 897d439f95
radicle-cli: Correct operation name
Change `OperationName::Create` to `OperationName::Open` and change the
command argument to reflect this.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-12 19:59:43 +01:00
Slack Coder eedf08031d
README: Add install instructions
Advise on how to install the project as `cargo install` requires the
`--locked` option to succeed.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-12 13:15:37 +01:00
Slack Coder dec7979644
Update github workflow dependencies
Outdated dependencies are producing warnings, some about upcoming
deprecations.

For example:

```
The `set-output` command is deprecated and will be disabled soon.
```

or

```
The `save-state` command is deprecated and will be disabled soon.
```

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-12 13:13:30 +01:00
Alexis Sellier 66f0f87933
Small change to storage log output
Previously it would show eg. `RefString(...)`.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-10 21:18:47 +01:00
Slack Coder a407c3a4f8
cli: simplify inspect
Remove redundant 'collect()' call.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-10 16:37:20 +01:00
Dr. Maxim Orlovsky 08334f790b
node: Get rid of `nakamoto::DisconnectReason`
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-10 16:35:40 +01:00
Adam Szkoda b7b33acbdf
Avoid slowing down PR CI jobs 2023-01-10 10:26:08 +01:00
Adam Szkoda dfc6e974f2
Publish radicle-httpd binary for testing
Signed-off-by: Adam Szkoda <adaszko@gmail.com>
2023-01-10 10:26:08 +01:00
Alexis Sellier a8bca9cd92
cli: Use imperative for commit message in `edit`
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-09 16:48:05 +01:00
Alexis Sellier a6066e3ac3
cli: Update `inspect` command
Fix order of iteration, and make output look more like commit log.
Also show commit parent and message.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-09 16:48:01 +01:00
Slack Coder 1eb2a5ab9d
radicle: Use 'RAD_PASSPHRASE' unmodified
Keep the passphrase as is by removing 'trim_end()'.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-09 16:45:51 +01:00
Slack Coder 03bc9d84d6
rad-remote-helper: honor RAD_PASSPHRASE
Make testing more convenient by reducing rad-remote-helper's dependency
on SSH Agent.  It may be opted out of by setting the `RAD_PASSPHRASE`
environment variable.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-09 16:44:35 +01:00
Adam Szkoda 3682ef195b
Add CI job for releasing binaries
Signed-off-by: Adam Szkoda <adaszko@gmail.com>
2023-01-09 12:54:41 +01:00
Alexis Sellier a50329eb43
cob: Remove redundant indentation
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2023-01-06 13:00:01 +01:00
Alexis Sellier 329af88ca6
cob: Quiet warnings in release mode
We were getting warnings in release mode, since the
debug code is not being run, and some vars are mutable
instead of immutable.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2023-01-06 13:00:01 +01:00
Dr Maxim Orlovsky cf0d55fb11
node: Update io-reactor
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2023-01-06 11:27:07 +01:00
Dr. Maxim Orlovsky 947c89a398
node: Implement simple worker thread pool 2023-01-05 15:56:08 +01:00
Dr. Maxim Orlovsky a7b1c19746
node: Implement worker thread handover
Also implements listener behavior.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2023-01-05 15:16:38 +01:00
Alexis Sellier e49226c500
cli: Make some changes to issue listing
* Use an `--assigned` flag
* Default to listing all issues

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 18:59:13 +01:00
Alexis Sellier b7d0479b5c
cob: Add some more information about `resource`
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 14:28:18 +01:00
Alexis Sellier 67f9c3554d
cob: Start testing history permutations
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 14:26:25 +01:00
Alexis Sellier 139f095d51
cob: Consolidate `from_history` impls
By implementing `FromHistory::apply`, COBs don't need to implement
`from_history`.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 14:25:47 +01:00
Alexis Sellier 2f42bc942c
cob: Make it easy to build histories
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 14:23:47 +01:00
Alexis Sellier 5ee1f42b6a
cob: Have clock value for empty COB state
By using `0` as the clock value for an empty state (without operations),
we simplify transaction code. Previously, there was no clock value for
empty states, which meant that we had to sometimes use an `Option`.
2023-01-01 18:29:47 +01:00
Alexis Sellier c568feb700
cob: Merge issue tags
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-31 09:58:51 +01:00
Alexis Sellier 911c194fb3
cob: Create proper `OpId` type
To still access a comment's author, we add a new `author` field.
2022-12-31 09:58:51 +01:00
Alexis Sellier 49cd26c0b3
Tidy up COBs code a little
* Move storage impl into `storage::git::cob`
* Rename `change::Create` to `change::Template`
* Rename `change::Storage::create` to `change::Storage::store`

Some of the renames are to further distinguish COBs from Changes, and
the different types of "create" operations within cobs.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-31 09:58:45 +01:00
Alexis Sellier bf22cea014
cob: Fix typos
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-30 12:59:11 +01:00
Alexis Sellier 86e56d2053
cob: Move graph sorting to `evaluate` function
This avoids passing the sorted items as an iterator.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-28 19:24:22 +01:00
Alexis Sellier 70260236b2
cob: Simplify graph builder
Since we use `Oid` as the primary graph index, there's no need to keep
a separate index.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-28 18:01:24 +01:00
Alexis Sellier 57fcb117fc
cob: Remove redundant history indices
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-28 17:53:00 +01:00
Alexis Sellier 2f07b76fcb
Switch to our own DAG representation for COBs
We're using petgraph to encode an operation based CRDT (each graph node
is an operation) as a DAG, and one of the important things to ensure
is that the final state is not influenced by the order of concurrent
operations. In this case a concurrent operation would mean two potential
graph traversal orders, as there's no direct edge between the two
concurrent ops. This is essential a "partial order" of operations.

To be able to test this, we'd want some kind of control over how
neighbors are iterated over I guess, when there's more than one possible
sort order. Say we have a graph like this:

             ┌────────b◄─────┐
             ▼               │
             a               d
             ▲               │
             └────────c◄─────┘

There are two possible topological traverse orders: [a, b, c, d] and [a,
c, b, d]. Having a way to go through these different orders would
be super handy.

One option would be to allow random order traversal. This would allow us
to test all orders by running the test enough times to likely test all
permutations.

Since petgraph doesn't support this, we implement our own simple DAG in
`radicle-dag`, which implements random-order topological orders.

For now, we don't make explicit use of these improvements, we simply
replace the underlying graph with our own.
2022-12-28 13:34:17 +01:00
Alexis Sellier 86a38e208b
crypto: Fix an 'unused import' warning
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-27 17:31:30 +01:00
Alexis Sellier f6177f85fe
cob: Remove redundant type
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-27 17:30:06 +01:00
Alexis Sellier f193d7d6cc
Improvements to keystore
* Use the correct passphrase type everywhere
* Allow conversion of secret key
* Extract logic for storing a key in keystore

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-27 13:43:16 +01:00
Alexis Sellier 2f1ea7f8da
Fix unused import in release mode
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-27 13:43:16 +01:00
Alexis Sellier 9ec7a0a2ce
cli: Fix flaky tests
We were setting the CWD for the parent process, which wasn't such a good
idea.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-27 12:53:57 +01:00
Fintan Halpenny aa05f676f7
cli: add delegate cli
Adds a `rad delegate` CLI command.

The command consists of three subcommands:
* `add` -- add a new delegate to the set of delegates of a project
* `remove` -- remove an existing delegate from the set of delegates of a
  project
* `list` -- list the delegates of a project

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:25:24 +01:00
Fintan Halpenny d7170ff9e7
radicle: ensure unique signatures when parsing trailers
To ensure that signatures are unique for verifying an identity a
HashMap is used in place of a Vec of tuples.

This prevents any double counting for quorum checks.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:23:39 +01:00
Fintan Halpenny adaed6a3ac
radicle: validated construction of Project
The `validate` method of `Project` was unused, which is problematic if
the attributes are supposed to be validated based on some
constraints. The issue is that `Project` provided public construction
of its fields with enforcing validation.

This change makes `Project`'s attributes private and introduces a
smart constructor `new` which is fallible if any of the constraints
are not met. The error type was changed to be a vector of errors since
all of these errors can be collected for better error reporting.

Deserialization also provided a way of constructing a `Project`
without ensuring any of the constraints were checked. To prevent this
a hand-rolled `Deserialize` is provided that goes through
`Project::new`.

To access the fields of `Project`, accessor functions are added and
all call sites are updated to use them.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:23:39 +01:00
xphoniex bd1b4ac5c1
httpd: Use `TraceLayer` on uppermost router
This allows prefix of each route e.g. `/api/*` to be visible in logs.

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-26 15:56:21 +01:00
Slack Coder 94be0ca392
cli: Make issue args more declarative
Avoid delegating argument parsing to issue::run().  Define the forms a
peer can take when given as an argument using an enum.  It is then used
to replace OperationName::Default, which is no longer needed, as the
commands default operation is now fully defined by the enum 'Operation'.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:53:06 +01:00
Slack Coder 61fe352ad9
cli: rad issue show
Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:52:14 +01:00
Slack Coder 260863f571
cli: list your assigned issues via 'rad issue'
Allow listing issues for a given peer by using 'rad issue list' with an optional
argument.

For convenience, make listing your own issues easy by making it the
default operation of 'rad issue'.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:52:14 +01:00
Slack Coder 83f2f2b5a5
cli: Make terminal::Table more accepting
Make the Table type easier to use by having it accept &str over String
types as arguments.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:44:19 +01:00
Slack Coder c0590a100d
cli: Lightly document terminal::Table
Help developers by giving a small description and example for its use.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:43:47 +01:00