Commit Graph

131 Commits

Author SHA1 Message Date
Alexis Sellier 16a01a42bf
node: Delegate passphrase prompt to CLI
Instead of asking for the passphrase in `radicle-node`, we expect the
`RAD_PASSPHRASE` env var to be set.

This keeps `radicle-node` simpler and lower level, while the passphrase
prompt is still available via `rad node start`.
2023-07-15 12:44:14 +02:00
Alexis Sellier 45ccbde226
Update `radicle-surf` and `git-ref-format` 2023-07-14 16:57:55 +02:00
Fintan Halpenny bed69ddca9
radicle: fix cyphernet flag & update deps
The `cyphernet` package has two feature flags that delegate to
underlying crates. These are:
* ed25519 = cyphergraphy/ed25519
* p2p-ed25519 = cypheraddr/p2p-ed25519

When attempting to install binaries, the compiler will result in an
error:
```
error[E0432]: unresolved import `cyphernet::addr::PeerAddr`
  --> radicle/src/node.rs:26:9
   |
26 | pub use cyphernet::addr::PeerAddr;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ no `PeerAddr` in the root
```

The `PeerAddr` type is only exported when `p2p-ed25519` or
`cypheraddr/p2p-secp256k1` is enabled. The `radicle` crate was using
the `ed25519` flag. Instead, the `p2p-ed25519` flag should be used.

No explanation as to why the previous flag was working could be found,
but is being discussed on Zulip[[0]].

To update the dependencies, a `cargo update` was also excuted to
update the dependencies.

[0]: https://radicle.zulipchat.com/#narrow/stream/369277-heartwood/topic/cyphernet.20dubious.20feature.20flag

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-07-04 11:10:07 +01:00
Alexis Sellier 1a1e63d998
node: Implement `sessions` command
Returns session information through the control socket.

We also update `rad node status` to display sessions.
2023-07-04 00:26:31 +02:00
Alexis Sellier 63ff4717dc
cli: Implement hunk-based code review
Review code with an interface similar to `git add -p`.
2023-06-22 11:15:42 +02:00
Alexis Sellier e700608095
Update `radicle-surf` 2023-06-22 11:15:42 +02:00
Vincenzo Palazzo 431a389944
radicle: Use "bundled" sqlite dependency
Our build was faking the inclusion of SQLite and dynamically
linking it in the 'radicle' crate and other components.

This patch solves the following error and requires reinstallation
of the `radicle-cli`, `radicle-node`, and, if used, the `radicle-httpd`

```
✗ Sync failed: internal error: malformed database schema (node-policies) - near "strict": syntax error (code 11): malformed database schema (node-policies) - near "strict": syntax error (code 11)
```

Tested-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-06-08 15:08:22 +02:00
Alexis Sellier 4652f309b4
Update to Rust 1.70 2023-06-02 14:40:44 +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 de6bb8fdb0 tui: Implement table item patches 2023-05-30 15:03:09 +02:00
Alexis Sellier c400961cec
Update `io-reactor` and related dependencies 2023-05-27 20:43:56 +02:00
Alexis Sellier 0c41de1433
term: Fix editor closing `stderr` stream 2023-05-16 21:11:57 +02:00
Alexis Sellier 51dced4808
cli: Use library for opening patch
Instead of calling `rad patch open`, use `patch::create` directly.

Also outputs the patch id for the user.
2023-05-15 12:22:09 +02:00
Alexis Sellier fd1237b2db
cli: Use `git push` to open or update patches
This adds the ability to the git-remote-helper to open and update
patches via a `git push` to the magic ref `refs/patches` and
`refs/heads/patches/<patch-id>`.

The main change is that we had to move away from offering the `connect`
capability in the remote helper, to offering `push` and `fetch`
individually.

To get a feel for how this works, see the `rad-patch-via-push.md`
example.
2023-05-12 12:22:08 +02:00
Alexis Sellier 8da6363cb3
term: Remove `concolor` dependency
Use `anstyle-query` and `is-terminal` instead, which are the replacement
crates that are also used in `snapbox`.
2023-05-10 15:56:39 +02:00
Alexis Sellier d249937a61
Update dependencies
* radicle-surf
* radicle-git-ext
* amplify
2023-05-10 15:56:21 +02:00
Fintan Halpenny 8508eab8fa
radicle: update radicle-git-ext
This change updates to the latest radicle-git-ext, which required a
few changes within the radicle family of crates.

One set of changes is that the radicle-git-ext crate subsumes
git-commit, git-trailers, and git-ref-format -- so all those imports
go through radicle-git-ext.

The commit code requires that parent `Oid`s point to commits, which
made some tests fail. One of the reasons for these failures is that
the patch tests used fabricated `Oid`s and so the verification would
fail. This is fixed by allowing the test context code to create
`PatchRequest`s that create valid commits.
The other reason for failure was that the identity `Action` passed an
`Oid` that pointed to a blob. This is fixed by removing that code and
making a note of it in documentation.

The final major change was moving the Refspec type into git-ref-format
and removing the AsRefspecs trait. The trait was not required and
could its usage could be replaced by simpler code.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:36:15 +01:00
Alexis Sellier 7f8526ff76
Update yanked version of `inquire`
Version 0.6.0 was yanked from crates.io.
2023-04-23 15:14:19 +02:00
Erik Kundt 80c1e45a99 tui: Add ui wrapper for patches
Signed-off-by: Erik Kundt <erik@zirkular.io>
2023-04-18 16:21:54 +02:00
Alexis Sellier c99497eb21
Update `netservices` to 0.2.2
This includes a small change in how the EOF is sent as well.
2023-04-17 15:53:31 +02:00
Alexis Sellier 56e41fadd9
node: Update `netservices` and `io-reactor`
This fixes hanging issues we were experiencing.
2023-04-14 23:30:18 +02:00
Alexis Sellier 8205f8ad4e
Update `fastrand` dependency to 1.9.0 2023-04-14 13:15:52 +02:00
Erik Kundt bd4efee897
tui: Implement basic application
Signed-off-by: Erik Kundt <erik@zirkular.io>
2023-03-20 16:27:42 +01:00
Erik Kundt 62867d26bd
tui: Add basic framework
Signed-off-by: Erik Kundt <erik@zirkular.io>
2023-03-20 16:27:42 +01:00
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 40c58b45ed
node: Move `routing` to `radicle` crate 2023-03-15 12:59:49 +01:00
Alexis Sellier f7aac06a8f
cli: Polish `assign` and `unassign` commands 2023-03-13 12:27:47 +01:00
Alexis Sellier aacacf872f
cob: Use `EntryId` as the operation identifier
By introducing a small limitation: only allowing entries in the change
graph to be addressable, instead of individual operations; we
drastically simplify the CRDT implementation.

There are four advantages:

1. Op ids are just regular SHA-1s
2. There's no need for relative IDs, ops never refer to other ops within the
   same commit
3. There's no need for a nonce, since commits can't collide, and neither can op IDs
4. `OpId` can just be an alias of `EntryId`

The disadvantage of course, is that we have to be mindful of how we
create op transactions, since each transaction creates an addressable
unit. For example, we must not include multiple patch revisions in the
same transaction.
2023-03-09 17:08:56 +01:00
xphoniex 267b0ed312
httpd: Use `radicle-term` instead of `radicle-cli::terminal`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-07 14:49:18 +01:00
Alexis Sellier 94899f7be2
node: Update `localtime` crate 2023-03-07 10:47:12 +01:00
Alexis Sellier 5fb5df2e61
cli: Update `inquire` crate 2023-03-07 10:39:45 +01:00
Alexis Sellier 793c085094
node: Don't force use of RAD_PASSPHRASE
If it isn't set, prompt the user.
2023-03-06 10:22:53 +01:00
Alexis Sellier 02304875ce
Initialize `radicle-term` crate
We split out all non-radicle terminal functionality so that it can be
accessed by `radicle-node` without importing `radicle-cli`.
2023-03-06 10:22:50 +01:00
Alexis Sellier 06a92d52d9
cob: Use hashes for operation ids
It's fairly easy for a user to (by mistake or intentionally) create two
operations with the same OpId. This patch makes it much less likely,
and ensures that if the OpId is equal, it's because the operations
are identical.
2023-02-27 17:11:48 +01:00
Alexis Sellier 0a93fa833e
cli: Simplify & improve CLI output
Improvements to the CLI output as well as converging towards
`termion` as a backend.

The crates we were using for prompting and spinners were based on
a terminal backend called `console`, which is not really used
anywhere else. There were also limitations in terms of the output
of these crates.

Therefore, we switched to the `inquire` crate for prompting, using
the `termion` backend, which is very standard.

Additionally, we simplify the terminal output to use symbols:

! for Warning
✓ for Success
✗ for Error

... Instead of a mix of words and symbols.

We also include a modified version of the `yansi` crate which plays
well with our table formatting functions by automatically truncating
and padding output in a unicode-aware way.
2023-02-27 17:10:52 +01:00
Fintan Halpenny 5ea8505000
radicle: custom CanonicalFormatter
The olpc-json crate's CanonicalFormatter does not escape certain
control characters, including new lines. This means that when a COB
gets serialized that includes new lines, those new lines are
serialized verbatim. Upon deserialization `serde_json` -- and any
other JSON deserializer -- will fail due to the encounter of these
control characters.

This behaviour was prevented in radicle-link with the definition of
its own CanoncialFormatter that encodes the control characters
correctly.

Inline this definition of the formatter, under MIT license, to ensure
the correct and remove oplc-cjson.

The behaviour is checked using a multiline test in the issue COB.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-24 11:59:36 +01:00
xphoniex 6ca1c89610 httpd: Update `/git` test to use `test` helper fns
Update `axum` to 0.6.7 to be able to use fix in:
https://github.com/tokio-rs/axum/pull/1767

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-22 17:06:32 +01:00
Dr Maxim Orlovsky 158f1ff7fa Update to fixed `io-reactor` timer 2023-02-22 16:21:25 +01:00
Alexis Sellier e584bd6c1c
crypto: Use `ssh-key` crate for signatures 2023-02-17 11:53:46 +01:00
Alexis Sellier 7e1b2b6222
crypto: Cleanup `hash` module
Remove `Digest` type and use `ssh-key` for formatting public ssh key.
2023-02-17 10:51:27 +01:00
Sebastian Martinez b04451a1bd
Use `Did` in a bunch more places
Instead of showing just public keys we need to show the fully qualified
spec for a NID which is prefixed by `did🔑` While we want to maintain
`Author` and `ActorId` for internal use.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-16 18:01:42 +01:00
xla feedf345a3
cli-test: Complete cargo metadata
Signed-off-by: xla <self@xla.is>
2023-02-16 14:55:33 +01:00
Alexis Sellier 8cbc3c2403
node: Move to NoiseXK
Move from NoiseNN with a custom authentication protocol, to NoiseXK.
Uses ECDH on the ed25519 curve via the `ec25519` library.
2023-02-15 22:05:04 +01:00
xla 97f7064094 cli: Extract crate for md based tests
To allow that functionality to be published for reuse.

Signed-off-by: xla <self@xla.is>
2023-02-15 15:25:38 +11:00
Alexis Sellier 7919c7ea61
node: Use millisecond precision for timestamps
Previously we used seconds, which could result in false positives
when checking for stale announcements, if things happened too quickly.
2023-02-14 20:31:40 +01:00
Sebastian Martinez 867eea5c38
httpd: Add delegates to project routes
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-14 14:50:42 +01:00
Fintan Halpenny b257f482cb
cli: rad id command
Introduces the `rad id` subcommand for interacting with the identity
proposal cob.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 13:50:52 +00:00
Alexis Sellier c673f5db68
node: Add some useful test utility functions 2023-02-12 21:03:28 +01:00
xphoniex bdc0ab9881
Update `radicle-git` and `radicle-surf`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-10 22:14:50 +01:00
Alexis Sellier 488f043226
node: Properly reap git-daemon process 2023-02-10 12:57:04 +01:00