Commit Graph

3017 Commits

Author SHA1 Message Date
Defelo 52e5581228 cli: Don't override existing seeding scope in `rad seed` 2026-03-17 10:31:29 +00:00
Defelo 281f92e9ff cli/tests: Add test for `rad clone --scope` 2026-03-17 10:31:29 +00:00
justarandomgeek eea3617781 use `CONIN$` instead of `/dev/tty` on windows 2026-03-17 10:27:30 +00:00
Fintan Halpenny a1fd9e04fe radicle: Update `sqlite` to 0.37
The `concat` function is not present in version 0.32 of `sqlite`, since
it was introduced in 3.44[^0].
Update the `sqlite` to version 0.37, which brings in 3.45[^1], via
`sqlite3_sys`.

[^0]: https://sqlite.org/forum/forumpost/c14028be1b9c0e20de9e39d70706adc9f5a36bb5ccaad6db22f7d99633eafff8
[^1]: https://docs.rs/sqlite3-sys/0.18.0/sqlite3_sys/constant.SQLITE_VERSION.html
2026-03-17 10:19:40 +01:00
Lorenz Leutgeb 0736977170
node: Migrate IPv6 addresses in database
The format for IPv6 addresses was changed in
df8e4e6c88 to require '[' and ']'.

IPv6 addresses that were stored in the database in the past must be
migrated.
2026-03-16 23:12:58 +01:00
Fintan Halpenny 9e8f09a144 Remove stray files
These files were accidentally committed.
They were used for ensuring a refactor was performed correctly, and
are no longer needed.
2026-03-16 13:49:05 +00:00
Fintan Halpenny 0c47d06f2d radicle/storage/refs: Strengthen Encapsulation
`radicle::storage::Refs` carries a map from reference names to OIDs, and
there are some invariants.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb f4495e92bc
radicle/device: `impl Keypair for BoxedSigner`
Most consumers of `Device` are interested in the public key of the
device, and `Keypair` is the trait from `signature` which captures
this, so implement it.

Further, for boxing a signer, introduce a new trait `BoxableSigner`
(to remain dyn-compatible) which additionally requires `Keypair`.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb 74fa4425a1
crypto: Require `Signer: signature::Signer`
All implementations of `radicle_crypto::Signer` are also
`signature::Signer`. Also, the implementations of `Signer::sign` and
`Signer::try_sign` call each other.

To simplify, make `signature::Signer` a requirement for
`radicle_crypto::Signer`.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb 06fae85e67
crypto: `impl Signer` based on `Keypair`
Since all signers implement `signature::Keypair`, we can simplify the
implementations of `signature::Signer<ExtendedSignature>`. A blanket
implementation is not possible, because we do not control
`signature::Signer`.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb f2ad54542e
crypto: `impl signature::KeypairRef` for Signers
The various signers defined in `radicle-crypto` all allow borrowing
the corresponding public key a.k.a. "verifying key". This is captured
by implementing `signature::KeypairRef`, so implement it in addition
to `signature::Signer`.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 768ecf56ba crypto: Add `impl Verifier for PublicKey`
Add `impl Verifier<Signature> for PublicKey`, to allow using the popular
trait from the `signature` crate in verification codepaths.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 01c60388db git-metadata: Add parsing of `CommitData`
This change adds parsing of `CommitData` from raw bytes, i.e. `&[u8]`.
The intended use is to allow the `radicle-*` crates to be able to
parse raw commit data from any underlying Git implementation, such
as the `git2` and `gix` crates.

The tests are broken down into `success` cases, `error` cases, and
`unit` tests.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 58624148d4 git-metadata: Add `CommitData::strip_signatures`
To allow for the verification of a commit signature, the signature
needs to be stripped before converting the commit data to bytes.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 60871de89d git-metadata: Add derivable traits
Add more derivable traits to structs in `radicle-git-metadata` types to
make them easier to use.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb 0e45347b92
radicle/storage: Improve `Validation` error
`Validation::MismatchedRef` always happens in the context of a remote,
so have it carry the corresponding `RemoteId`.
2026-03-16 14:30:48 +01:00
Fintan Halpenny ba9c09facb radicle/refs: Better `SignedRefs` Encapsulation
Ensure that the public interface of signed references does not leak its
implementation details.

This allows the evolution of the interface in a safer manner, and does
not leak implementation details to the rest of the crate or any
dependents.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 39a58ded05 node/test: Use `Arbitrary` for `SignedRefs`
Ensure the test code does not rely on `SignedRefs` construction, but
rather the `Arbitrary` construction.
2026-03-16 14:30:48 +01:00
Fintan Halpenny f7ff4d8f4e radicle/arbitrary: Move `impl Arbitrary` of refs
Avoid leaking the types of the signed reference types by moving their
`Arbitrary` implementations to a `refs::arbitrary` sub-module.

Since `SignedRefsAt` require a correctly signed payload, a helper
constructor is added: `signed_refs_at`.
In turn, a function, `arbitrary::with_gen` is introduced so that this
constructor can be easily called with a `Gen` value.
2026-03-16 14:30:48 +01:00
Fintan Halpenny b8502397a5 protocol/wire: Remove SignedRefs encoding/decoding
The implementations for `Encode` and `Decode` for `SignedRefs` existed
for when `SignedRefs` was communicated over the wire. This was traded
for communicating `RefsAt` instead. So, these can safely be removed.
2026-03-16 14:30:36 +01:00
Fintan Halpenny ba8d6b8864 radicle/storage: Remove unused Remote methods
Remove the methods and constructors, that are unused, from
`struct Remote`.
2026-03-13 16:19:10 +01:00
Lorenz Leutgeb e78d477bcf
radicle/git: Remove unused `fn remote_refs` 2026-03-13 16:19:10 +01:00
Fintan Halpenny 759a6fb982 radicle: Compile `rad::fork_remote` only for tests
The `rad::fork_remote` function is only used in tests.
2026-03-13 16:19:10 +01:00
Fintan Halpenny 7bac17146c CHANGELOG: fix typo
The command that changed is `rad node debug`, not `rad debug`.
2026-03-13 14:51:41 +01:00
Fintan Halpenny cb3ca6225f radicle/CHANGELOG: remove variant typo
The `typos` tool has no way of ignoring a particular typo in a particular file.
Reword the changelog entry so that it does not fire the hook.
2026-03-13 14:50:05 +01:00
Fintan Halpenny 9dbbb01dc6 radicle: remove `TryFrom` 2026-03-13 14:47:24 +01:00
Sebastian Martinez 57da779949 radicle: Add a `load` method to `radicle::profile::Home`
radicle: refactor `Home::load`

- Refactor out getting the subdirectories to ensure they are the same
across `new` and `load`
- Return all missing directories in the error message
- Document `load` and make it `pub`
2026-03-13 14:47:24 +01:00
Matthias Beyer ff85c74eaa cli: Add blank line after issue reply header
This patch adds a blank line to seperate the issue reply header from the
issue reply payload.

This makes visually parsing the output easier.

Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2026-03-12 13:30:09 +00:00
Fintan Halpenny 1b986af006 cli/tests: Refactor workflow test 2026-03-11 10:51:57 +00:00
Adrian Duke fa82bd5f76 cli/tests: Refactor watch command tests 2026-03-11 10:51:57 +00:00
Fintan Halpenny 45e6afd010 cli/tests: Refactor utility command tests
Place utility command tests in their own module.
These commands relate to inspection of state, such as: `rad self`,
`rad config`, `rad inspect`, etc.
2026-03-11 10:51:57 +00:00
Fintan Halpenny d282e0d0f8 cli/tests: Refactor sync command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 7d2842a458 cli/tests: Refactor remote command tests 2026-03-11 10:51:57 +00:00
Adrian Duke c1ab7c386e cli/tests: Refactor policy command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 18d7f99e33 cli/tests: Refactor patch command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 4ffabde605 cli/tests: Refactor node command tests 2026-03-11 10:51:57 +00:00
Adrian Duke b2568f0b47 cli/tests: Refactor jj command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 4753b889dc cli/tests: Refactor issue command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 8bf655ef97 cli/tests: Refactor init command tests 2026-03-11 10:51:57 +00:00
Adrian Duke a1c1b03b66 cli/tests: Refactor inbox command tests 2026-03-11 10:51:57 +00:00
Adrian Duke cd4532ecd5 cli/tests: Refactor id command tests 2026-03-11 10:51:57 +00:00
Adrian Duke dac099e4f1 cli/tests: Refactor git command tests 2026-03-11 10:51:57 +00:00
Adrian Duke d39e485c13 cli/tests: Refactor cob command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 1f3dc6aea0 cli/tests: Refactor clone command tests 2026-03-11 10:51:57 +00:00
Fintan Halpenny 7a1e6a2423 cli/tests: Refactor checkout command tests 2026-03-11 10:51:57 +00:00
Lorenz Leutgeb 5aaf978f97 radicle: Configure database connections on open
Configuration of database connections is not performed on `open`, which
leaves room for error (e.g. to miss specifying configuration).

Methods on `Profile` automatically supply the configuration of the
profile.

In testing code, just using the default configuration suffices.
2026-03-09 09:20:42 +00:00
Lorenz Leutgeb f3afe7b02a radicle/config/sqlite: Use `synchronous = NORMAL`
Change the default value for the `synchronous` pragma from `FULL` to
`NORMAL`.

With this change, SQLite will not aggressively `fsync()` after every
transaction, so there is considerably less disk pressure as disk I/O
can be batched.

See <https://sqlite.org/pragma.html>:
> `WAL` mode is safe from corruption with `synchronous=NORMAL`, and
> probably `DELETE` mode is safe too on modern filesystems. `WAL` mode is
> always consistent with `synchronous=NORMAL`, but `WAL` mode does lose
> durability. A transaction committed in `WAL` mode with
> `synchronous=NORMAL` might roll back following a power loss or system
> crash.
> Transactions are durable across application crashes regardless of the
> synchronous setting or journal mode.

Also:
> You lose durability across power lose with synchronous `NORMAL` in `WAL`
> mode, but that is not important for most applications. Transactions
> are still atomic, consistent, and isolated, which are the most
> important characteristics in most use cases.

So, there is no risk of database corruption, and in the extreme
cases of sudden power loss or system crash, some transaction may
roll back.

See also <https://sqlite.org/wal.html>

Co-authored-by: Yorgos Saslis <yorgos.work@proton.me>
2026-03-09 09:20:42 +00:00
Yorgos Saslis f4aee203ab radicle: Make SQLite pragmas configurable
Expose choosing particular SQLite pragmas via configuration.
2026-03-09 09:20:42 +00:00
Yorgos Saslis 6cc3da95e6 radicle/node/db: Model SQLite `synchronous` pragma
The newly introduced enum models the SQLite pragma of the same name.
2026-03-09 09:04:55 +00:00
Yorgos Saslis d36bf41f25 radicle/node/db: Directly represent SQLite pragmas
Instead of introducing our own names and aliases, directly model SQLite
pragmas with the defaults that they also take in SQLite, to avoid
confusion.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2026-03-09 09:04:55 +00:00