Commit Graph

3014 Commits

Author SHA1 Message Date
Adrian Duke bfb54bf4be e2e: Fix flakiness in `test_connection_crossing` test
Addresses intermittent failures in the `test_connection_crossing` e2e test,
which were particularly prevalent on slower CI environments (such as
`rust:trixie`).

Previously, the test spawned two threads to make Alice and Bob dial each
other concurrently and strictly asserted that the "preferred" peer (the
one with the higher Node ID) would always win the `Outbound` link direction.
However, this assumption is flawed in real-world, OS-level network execution
due to two race conditions:

1. Thread Scheduling: One thread could execute and fully establish a
   connection before the other thread even began processing its dial command.
2. Reactor Event Ordering: A node's reactor might wake up and process an
   incoming TCP connection from its peer *before* it processes the `Connect`
   command sent by the test. When it finally processes the `Connect` command,
   it sees a session already exists and skips dialing entirely.

In both scenarios, a true "simultaneous crossing" never occurs. Instead, a
standard sequential connection happens, meaning the link direction is dictated
by whoever dialed first, not by the "preferred" peer logic. This caused the
strict `left: Outbound, right: Inbound` assertions to panic.

To fix this, two changes were made:
- Introduced a `std::sync::Barrier` to synchronize the two test threads.
  This forces both threads to wait for each other before calling `.connect()`,
  maximizing the probability of a true simultaneous dial.
- Relaxed the final assertions. Because OS-level TCP handshakes and reactor
  polling can never guarantee perfect simultaneity, we no longer assert
  *which* peer gets the `Outbound` link. Instead, we assert the core invariant:
  that exactly one connection is established between the nodes, and that their
  link directions are opposite (`s1.link != s2.link`).
2026-04-23 08:39:03 +01:00
Lorenz Leutgeb bbb1279604 cli/config: Obsolete `{get,set,push,remove,unset}` 2026-04-22 15:45:57 +01:00
Lorenz Leutgeb f83eb57719 ci: Update GitHub action `actions/cache`
Version 4 uses Node.js 22, which GitHub warns about and suggests to
update.

Changelog is at <https://github.com/actions/cache#v5>.
2026-04-22 15:31:31 +01:00
Lorenz Leutgeb 224c03daf1 node: Expand `target_os` condition for keep-alive
`KeepAlive::with_retries` is not just unavailable on Windows, but on a
bunch of other operating systems. Copy the condition over from
`socket2`.
2026-04-22 12:06:12 +01:00
Lorenz Leutgeb 4a81673d0e node: Fix conditions for socket activation
The implementation of socket activation requires not only the `systemd`
feature, but also `socket2`.
2026-04-22 12:03:05 +01:00
Richard Levitte 354805aeb3 cli/test: Fix failures related to remote HEAD
Two tests assumed that `refs/remotes/rad/HEAD` would automatically be
crated.  It turns out, however, that this only the case if executed
with Git 2.48.0 or newer. Git versions older than 2.48.0 do not touch
'refs/remotes/<remote>/HEAD'.

Git 2.48.0 and newer will update `refs/remotes/<remote>/HEAD` by
default. This can be disabled by setting
`remote.<remote>.followRemoteHEAD` to "never". Thus, with these
versions, setting that configuration to "never" emulates the behaviour
of older versions.

Therefore, to ensure that test results are consistent across Git
versions before and after 2.48.0, the fixture of test repositories
now include setting 'remote.rad.followRemoteHEAD = never'.

The affected tests are adjusted accordingly.

This change can possibly be reverted once Radicle requires usage of Git
2.48.0 or newer.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2026-04-21 23:15:34 +02:00
Lorenz Leutgeb 6ce2d00be2 flake: Set `RUST_BACKTRACE` in development shell 2026-04-20 09:24:12 +01:00
Lorenz Leutgeb 2d20e249fd cli/init: Deduplicate `ScopeParser` 2026-04-20 09:21:00 +01:00
Richard Levitte f8ec40a33f just: Make it possible to give your own cargo command
Do it by setting the environment variable 'CARGO_CMD' when running
'just', or by overriding the justfile variable 'cargo_cmd', like so:

    CARGO_CMD='cargo --locked' just ...

or:

    just cargo_cmd='cargo --locked' ...
2026-04-20 09:11:07 +01:00
Lorenz Leutgeb 4f647b2a10 Spell "Radicle" with a captial R
In documentation and output, spell the name of the project with a
captial "R".
2026-04-17 17:15:31 +01:00
Lorenz Leutgeb bb97414a2d cli: Deduplicate RID Argument Handling
Multiple commands take an RID as a command line argument. However, the
handling, which usually involves falling back to detection of the
repository associated with the current directory, is duplicated many
times over.

Introduce `fn rid_or_cwd` which can be used by many commands.
2026-04-17 17:09:15 +01:00
Lorenz Leutgeb f2e96c96ce cli: Rename all `RepoId` args to `repo`
Many commands take RIDs as arguments. Most of them call the
corresponding struct member `repo`, some call it `rid`.

For consistency, name these members `repo` for all commands.

This change is intended to be invisible to the user. That is why,
in some cases, the "long" version of the argument must be renamed to
match `--rid`.
2026-04-17 17:09:15 +01:00
Fintan Halpenny 07c624499c just: Check for Git and Jujutsu-VCS conflict markers 2026-04-17 14:36:58 +01:00
Fintan Halpenny f00a1624df codespell: Add .direnv to skip list 2026-04-17 14:36:58 +01:00
Fintan Halpenny 8a38fa8c73 typos: Rule for ... -> …
Extend the typos rules to include `"..." = "…"`.
2026-04-17 14:36:58 +01:00
Fintan Halpenny fe353ea7e9 codespell: Rule for ... -> …
Creates a new .codespell-dictionary.txt to extend the default set of rules.

The first rule is `...|…`.
2026-04-17 14:36:58 +01:00
Adrian Duke 179a080867 just: Introduce commit-msg hook for typos
Add a `commit-msg` hook to continuously run `typos` against the COMMIT_MSG.
2026-04-17 14:36:58 +01:00
Adrian Duke f6bf13422d just: Fix doublestar expansion in check-scripts 2026-04-17 14:36:58 +01:00
Adrian Duke 083c9d1abc just: Replace inline scripts with script file calls 2026-04-17 14:36:58 +01:00
Adrian Duke 421a43376d just: Drop underline from output styline 2026-04-17 14:36:58 +01:00
Adrian Duke 6744384acf just: Extract inline bash scripts out to files
Enables `shellcheck` checking.
2026-04-17 14:36:58 +01:00
Lorenz Leutgeb df31702b8b flake: Add `just` to development shell 2026-04-17 14:36:58 +01:00
Lorenz Leutgeb fc12414778 just: Rename `HOOK_NAME` to just `HOOK` 2026-04-17 14:36:58 +01:00
Fintan Halpenny 112c901de8 flake: Add codespell
Nix users may not have `codespell` installed globally.
Introduce it in the `devShell` so they have it locally in `heartwood`.
2026-04-17 14:36:58 +01:00
Fintan Halpenny 69ccabacdd just: Use bash to perform install-hook confirmation
The `[confirm()]` tag had issues on linux with string interpolation,
switches to using a bash based read for confirmation.
2026-04-17 14:36:58 +01:00
Adrian Duke 1f4de60bac just: Add minimum version to CONTRIBUTING and HACKING 2026-04-17 14:36:58 +01:00
Fintan Halpenny 11e80d3094 just: Check for file before removing in install-hooks
The `rm` command would fail if the hook did not exist.
First check for existence and then remove.
2026-04-17 14:36:58 +01:00
Fintan Halpenny a74befd2a7 just: Expand shellcheck glob to all shell scripts 2026-04-17 14:36:58 +01:00
Fintan Halpenny 983e5e19d9 just: Use full argument names for codespell 2026-04-17 14:36:58 +01:00
Adrian Duke 3e9df1c8e4 just: Remove existing hooks during install-hooks 2026-04-17 14:36:58 +01:00
Adrian Duke ffe5b9ed08 just: Better doc comment for check-keywords 2026-04-17 14:36:58 +01:00
Adrian Duke b0af317eaa hacking: Update docs with 'just' commands 2026-04-17 14:36:58 +01:00
Adrian Duke 6e2b710358 contributing: Update docs with 'just' commands 2026-04-17 14:36:58 +01:00
Adrian Duke 1df1acabfa git-hook-template: minor output formatting 2026-04-17 14:36:58 +01:00
Adrian Duke 4e0f739c29 just: Add post-checkout hook 2026-04-17 14:36:58 +01:00
Adrian Duke 09cd3eeb82 just: Add check-hooks to confirm presence and integrity 2026-04-17 14:36:58 +01:00
Adrian Duke eb8467cb6f just: Introduce output formatting 2026-04-17 14:36:58 +01:00
Adrian Duke bdb2a1fc7f just: Introduce pre-commit and pre-push installer
Copies the template script into the git hooks DIR to prevent a potential
attacker overwriting its contents. Also introduces a check before
running the hook against sensitive files from `master`, if there are
changes between the branch and `master`, asks user to confirm
continuation of hook execution.
2026-04-17 14:36:58 +01:00
Adrian Duke 576bc6d6af just: Add groupings and parallel where possible 2026-04-17 14:36:58 +01:00
Adrian Duke 3082f9976d just: Add pre-commit hook 2026-04-17 14:36:58 +01:00
Adrian Duke 9310b1eff2 just: Add more pre-push tasks
Migrating further pre-push checks from `flake.nix`
2026-04-17 14:36:57 +01:00
Adrian Duke 9210f0871a just: Introduce justfile with pre-push hook cmds
As part of migrating from `flake.nix` to a more universal task runner
that can manage git hooks too.
2026-04-17 14:36:58 +01:00
Adrian Duke 430868ffb1 codespell: Add 'ser' to `ignore-words-list`
codespell is misidentifying `::serde::ser` as `::serde::set`.
2026-04-16 21:01:52 +02:00
Adrian Duke 9c6bcd2778 cli: Fix typo "writeable" → "writable"
Detected by `typos`.
2026-04-16 21:01:11 +02:00
Lorenz Leutgeb ac3eba09a1 I2P Support
Co-authored-by: ps
2026-04-15 12:01:50 +01:00
Lorenz Leutgeb 9b9b5ca996 cargo: Update `cyphernet` from 0.5.2 to 0.5.3
The main change that needs adjustment on our side is that
`impl EcPk for ec25519::PublicKey` changed from `Compressed = [u8; 32]`
to `Compressed = amplify::Bytes32`.

Also remove `impl Deref for PublicKey` to avoid dependents of
`radicle-crypto` depend on a particular implementation, and make the
anonymous member private.

See
<f42396139a>.
2026-04-15 11:59:15 +01:00
Lorenz Leutgeb 91b2fd8986
clippy: Deny `unwrap_used`
In the places where `unwrap_used` is currently at `warn`, change it to
be `deny` (stricter).
2026-04-15 10:06:05 +02:00
Lorenz Leutgeb 4d57ba496d
rust: Disallow lint `dead_code` 2026-04-15 10:06:05 +02:00
Lorenz Leutgeb c23a257f3c
clippy: Configure lint `unwrap_used`
By setting `allow-unwrap-in-tests`, we can avoid repeating
`allow(clippy::unwrap_used)` many times over.
2026-04-15 10:06:05 +02:00
Lorenz Leutgeb dbec748c47
clippy: Disallow unused lints
The following clippy lints were allowed in the past but are not
required anymore:
 - box_default
 - large_enum_variant
 - let_unit_value
 - or_fun_call
2026-04-15 10:06:05 +02:00