Commit Graph

3080 Commits

Author SHA1 Message Date
Fintan Halpenny 0d7bc8d1db build: Update apline version to 3.22
There is no Rust 1.95.0 docker image under alpine 3.20.
The latest version is 3.22, so the Dockerfile is updated to use this
version.
2026-05-11 12:36:48 +01:00
Lorenz Leutgeb 420af3b710 workspace/rust: 1.90 → 1.95
The update to `flake.lock` is a simple

    nix flake update rust-overlay

to be able to reach 1.95.
2026-05-11 12:09:04 +01:00
Lorenz Leutgeb 9ea040ccd0 rust/msrv: 1.85.0 → 1.88.0
`cargo check` fails because `human-panic` and `sysinfo` require at least
1.88.0.

    +++ command cargo check --release --locked --all-targets
    error: rustc 1.85.0 is not supported by the following packages:
      human-panic@2.0.6 requires rustc 1.88
      sysinfo@0.37.2 requires rustc 1.88

Bump MSRV to fix this.

1.88.0 introduced [let chains], which in turn has `clippy` warn about
nested if statements. All of these sites are fixed in this change.

1.87.0 introduced [`is_multiple_of`], which is a more readable version
of `x % y == 0`.

[let chains]: https://blog.rust-lang.org/2025/06/26/Rust-1.88.0/#let-chains
[`is_multiple_of`]: https://doc.rust-lang.org/std/primitive.usize.html#method.is_multiple_of
2026-05-11 11:23:18 +01:00
Lorenz Leutgeb 0a0e70b1d1
node/systemd: Fix reading credentials
In `cb57e6560fe7767e79b87473a11261fbb82ce84c` the loading of systemd
credentials was refactored. The idea was to only change the accepted IDs
slightly after switching from radicle.xyz to radicle.dev. Unfortunately,
this was done in a sloppy way. The two cases for passphrase and secret
actually differ in ways that was overlooked.

Rectify these mistakes and restore the old behavior:
 1. The logic to read the passphrase from the file that contains the
    credential is moved out of `load_credential` since it only applies
    to the passphrase, not the secret.
 2. The warnings printed are now generic, and will not mention the
    passphrase in case reading the path for the secret fails.
2026-05-07 22:53:57 +02:00
Daniel Norman 6b460c4429 logger: Respect config file log level
- Fixes a bug where the log level set in the config file was
  ignored: `Logger` and `StderrLogger` captured the level in a
  `self.level` field at construction time and checked it in
  `Log::enabled`. After config was loaded, the global
  `log::set_max_level` was updated but `self.level` was not,
  so verbose messages were dropped by the per-instance filter
  even when the global filter allowed them.
- Make `log::set_max_level` the single source of truth: remove
  the `level` field and have `Log::enabled` defer to
  `log::max_level()` so the two filters can no longer drift.
- Update call sites to construct loggers without a level.
- Disable the structured logger's internal filter (set to "trace") so
  that it also falls back to `log::set_max_level`.
2026-05-07 16:23:28 +01:00
Lorenz Leutgeb 9177146794 radicle/web: Fix schema of `Config::description`
The JSON Schema for the field `radicle::web::Config::description` is specified
to be a URI, which is wrong.

Remove the additional attribute.
2026-05-07 15:23:31 +01:00
Lorenz Leutgeb ee9a9de36d radicle/web: Relax deserialization of `Config`
Allow omission of `pinned` and its members.
2026-05-07 15:23:31 +01:00
Fintan Halpenny 53db994146 schemars: Release 0.8.0 2026-05-06 21:15:54 +01:00
Fintan Halpenny ad068309c9 fetch: Release 0.20.0 2026-05-06 21:15:54 +01:00
Fintan Halpenny ab3621d5d4 remote-helper: Release 0.17.0 2026-05-06 21:15:54 +01:00
Fintan Halpenny f5c39dd603 cob: Release 0.20.0 2026-05-06 21:15:54 +01:00
Fintan Halpenny baf533b37b cli: Release 0.21.0 2026-05-06 21:15:54 +01:00
Fintan Halpenny 342b4d963a node: Release 0.20.0 2026-05-06 21:00:14 +01:00
Fintan Halpenny 622f3827b5 protocol: Release 0.8.0 2026-05-06 21:00:14 +01:00
Fintan Halpenny 2707f6b4b1 radicle: Release 0.24.0 2026-05-06 21:00:14 +01:00
Fintan Halpenny 3486c028ea term: Release 0.18.0 2026-05-06 21:00:14 +01:00
Fintan Halpenny 5991bdfa9a systemd: Release 0.13.0 2026-05-06 21:00:14 +01:00
Fintan Halpenny 2871417808 oid: Release 0.2.0 2026-05-06 21:00:14 +01:00
Fintan Halpenny 4ca2098cb7 core: Release 0.3.0 2026-05-06 21:00:14 +01:00
Fintan Halpenny 64a419d79c crypto: Release 0.17.0 2026-05-06 21:00:14 +01:00
Lorenz Leutgeb 3f81e83d36 radicle/crefs: Support Symbolic References
Canonical references can not be used to model symbolic references.

Relax this restriction by adding another member to the payload, named
"symbolic". Its key-value/name-target pairs then translate directly to
canonical symbolic references.

Care is taken to not allow circular references, and that there always
is a rule that could generate the target of a symbolic reference
(or a chain of symbolic references). Still, a symbolic reference may
dangle (for example when its target reference cannot be computed
because of divergence), but at least it can be prevented that a
symref *always* dangles, because there is no rule that would produce
its target.

Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2026-05-06 20:51:04 +02:00
Adrian Duke 080790d84e radicle/git/canonical: Add explicit test case for fast_glob pattern match syntax 2026-05-05 14:41:52 +01:00
Adrian Duke 80d30d3b59 e2e: Fix false-positive in canonical ref update test
Previously `test_fetch_emits_canonical_ref_update` was passing by
catching a leftover `CanonicalRefUpdated` event from the initial
repository fetch. Furthermore, the new commit was written to the
un-namespaced root. It can be proven to be the case by commenting out
the `alice.commit_to(...)` line and watching the test still pass.

Fix the test by committing to the namespaced default branch which will
trigger the `CanonicalRefUpdated` that is expected by Bob. Drains events
so we don't catch the wrong event, and explicitly announces.
2026-05-05 14:41:52 +01:00
Adrian Duke ed340f5724 e2e: Add partial glob match cref test 2026-05-05 14:41:52 +01:00
Fintan Halpenny e87af868db node/test: `NodeHandle::commit_to` should namespace
The `commit_to` method should namespace the reference, so that node is
only ever committing the namespace of that particular node.

This prevents the node from committing to another node's namespace or
the canonical namespace.
2026-05-05 14:41:52 +01:00
Adrian Duke 8724ebe780 radicle/git/canonical: Introduce property tests for glob matching behaviour 2026-05-05 14:41:52 +01:00
Adrian Duke fb40bdc0ac radicle/git/canonical: Fix glob rewrite rule for trailing asterisk
Previously a rule like `refs/heads/releases-*` would be rewritten
incorrectly to `refs/heads/releases-**/*` matching the 'trailing
asterisk' rule.

Simplify the rewrite rule so that a trailing `*` becomes a prefix
matching rule. Add tests.
2026-05-05 14:08:33 +01:00
Fintan Halpenny 455138f4a7 radicle/canonical/rules: Reorganise test suite
Reorganises the rules test suite into a `test` module and a `helper`
sub-module.

The former holds the original tests, removing the `test_` prefix.
The latter holds helper functions for test setup.
2026-05-05 09:53:58 +01:00
Daniel Norman 998f527bd4 node/db: delete unparseable ipv6 rows
- Drop `type='ipv6'` rows whose bracket-stripped inner part contains
  no `:`, since every valid IPv6 textual form has at least one
- Cover the offender (`[]:8776`), bracketed garbage (`[abc]:8776`),
  the unspecified (`::`), loopback, and full forms in tests
- Keep `dns` and `ipv4` rows untouched

Migration 8 retyped any `[..]:N` dns row to ipv6 by bracket pattern
alone, without checking the inner part is parseable
2026-05-01 17:42:44 +02:00
Daniel Norman a45a1078ab node: Skip unreadable address rows in `entries()`
- Decode each row independently so one corrupt entry no longer aborts
  the whole address-book iterator
- Log a warn with the raw `value` and continue past parse failures
- Add a regression test that mimics the post-migration-8 state where a
  legacy `[]:8776` row lands as `type='ipv6'`

A pre-`df8e4e6c` parser admitted `[]:8776` as `HostName::Dns("[]")`.
Migration 8 retyped any `[..]:N` dns row to `ipv6` without validating
the inner part, so on read `Address::from_str` rejects the row with
"invalid IPv6 address syntax", which bubbled up and caused
`available_peers()` to silently return empty, breaking peer discovery
for the affected node.
2026-05-01 17:42:44 +02:00
Josh Soref 5dae2a8b58 treewide: Spelling
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2026-04-30 15:50:29 -04:00
Josh Soref a101705012 term: Rename `Row::Divid{i,}er`
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2026-04-30 15:49:57 -04:00
Josh Soref 08dd1dfda7 node/test: Fix Spelling
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2026-04-30 15:49:56 -04:00
Josh Soref 8391599f61 oid: Fix spelling
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2026-04-30 15:48:33 -04:00
Fintan Halpenny b482845e71 sigrefs/git/properties: Restore property tests
These tests fell under the radar when refactoring.
Restore them to the latest code so that these properties are tested.
2026-04-29 14:04:54 +02:00
Fintan Halpenny 92347a307f justfile: Add Rust tests to pre-push
The tests should be part of the pre-push step.
Introduce `test-rust`, as part of a new `test` group, and `pre-push` group.
2026-04-29 13:54:31 +02:00
Fintan Halpenny b4707e5502 cli: Amend jj tests
Update the output of `rad_jj_colocated_patch` so that it passes with the current version of `jj` being used:
```
jj --version
jj 0.35.0
```

Mark `rad_jj_bare` as `ignore` since it currently cannot determine the
RID from the `rad` remote.
2026-04-29 13:51:11 +02:00
Lorenz Leutgeb 378365aa42 term: Deny `print_stdout`
To prevent regressions, `#![deny(clippy::print_stdout)]` is added to
`radicle-term`, similar to `radicle-cli`.
2026-04-29 10:57:24 +02:00
Lorenz Leutgeb cc70d7dad4 radicle/cob: Do not return `BrokenPipe` from external COB invocation
A handle for standard input can always be expected here.
2026-04-29 10:57:24 +02:00
Lorenz Leutgeb 553a3ebd0a cli/cob: Remove check of `BrokenPipe`
The swallowing of `BrokenPipe` is processed further down the stack,
so this case is no longer needed.
2026-04-29 10:57:24 +02:00
Fintan Halpenny 56625a42f7 term: Rename print_inline to print
The name `print_inline` was used because, previously, the `print`
function name was taken.

This has now changed, allowing the rename of this function to happen.
2026-04-29 10:57:24 +02:00
Fintan Halpenny 2262b8d9bd term: Rename print to println
The name `print` was used because, previously, the `println`
function name was taken.

This has now changed, allowing the rename of this function to happen.
2026-04-29 10:57:24 +02:00
Fintan Halpenny e7d519cf65 term: Rename println to println_prefixed
This function was mistakenly called `println`, despite it also wanting
a prefix.

Rename the function so that it better reflects its behaviour.
2026-04-29 10:57:24 +02:00
Fintan Halpenny 1a31a9f541 cli: Handle broken pipe (SIGPIPE) gracefully
Prevent `rad` from panicking when its stdout is a closed pipe, e.g.
when running `rad config | head`.

The broken pipes are handled at the output boundaries using three
layers of defence:

1. Inner: Route all stdout output through `term::print()` and
   `term::print_inline()`, which use explicit `writeln!`/`write!` to
   a locked stdout and silently ignore write errors. All `println!`
   calls in `radicle-cli` and `radicle-term` are converted.
2. Middle: Catch `BrokenPipe` errors that propagate up via `anyhow`
   from subcommands in `main::run()`, and exit cleanly with code 0.
3. Outer: Install a panic hook that intercepts `println!` panics
   containing "Broken pipe" (from dependencies like clap) and exits
   cleanly, chained in front of human_panic's hook.

To prevent regressions, `#![deny(clippy::print_stdout)]` is added to
`radicle-cli`, requiring all future stdout output to go through the
safe `term::` functions.

Note: `eprintln!` calls (stderr) are not handled, as broken stderr
pipes are extremely rare in practice.
2026-04-29 10:57:24 +02:00
Fintan Halpenny e1f16bee26 term: Catch EPIPE and swallow
Rust (since 1.62) ignores EPIPE by default (see [Rust #62569]),
causing writes to closed pipes to return `io::ErrorKind::BrokenPipe`
errors.  The `println!` macro panics on these errors, producing a
confusing backtrace instead of the silent exit expected of Unix CLI
tools.

To avoid the use of `print!` and `println!`, the `radicle-term`
helper functions use `write!` and `writeln!`. This lays the groundwork
for the `rad` CLI to transition to using only `radicle-term`
functions.

There was a first attempt made, which is documented here.  A
process-wide SIGPIPE reset (`SIG_DFL`) was ruled out because `rad`
manages child processes via libgit2 pipes and communicates with the
radicle node over Unix sockets. Resetting SIGPIPE globally caused
`rad` itself to be killed during internal pipe operations (e.g. during
`rad remote add --fetch`), producing flaky test failures.

[Rust #62569] https://github.com/rust-lang/rust/issues/62569
2026-04-29 10:57:24 +02:00
Fintan Halpenny 8f4b90db7b cli/test: Add broken pipe (SIGPIPE) tests
Add tests that verify the `rad` binary does not panic when its stdout
is a broken pipe (e.g., `rad config | head -1`).

Rust (since 1.62) ignores SIGPIPE by default (see [Rust #62569]),
causing `println!` to panic with "failed printing to stdout: Broken
pipe" instead of exiting silently. This is the standard Unix behaviour
expected of CLI tools.

These tests currently fail on `rad config` and `rad self`, and are set to `ignore`, to be enabled when fixed.

[Rust #62569]: https://github.com/rust-lang/rust/issues/62569
2026-04-29 10:57:24 +02:00
Lorenz Leutgeb 7b07e57b9c treewide/test: Use `impl Arbitrary for Oid`
Many usages of `Oid::from_sha1` are actually in the context of
generating arbitrary `Oid`s. In these cases, `impl Arbitrary for Oid`
may be used directly.
2026-04-28 14:35:38 +02:00
Lorenz Leutgeb 88a7252e33 oid: Fix `impl Arbitrary for Oid`
`fill` would cause the OID to consist of 20 repetitions of the same
byte every time, not an arbitrary OID.
2026-04-28 14:35:38 +02:00
Lorenz Leutgeb deabe6d2ce oid: Nicer panic message
The panic message that `unimplemented!` generates is more appropriate.
2026-04-28 14:35:38 +02:00
Lorenz Leutgeb 60f42bff53 protocol: Minimize scope of `radicle::git::raw`
A tiny refactoring to make it less inviting to use
`radicle::git::raw`.
2026-04-28 14:35:38 +02:00