Commit Graph

384 Commits

Author SHA1 Message Date
Alexis Sellier 3bd5589b1a
cob: Stabilize formats
> I'm going to be making a set of breaking changes to COBs in order to
stabilize the data formats. This is hopefully a one-time change that
bundles various breaking changes.

All COBs have been reworked: issue, patch, id.

The changes included are:

* Revise the assign and tag actions to take a single list of
  assignees/tags to set, instead of an "add" and a "remove" list. This
  makes API usage simpler when editing issues, and simplifies the apply
  function
* Rename "tags" to "labels", and the tag action to label. This is
  because tag is confusing in the context of git, as it could mean a git
  tag. Using label removes that confusion.
* Use DIDs instead of PublicKeys for assignees -- this is more
  future-proof
* Modify the manifest file format in the COB tree. Mainly, remove the
  `history_type` key which is redundant, and use camelCase for keys
* Flatten the `Thread` actions into the parent action type
* Ensure that operations on redacted objects do not fail, since
  redactions could have happened concurrently
* Use a consistent naming scheme for actions, using `.` as separator
* Consolidate comment types and remove `CodeComment`, by adding an
  optional `location` field to `Comment`
* Add many placeholder actions that are not yet implemented

To preserve backwards compatibility, a `legacy` module is created with
the old `apply` function. When loading the manifest, we check whether it
is a legacy COB or a "stable" COB, and in the legacy case, use the
legacy code to materialize the state and then convert the object into
the stable type. Eventually, we'll delete the legacy code.
2023-08-07 11:05:14 +02:00
Alexis Sellier 885f4999da
remote-helper: Fix refs advertisement for patches
Some of the old patches had missing objects and that causes problems
during the ref advertisement, as the object is not found.

In this patch, we check that the object exists and also that the patch
is still open. Otherwise a remote tracking branch is created for every
single patch ref.
2023-08-06 17:29:21 +02:00
Slack Coder 0141313b35
cli: Refactor git diff encoding
Move code for writing radicle_surf diff's in git's unified diff format
into its own module.  Lean on the type system by defining a
`UnifiedDiff` trait to provide a method `encode` to encode to the
format and another default method to convert to a git 'unified' diff
string.

Additionally a `Header` struct is added to support processing Unified
Diff files.  The Header's line numbers must be tracked and modified to
produce legal diff files.

This is in preparation for DDiff support.  Upcoming improvements will
include parse unified diff's into these types to support test data.
2023-08-04 12:45:53 +02:00
Slack Coder 6ed3ab914d
cli: Vanity update for review
Reduce duplicate hard to read code by using a closure.
2023-08-04 12:44:28 +02:00
cloudhead 3898fece08
cli: `git pull` to update patches in working copy
We enable users to pull updates to a patch by calling `git pull`
on the patch branch.
2023-08-04 12:28:22 +02:00
cloudhead c30f137bb1
cli: Add `--timeout` and `--count` to `node events` 2023-08-04 12:23:58 +02:00
cloudhead 2d79eecd66
cli-test: Update framework with new features
* Ability to switch between environments within the same test file
* Ability to expand env vars in `cd` command
2023-08-04 12:23:49 +02:00
Alexis Sellier 2ea9a911af
remote-helper: Handle patch update after merge
If you accidently merge updated patch code before updating the patch in
storage, you end up in this weird state where you can't update the patch
any longer. This fixes it.
2023-08-03 18:01:04 +02:00
Slack Coder 67a8ee9e86
cli: Remove rad-inspect `tree' dependency
Hard code output similar to the 'tree' command in rust to avoid having
to shell out.
2023-08-03 13:40:48 +02:00
Vincenzo Palazzo f91ef2963e
cli: Fix partial matching for the --seed flag
This commit addresses the inconsistent parsing of the command by fixing the
partial matching behavior for the `--seed` flag. Previously, specifying
the seed value resulted in an invalid option error, as shown in the example below:

```
➜ ~ rad sync --seed z6MksmpU5b1dS7oaqF2bHXhQi1DWy2hB7Mh9CuN7y1DN6QSz
✗ Error: rad sync: invalid option '--seed'
```

With this fix, there are no restrictions on when the seed can be specified.

In a future change, we plan to implement a custom error message when a
match case does not meet specific requirements, such as `rad --fetch --announce`,
which will return a more informative error message. However, this
enhancement is left for a derived solution.

```
➜  ~ rad sync --fetch --announce
✗ Error: rad sync: invalid option '--announce'
```

Fixes: d6cebf613f
Suggested-by: Slack Coder
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-08-03 13:34:23 +02:00
cloudhead d0fdd0b6a3
cli: Make `rad patch checkout` idempotent
Fixes an error when you checkout an already checked out patch.
2023-08-02 11:17:16 +02:00
Alexis Sellier 8a3133e137
node: Include addresses in `Command::Seeds` result
This will allow the CLI to connect to seeds on the go.

We also do some refactoring of some of the code involved in fulfilling
the `Seeds` command.
2023-08-01 15:48:44 +02:00
Alexis Sellier 693f0a2c44
node: Some small UX fixes
Fixes an error which said "invalid argument" the first time the node was
started.
2023-08-01 14:55:20 +02:00
Sebastian Martinez 3366535c9d
rad: Disable tests that use `sed` on macos
Due to differences between how BSD sed and GNU sed work, we disable for
now tests that use sed on macos

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-26 13:23:15 +02:00
Alexis Sellier 41bff1b3bb
node: Make user connections persistent
While the node is running, connections made via the `Connect` command
should be retried.
2023-07-26 12:52:11 +02:00
Alexis Sellier f639192dc6
cob: Remove CRDTs from COB state
It turns out that the CRDT formed by the union of Git DAGs
is enough to guarantee everything we need for COBs.

This changes the following things:
* COB operations no longer need to be commutative
* COB histories are traversed in the same deterministic order on all
  replicas
* It's now possible to implement RSMs on top of COBs, eg. scripting
* Lamport clocks have been removed
* `radicle-crdt` is no longer a dependency of `radicle`
* COBs are no longer instances of `Semilattice`
* The `Ops` type was removed in favor of having `Op` contain multiple
  actions
2023-07-25 15:29:27 +02:00
xphoniex 4869fe26e2
Add `-h` flag to binaries
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-25 11:58:39 +02:00
Michail Zampetakis 0e54c4a293
cli: Fix rad-fetch readme link 2023-07-25 11:52:24 +02:00
Slack Coder 1edab8c9a6
cli: Select review target by Revision ID
Support testing the review system against real world data by accepting
a Revision ID.
2023-07-25 11:45:12 +02:00
Slack Coder 2a0643cf1c
cli: Vanity review.rs update
Absorb a nested `if .. else` block into the match statement.
2023-07-25 11:45:12 +02:00
Slack Coder fe00ed7ca7
cli: `rad issue list` open issues by default
Help the user by reducing the amount of output.  A user is generally
only interested in open issues.  The '--all' flag is provided to list
all issues.
2023-07-25 11:39:39 +02:00
Alexis Sellier 3119294367
Add `--version` flag to binaries
Help users confirm all their radicle binary versions by providing the
'--version' flag.

Move the print_version function to the radicle crate for use by the node
and remote-rad binaries, and remove tests to confirm the output format
as it is deemed redundant.

Co-Developed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-07-25 11:36:50 +02:00
Alexis Sellier 18dacbb48c
cli: Start node in background by default
It makes much more sense to start the node in the background, now that
we have commands to interact with it.
2023-07-20 10:40:30 +02:00
Alexis Sellier edd70b701e
cli: Give hint on how to start node, when stopped
Also enable some tests that were disabled.
2023-07-20 10:40:24 +02:00
Alexis Sellier b827c6bc54
cli: Fix `rad self` output
By using strings that include ansi escape codes, we had broken
truncation behavior.
2023-07-20 10:40:19 +02:00
Alexis Sellier f92308cf25
cli: Make key encryption optional
By leaving the passphrase prompt blank, users can create unencrypted
keys.
2023-07-20 10:40:15 +02:00
Alexis Sellier e593191ae2
cli: Automatically remove control socket
Instead of requiring that `--force` be used manually, we check to make
sure the node is not running, and if so, pass `--force` to the node
process.
2023-07-20 10:39:36 +02:00
Alexis Sellier ff7e9ded17
radicle: Introduce `cob::DraftStore`
This storage backend for COBs stores changes in a `draft/cobs/*` namespace,
which allows for some of the features needed for code review. For
example, users can draft comments and later decide to publish
them.
2023-07-14 16:57:55 +02:00
Alexis Sellier c9162121b0
cob: Parametrize `cob::Store` with repository type
The additional flexibility in choosing a backend for the COB store will
allow things like "draft" COBs that are stored in a different location,
without changing much of the logic.
2023-07-14 16:57:55 +02:00
Alexis Sellier 45ccbde226
Update `radicle-surf` and `git-ref-format` 2023-07-14 16:57:55 +02:00
Fintan Halpenny dfa7ba1df5
radicle: type safe tracking config
The tracking database can be opened in read-only or read-write
mode. Knowing which is being used is significant in concurrent
scenarios, e.g. it's safer to have a read-only handle on multiple
threads.

Provide static type information by signifying what kind of database
handle is being worked with, read or read-write.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-07-14 16:52:42 +02:00
Alexis Sellier b27313bc5c
Don't fail if we can't open the database
We make sure that even if there is no database file, we're still able
to return `None` for the alias lookup.
2023-07-12 11:37:20 +02:00
Alexis Sellier eb701be033
node: Make node aliases required
This is a fairly substantial change, which adds a new configuration file
to the user's `$RAD_HOME` that includes node configuration, including
the alias, and also makes node aliases required.

When running `rad auth`, the user is now prompted for an alias, which
defaults to `$USER`.

When running `rad self`, the alias is now shown.

If the user runs radicle without a config file, the defaults are loaded,
and `$USER` is used as the alias.
2023-07-11 18:08:59 +02:00
Sebastian Martinez 8ed55a1925
cli: Add `--to` flag to `rad issue react`
This allows the CLI to create a reaction to a specific comment without showing the
comment selector.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-10 16:41:42 +02:00
xphoniex 329ccbb304
cli: Add alias and check `rad patch` & `rad issue`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
xphoniex 1459e4a57f
cli: Use `.aliases()` store for issues
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
xphoniex 37847d4c63
cli: Use `.aliases()` store for patches
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02: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 f73389fc62
cli: Make `rad node connect` work like `--connect`
It was using a different syntax.
2023-07-04 00:26:31 +02:00
Alexis Sellier 45e87a63b9
cob: Changes to patch code review CRDT
This patch incorporates several important changes to code review:

* Code review verdict is no longer editable
  * Made reviews redactable instead
* Renamed review top-level comment to "summary"
* Renamed inline comments to "comments"
* Made inline comments addressable by `EntryId`
  * This is to allow for editing
* Removed inline comments from review creation
  * Added a `CodeComment` action instead
* Removed `Semilattice` instance from `Review`
  * Added a `EditReview` action instead to have more control
* Made it valid for revisions to be redacted concurrently with a review/merge

Most of these changes are needed to support proper inline code comments.
2023-07-03 12:31:05 +02:00
Alexis Sellier 0f3212a1b2
cli: `rad self` improvements
* Add `--home` flag
* Organize the information better

Now looks like this:

    DID             did🔑z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
    └╴Node ID (NID) z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
    SSH             running (823)
    ├╴Key (hash)    SHA256:UIedaL6Cxm6OUErh9GQUzzglSk7VpQlVTI1TAFB/HWA
    └╴Key (full)    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHahWSBEpuT1ESZbynOmBNkLBSnR32Ar4woZqSV2YNH1
    Home            [..]
    ├╴Storage       [..]/storage
    ├╴Keys          [..]/keys
    └╴Node          [..]/node
2023-06-30 14:41:00 +02:00
Alexis Sellier 613e3e5269
cli: Show logs after `rad node start`
When the node is started, we show the first few log lines.
2023-06-29 18:45:16 +02:00
Alexis Sellier 2e6c9827a9
cli: Show logs in `rad node status` 2023-06-29 18:01:49 +02:00
Alexis Sellier e32e28f8b4
cli: Implement `rad node stop` 2023-06-29 17:58:07 +02:00
Alexis Sellier 0d0d354d55
cli: Ask for passphrase upfront in `node start` 2023-06-29 15:02:08 +02:00
Alexis Sellier ba9c5997b7
cli: Add `rad node logs` sub-command
Prints the last `n` lines and follows the log.
2023-06-29 14:58:11 +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 e325fa8621
cli: Turn `patch update` into a plumbing command
Remove most of the user-friendly functionality and simplify this command
so that it is only used for scripting.

`git push rad` is now the proper way of updating patches.
2023-06-21 17:02:00 +02:00
Alexis Sellier b25c2e452b
cli: Setup tracking branch on `rad patch checkout`
Just like when opening a new patch, we setup a tracking branch on patch
checkout, so that patches can be updated via a push.
2023-06-21 17:01:56 +02:00
Alexis Sellier 1e948485be
cli: Make some UX improvements to `rad auth`
Better errors, messaging etc.
2023-06-20 16:05:35 +02:00