Commit Graph

1887 Commits

Author SHA1 Message Date
Sebastian Martinez 9950182ee0
cli: Remove rad-web from help
Due to it not being stable, and eventually the auth flow to be
rewritten, it should be removed.
2024-03-11 11:06:32 +01:00
cloudhead b917c1b411
cli: Rename `rad ls --seeds` flag
Rename to `--seeded` as per our discussion in Zulip.
2024-03-11 10:46:09 +01:00
cloudhead d1e2e3b61e
cli: Fix some tests 2024-03-09 14:01:30 +01:00
Zlatan Todoric acf71fceaa
cli: Update help output 2024-03-09 13:51:30 +01:00
Rūdolfs Ošiņš 428fa0b0f2
docs: Add hint about how to open a patch to man page 2024-03-09 13:48:31 +01:00
Fintan Halpenny cac6c0aad7
cli: add name to `rad seed` output
If the name is available to show for the repository -- it may not be
if it hasn't been replicated yet -- then add it to the output of the
`rad seed` command.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-09 13:45:35 +01:00
Fintan Halpenny bb4ed84b95
node: duplicate fetching logic respects RefsAt
Two concurrent fetches can occur from the same peer, while also being
for a different set of references. This was seen in the
`test_outdated_sigrefs` test. Alice would have an ongoing fetch from
Eve, and concurrently, Eve will create a new issue -- thus creating a
new `RefsAt` message -- and Alice would attempt to fetch this.

The previous logic would only check that Alice is fetching from Eve
and ignore the new updates -- meaning the test could fail. However, if
the `RefsAt` are checked then the other fetch can be recognised as
new, and queue it.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-09 13:43:08 +01:00
Christopher Fredén 13d5b4f620
cli: fix `issue` command asking for passphrase
Only require `signer` when doing a write operation.
2024-03-09 00:03:24 +01:00
Fintan Halpenny 50833d88d9
cli: document `rad inbox` further
The documentation for `rad inbox show` and `rad inbox clear` were
missing.

Add documentation into the help message for both.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-09 00:01:26 +01:00
Fintan Halpenny b6e1385e39
httpd: improve error message for missing browser
If `open` or `xdg-open` fail the error is:

    No such file or directory (os error 2)

This generally means that the command could not open the browser on
the OS. To provide better help, improve the error message by informing
the user what went wrong and that they can run `rad web --no-open`
instead, while still printing the URL to visit.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-08 23:58:34 +01:00
Lars Wirzenius ccec3f80dc
cli: add "debug" subcommand
This writes out information that may be useful when debugging Radicle
remotely on a user's machine. Things like versions of programs, and
values of relevant environment variables.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-08 23:50:01 +01:00
Fintan Halpenny 3bba7d1634
cli: test rad patch delete
No tests for `rad patch delete` existed.

Add a test where two peers interact on a patch and one decides to
delete the patch. It ensures that the patch is still visible to the
peer that did not delete the patch.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-08 23:43:19 +01:00
Fintan Halpenny 73c120d8d4
node: do not delete cob in cache after fetch
If a peer deletes a COB, it does not mean that the COB should be
deleted. This was incorrectly assumed in the `radicle-node` fetch
code.

To fix this, when a `RefUpdate::Deleted` is seen after a fetch, the
cache is updated with the new state of the COB.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-08 23:43:19 +01:00
Fintan Halpenny 96c65eb2b3
cli: add replies to patch show output
If any replies to patches were made, it was not possible to see them
in the output of `rad patch show`.

Add the replies to show output, but only if the `--verbose` flag is
set.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-08 23:43:19 +01:00
Fintan Halpenny 3a2e06e498
cli: document --reply-to option
The option to reply to a comment was undocumented in the `rad patch
comment` command.

Add the option to the "Comment options" section of the help message.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-08 23:43:19 +01:00
Timm Behner 00102beb29
nix: Fix linker error on macos 14.3 with nix build
Using nix build resulted in a linker error

ld: framework not found Security

Following the proposed solution in
https://discourse.nixos.org/t/compile-a-rust-binary-on-macos-dbcrossbar/8612
resolves the issue.
2024-03-08 23:40:09 +01:00
Michael Raitza 4b1ca18d0c
nix: Compile commit hash into program version
Changes build.rs to take the GIT_HEAD environment variable into account
if `git rev-parse` is unable to determine the current commit hash.
2024-03-08 23:37:34 +01:00
Michael Raitza fb13e5f970
nix: Install man pages when building from flake 2024-03-08 23:35:45 +01:00
Thomas Scholtes e52ce483a1
httpd: Mark immutable response as such with Cache-Control header
For responses to requests for content that is content-addressed with Git
object IDs and consequently immutable, we add a Cache-Control HTTP
header that marks the responses as public, immutable and instructs
clients to cache the response for up to 7 days.
2024-03-08 23:31:43 +01:00
Alexis Sellier 1c4a2cd167
helper: Fix error message
Git was outputting a confusing message when an unuspported option was
used:

  fatal: helper rad does not support 'push-option'

This fixes it.
2024-03-08 23:25:31 +01:00
Alexis Sellier 786ce40f95
node: Add connection limits
The limits are roughly modeled after the Bitcoin network.
2024-03-08 23:24:34 +01:00
Sebastian Martinez 5bdc2ad1fb
httpd: Add author alias to reactions 2024-03-08 23:20:38 +01:00
Fintan Halpenny 64fd41961e
nix: add radicle-full
To allow Nix users to install radicle with all tools and helpers.
2024-03-08 23:19:15 +01:00
Fintan Halpenny e1affc2da6
nix: use rust-overlay for toolchain pinning
To ensure the Nix derivations are using the correct toolchain, defined
in the `rust-toolchain` file, use the `rust-overlay` library.

Also remove the `fenix` input, since this was actually never used and
was an artefact of some copy-paste shenanigans.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-08 23:19:15 +01:00
Sebastian Martinez 501b6ba9eb
httpd: Add author information to assignees 2024-03-08 23:15:34 +01:00
cloudhead a48081f271
cli: Move node addresses command
To make things a little more consistent, move the `rad self --address`
command to `rad node config --addresses`, since it's more about
externally-facing configuration of the node, rather than your local user
or profile.
2024-02-26 14:23:13 +01:00
cloudhead 091f7b7e98
node: Don't limit LAN addresses
These are defacto trusted.
2024-02-26 13:42:06 +01:00
cloudhead 9c96b46c59
cli: Show full path in `rad init`
Instead of showing a '.'
2024-02-26 12:40:17 +01:00
cloudhead 9c9bbbe7bb
node: Expose listen addresses 2024-02-26 12:35:20 +01:00
cloudhead d86d99e002
cli: Fix `rad config` bugs
The command was unable to deal with an invalid config. We fix this by
introducing a way to load the user's home without loading the config.
2024-02-26 12:10:34 +01:00
cloudhead b0fbbeed6b
node: Upgrade dependencies
Fixes issue with improperly closed connections.
2024-02-26 11:47:03 +01:00
cloudhead d16ae3edc9
scripts: Add COB caching script 2024-02-23 18:35:50 +01:00
cloudhead 09f2befa58
radicle: Authorize certain changes if no-op
For backwards compatibility, if a change is a no-op, we allow it even if
it's normall not authorized.
2024-02-23 18:29:07 +01:00
cloudhead 0726754b0e
cli: Add `--repo` option to `issue` and `patch`
Allows users to operate on a repo without a checkout.
2024-02-23 18:16:52 +01:00
cloudhead 449790e252
radicle: Fix indentation of SQL file 2024-02-23 17:57:32 +01:00
Fintan Halpenny 9e745b68d1
cli: add caching commands for patch and issue
In order to bootstrap the COB cache, and also in case of issues,
supply a command for caching a set of patches/issues, or a single
patch/issue.

This is necessary since reads are not read-thru, it may appear that
COBs are missing when in fact they haven't been cached when first
moving over to the cache.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 16:03:26 +01:00
Fintan Halpenny 985b0af3f6
radicle: implement caching for issues and patches
Implement caching for the `Issue` and `Patch` COB. This is achieved by
having the `Transaction::initial` and `Transaction::commit` methods
take a cache which can update the newly created/updated object. The
`Store::remove` method also takes the cache for removing the object
from the cache, as well as the repository.

This meant that the `*Mut` types for the respective COBs are required
to carry a cache alongside the repository store. Identities will not
be cached, and so this is always set to `NoCache` -- which performs no
caching, and always succeeds.

To perform cache reading for issues and patches, the `cache::Issues`
and `cache::Patches` traits are introduced. They capture the minimal
amount of methods that are needed for the `rad issue` and `rad patch`
CLI commands.

The implementor for each of these traits is there respective `Cache`
types, which combines their backing repository store and the SQLite
database. They both provide convenience methods:
- `create` (and `draft` for patches)
- `get_mut`
- `remove`
which can be used instead of their repository store counterparts.

All uses of the repository stores (where needed) are replaced with
`Cache` types.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 16:03:21 +01:00
Fintan Halpenny b26842d4d8
radicle: add cob::cache module
Add the cob::cache module which describes an SQLite store and schema
for caching COBs. It also provides in-memory and no-cache types for
testing purposes.

The intention is for the store to be used alongside the existing COB
types so that a write-thru cache can be implemented and used for
efficient reads.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny f7ef9cc8b3
radicle: serialization and deserialization improvements
Add derivations of `Serialize` and `Deserialize` for the `Issue` and
`Thread` cob types.

It's necessary to circumvent `Infallible` for the case of the
`Comment` type. This is because `Infallible` does not have these
traits implemented, and there does not seem to be a plan to do so.
Instead, we can use a custom `Infallible` equivalent, which is dubbed
`Never` here.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny 8239a1d0ac
radicle: add cob storage for MockRepository
Ensure that MockRepository can be used where the COB storage traits
are required. Currently, the implementations of the methods themselves
are not required -- they are left as `todo!()`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny a1b41542b8
radicle: rename resolved to is_resolved
The standard in the codebase for boolean methods is to prefix them
with `is_`.

Change `resolved` to `is_resolved`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny 25ff5876ec
radicle: introduce cob::TypedId
The combination of a COB's `TypeName` and `ObjectId` is useful for
parsing a Radicle COB refname, i.e. `refs/cobs/<typename>/<object
id>`.

Introduce `TypedId` for this and provide helper functions for parsing
from the git refname types, as well as being able to tell what kind of
COB it is.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny 8728d02c70
cob: move unwrap_used pragma
Clippy does not recognise this `allow` pragma to be used at the
`unwrap` call site. Instead, if it's moved up to the match case it
will be recognised.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
cloudhead 17744a03fd
cob: Properly authorize root actions
Previously, authorization was only checked for ops after the root op.
We also avoid creating empty actions for `assign` and `label`, which
was needed for non-authorized users to be able to create issues/patches.
2024-02-23 12:31:13 +01:00
cloudhead c63aaaceac
cli: Fix `id` COB notifications in `rad inbox` 2024-02-23 11:35:54 +01:00
cloudhead eff40166c9
cli: Add `rad unseed` command
This replaces the `-d` flag of `rad seed`, making it more like `rad
unfollow`.
2024-02-22 16:02:40 +01:00
cloudhead 6b4f055c36
cli: Don't allow missing config file
It's best to just error if the user is missing the config file, since we
create it on profile init. This also gets rid of the privacy leak.
2024-02-22 16:02:40 +01:00
cloudhead 0d18a8fd9e
cli: Better error message in `rad id` 2024-02-22 16:02:40 +01:00
cloudhead e06dd208f4
cli: `rad seed` output improvement
Better colors, and re-order fields to have policy before scope.
2024-02-22 16:02:38 +01:00
Michael Raitza 0908c65f50 httpd: Filter-out private-but-pinned repos
They should only be visible to localhost.
2024-02-16 15:27:08 +01:00