Commit Graph

116 Commits

Author SHA1 Message Date
Fintan Halpenny e9cf91e1bc cob: bump major version
The addition of the `Namespace` parameter in the traits requires a
major version bump for `radicle-cob`
2025-06-02 11:31:48 +02:00
Fintan Halpenny f4c8ff7a64 chore: prepare crates release
This prepares the crate versions for a new release. The version bumps were
determined by the `cargo-semver-checks` tool.

However, there were some issues with the `radicle-fetch` crate – where when
attempting to check it, it was unable to compile due to the previous version
expecting the kind of `Doc` with a generic parameter. I believe this is due to
the version for `radicle` being specified as simply `0`. This prompted changing
the version specifications to use `major.minor` for all the internal crates.
This, for example, would mean that `radicle-fetch` that relies on `0.15` can use
`>=0.15.0,<0.16.0` – allowing any patch versions but must require a minor
version bump.
2025-05-30 12:58:18 +02:00
Fintan Halpenny 9988b63bb2 cob: abstract namespace identifier
This change is to help separate the fact the namespacing by a `NodeId` is a
Radicle specific concern. The identifier can, in theory, be any kind of path
component, as long it is valid in Git.

The motivation for the change is to help separate the idea of a device's
`NodeId` vs an agent being an author – for future agent repository work.
2025-05-22 09:09:57 +02:00
Fintan Halpenny 1f4fcc5e6a radicle: move to `signature` crate
The motivation of this change is to move away from tying signing to be
specifically for ed25519. The reason being that the protocol will want move
towards two different kinds of signing – the node signing artifacts, and an
author signing artifacts.

This change captures the former, node signing, by introducing a `Device` type
that is the `NodeId` – a PublicKey underneath the hood – and a signing
mechanism. This allows the replacement of the `Signer` trait being used – which
always assumed a `PublicKey`. Instead, the `Device` is constructed with
`NodeId`.

In `radicle-cob`, a signer is expected to implement
`signature::Signer<ExtendedSignature>`, and everywhere in `radicle`,
`radicle-node`, `radicle-cli`, and `radicle-remote-helper` is expected the
signer is expected to implement `signature::Signer<Signature>`.

A `Device` implements both of these but only requires
`signature::Signer<Signature>` to do so – since an `ExtendedSignature` is
essentially `(PublicKey, Signature)`, and the `NodeId` of the `Device` can be
used.
2025-05-22 09:09:57 +02:00
Lars Wirzenius 105b65c2ac workspace: set rust-version (MSRV)
This declares the minimum supported Rust version, independently of the
`rust-toolchain.toml` file, which specifies the Rust version and
toolchain components the crate/workspace should be built with. The
MSRV affects other crates that depend on anything in this workspace,
but the toolchain file does not seem to affect them. This means the
MSRV is useful for those who build or develop dependents.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-16 13:49:38 +02:00
Fintan Halpenny 61865b5b5a
cob: fix documentation
`no_run` will compile but not run the code. Use `ignore` instead, and also added
`rust` for syntax highlighting.
2024-12-04 12:40:40 +01:00
cloudhead fd892d006f
Update `radicle` to 0.14 2024-11-29 15:25:09 +01:00
cloudhead 70f0cc354d
cob: Fix `serde` instances for `ObjectId`
The type now serializes the same as `Oid`.
2024-11-28 15:19:56 +01:00
Fintan Halpenny 259adf7dc2
cob: mutable stable time for testing
The `radicle-cob` crate provides a feature flag, `stable-commit-ids` to allow
for `Oid`s to remain stable for testing by always using the same author and
timestamp when creating commits.

This can be an issue when it interplays with COB related tests that are relying
on the ordering for the DAG walk. If the `Oid` values change and get re-ordered
then the test will fail. The DAG for COBs are now ordered via the `Oid` and
`Timestamp`.

In this change, a global timestamp is introduced that is initialised
per thread. The value is read, via `read_timestamp`, and can be
advanced using `with_advanced_timestamp` – while performing an action
that creates a new commit.
2024-11-18 16:11:44 +01:00
Fintan Halpenny b4f2614d6c cob: chronological ordering of concurrent values
The underlying `Dag` for a COB will use the `Ord` implementation of
whatever is provided as the key. This means that the lexicographical
ordering of the `Oid` SHA will be used, which in turn means that if
the SHAs change in our tests, then the ordering will be broken for
concurrent updates.

To prevent this from happening, a variant of the `prune` method is
introduced that takes an ordering of the keys and values – this method
being called `prune_by`.

This allows `prune` to be replaced with `prune_by` in the
`ChangeGraph::evaluate` method. The ordering used is first comparing
the `Entry::timestamp` and then the `EntryId` (`Oid`).
2024-10-23 13:02:55 +01:00
cloudhead 855327d303
cob: Change APIs to take URIs for embeds
To facilitate edit actions, take URIs instead of the actual blobs. This
means API callers don't have to load all the blobs just for them to be
re-hashed when an edit action is submitted.

There are some peculiarities when dealing with the `Identity` COB since
the embed is the identity document itself. We handle that special case.
2024-10-14 12:51:36 +02:00
Alexis Sellier 729a6e057e
cobs: Fix COB drafts to work correctly 2024-10-01 15:59:23 +02:00
cloudhead c112f3fbc9
Update `radicle-cob` crate to 0.12.0 2024-08-28 12:55:30 +02:00
Sebastian Martinez cae66b6168
Update `radicle-git-ext` to 0.8.0 2024-08-20 16:35:04 +02:00
Sebastian Martinez f71da0ee95
Update `git2` to 0.19.0 2024-08-20 16:35:04 +02:00
cloudhead c6a8a00055
Update `rust-toolchain` to 1.80
Fix new clippy warnings.
2024-08-06 14:37:21 +02:00
Alexis Sellier 34112d8504
cli: Don't create empty code review
If the verdict and comment are both unset, return an error.
2024-07-07 16:57:50 +02:00
cloudhead ab532be033
Bump crate versions
We bump the versions of the crates required to publish a new version of
`radicle-httpd` in preparation of moving it out of the repo.
2024-06-05 16:51:55 +02:00
cloudhead fe5757d122
Tidy up environment variables
* Try to use constants instead of strings
* Move crypto seed override out of radicle-crypto
* Use GIT_COMMITTER_DATE for commit overrides
* Use RAD_LOCAL_TIME as general time override
* Allow variables to be used in release mode
2024-04-26 10:38:54 +02:00
cloudhead 9cdf0aa1fd
Update radicle crates to 0.9.0 2024-03-26 11:56:27 +01:00
cloudhead 5b5a6842c1
Update toolchain to Rust 1.77 2024-03-26 10:03:11 +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 92d6fd4c7e
cob: Re-introduce some of the ignored tests
This reverts commit d8f8d29605.
2024-01-22 21:20:01 +01:00
cloudhead eee304e0b7
cob: Expose operation concurrency
When evaluating a COB, expose to the `apply` function the operations
concurrent to the current one being applied. These are essentially
"related" nodes in the graph, that are neither ancestors or descendants.

This will let us for example have different failure modes depending on
whether there were conflicting operations, as well as expose conflicts
to the user.
2024-01-22 21:20:01 +01:00
cloudhead a46bcb2247
cob: Distinguish between commit parents
Previously, COB change commits would not distinguish between their
parents. This means that they would try to load source code commits
(eg. for patch COBs) and then fail since those commits wouldn't have a
manifest or `Rad-Resource`.

We introduce a backwards compatible change here which is that parent
oids that are not COB commits are accompanied by a commit trailer called
`Rad-Related`. This is for all related content that should be pulled in
but is not part of the change graph proper.

When building the change graph, we simply ignore commits that are marked
as "related".
2024-01-22 21:20:01 +01:00
cloudhead ebdaf0edd9
General dependency update
Left out some of the `gix-*` dependencies to be done separately after
review.
2024-01-18 13:30:26 +01:00
cloudhead 44fc11dff8
cob: Don't panic on missing root
This can happen if the change was not able to be loaded due to open file
limit issues for example.
2024-01-17 17:34:30 +01:00
Fintan Halpenny 924a2624a4
git: update git2-0.18.1
Update to git2-0.18.1, which also requires updating radicle-git-ext
and radicle-surf.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-04 11:11:36 +00:00
cloudhead fdf693c497
Various improvements to log statements
Some logs were missing the `target`, while others were not correctly
formatted.
2023-11-15 11:50:42 +01:00
cloudhead 135725d6f6
dag: Fix topological order
We were using a breadth-first search which doesn't work as-is for
topological ordering in all cases. Instead of using Kahn's algorithm
which is a little complex, we switch to a depth-first search.
2023-11-03 14:17:57 +01:00
cloudhead d8f8d29605
radicle: Fix timestamp issue with feature flag
The `stable-commit-ids` feature flag was being included in non-dev,
non-test builds because of how cargo works (or doesn't work).

For now, we ignore the tests that this affects, and they can be run with
the `RAD_COMMIT_TIME=1514817556` environment.
2023-11-01 17:24:47 +01:00
cloudhead 1d167581f2
cob: Introduce `xyz.radicle.id` COB
Introduces a new COB type to store repository identity documents.

The reason for this change is to:

1. Simplify the code, as the identity document logic resembled a COB,
   yet it had custom logic. This allows existing COB code to be used for
   identities.
2. Make identity document update logic more flexible, since COB actions
   can be added in the future.
3. Re-purpose existing tools around COBs to work on identities, eg. `rad
   cob`.
4. Unify the concept of an identity change proposal, with regular identity
   changes. This means we can remove the `id.proposal` COB in favor of
   using the `id` COB itself.

Notes
-----

* Each repository has one Identity COB.
* The `Proposal` COB has been repurposed into the `Identity` COB.
* Identity documents are stored as *embeds* inside the Identity COB
  actions.
* The action that contains new document versions is called `revision`,
  just like the Patches COB.
* The namespaced `rad/id` ref is a symbolic reference to that Identity
  COB.
* The canonical `rad/id` ref is a direct reference to the commit in the
  Identity COB that contains the latest *accepted* revision of the
  document.
* All commands for managing identities have been folded into `rad id`.
  Hence `rad delegate` and `rad edit` are removed.
* The concept of "rebasing" an identity document is gone.
* The `rad id` output has been updated to match the style of other
  commands.
* When a revision has enough signatures, it is automatically adopted as
  the current identity, there is no longer the need for a "commit"
  action.
* When an identity revision is proposed, and the current identity has a
  threshold of `1`, that identity is automatically accepted due to the
  above point.
* The idea of "verifying a peer's identity branch" no longer applies, as
  COBs cannot be verified one history at a time.
* Since the root commit of the Identity COB does not have a "Resource"
  to point to (it would have to point to itself, which is impossible),
  we've made the resource id optional for COBs.
2023-10-12 17:32:33 +02:00
cloudhead 5709f5d886
cob: Improve stability of test setup
We employ various tricks to ensure that tests are reproducible.
In this case, having stable commit ids allows us to test specific
traversal orders of a COB history in cases of concurrent updates.
2023-10-11 14:53:59 +02:00
cloudhead 69fe1d5989
cob: Remove mentions of automerge 2023-10-11 14:53:59 +02:00
Sebastian Martinez 9df1922f15
httpd: Add routes for handling embeds in issues
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-19 10:00:01 +02:00
cloudhead 457b82f723
cob: Evaluate COB state eagerly
Instead of returning histories from `radicle-cob`, we return an
evaluated object which we build during initial graph traversal.

We do this so that branches can be correctly pruned when operations are
invalid at the application level. This way, new operations are not
building on top of invalid ones contained in the history.

To achieve this, we introduce a new `Evaluate` trait that is implemented
by all COBs, and we make change graph evaluation fallible.

Doing this means that we get `apply` errors returned for free when an
invalid transaction is applied, and no longer need to check for action
validity in multiple places.

We also implement a new `Dag::prune` method to avoid having to copy
graph nodes during traversal.
2023-09-11 23:25:28 +02:00
cloudhead 6695074479
cob: Don't require full `Entry` for update
Instead of taking the full entry type, we only need the id.
2023-09-10 20:44:38 +02:00
cloudhead c903a958e7
cob: Implement action authorization
Add `authorization` functions to `Patch` and `Issue` COBs.

Co-authored-by: Arastoo Bozorgi <ab1502@mun.ca>
2023-09-09 18:31:52 +02:00
cloudhead f760b1153f
dag: Accept multiple roots in `fold`, remove depth
This allows the fold to start anywhere in our DAG.
2023-09-07 11:48:21 +02:00
cloudhead 5c256c8bfb
cob: Remove support for legacy issues 2023-09-07 11:48:18 +02:00
Fintan Halpenny bf8cee2446
cob: Remove EntryId and RevisionId conversions
Clippy warns that EntryId::from and RevisionId::from are not
required.

Remove the unecessary calls in radicle-cob and radicle.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-09-06 20:07:36 +02:00
cloudhead 205c15caa6
cob: Simplify `Entry` and `Change` types
Instead of having two types, we simply have one, called `Entry`, which
we rename from `Change`.

There was no real benefit to having two almost identical types, but lots
of added complexity. This patch simplifies the crate by removing one of
the types.
2023-08-24 12:57:30 +02:00
cloudhead 8cb8398be9
Introduce `cargo-deny`
Add `deny.toml` with a few exceptions, and update certain dependencies
to get rid of duplicates.

Running `cargo deny check` will yield some warnings still, but no
errors.
2023-08-22 14:33:00 +02:00
cloudhead 534503d002
cob: Add support for media embeds in COBs
This change allows for files (blobs) to be embedded into COB entries.
This allows for things like image attachments in issue comments for example.

For now, we only enable this in the `issue` COB.

The way it works is that relevant COB actions carry metadata about which
files are attached to them; and we store those files as blobs inside the
COB entry's *tree* object, under an `embeds/` folder.

The `Embed<T>` type is used for the above, and either carries actual
content, or carries a content-id. Retrieving the actual content is as
simple as asking the repository for a blob with that content-id.

As a possible future extension, MIME types could be stored alongside the
files in a "metadata" file. This could help clients display the content
appropriately.
2023-08-22 14:29:23 +02:00
cloudhead a922ecf3ce
cli: New `cob` command for debugging
Implement a `rad cob show` command for debugging COBs.
Prints out the full history without decoding the ops.
2023-08-18 10:54:27 +02:00
cloudhead b456d3a401
Prepare crates for publishing to `crates.io` 2023-08-07 11:31:11 +02:00
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
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
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
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