radicle-heartwood-lfs/crates/radicle-cli/examples
Lorenz Leutgeb 119a124897 radicle: the great Canonical rewrite
This change was inspired by the a story as old as time:

    𝕃𝕖𝕥 𝕦𝕤 𝕞𝕚𝕩 𝕠𝕦𝕣 𝕓𝕦𝕤𝕚𝕟𝕖𝕤𝕤 𝕝𝕠𝕘𝕚𝕔 𝕨𝕚𝕥𝕙 𝕠𝕦𝕣 𝕀𝕆!

It was motivated by the fact that the canonical quorum logic was spread across
two modules and also two different repositories (in the API sense). The
`radicle-remote-helper` contained special logic for computing the quorum, and
also relied on the logic with `radicle` itself. It would also mix using the
Radicle storage repository and the working copy repository – resulting in issues
where objects could exist in one and not the other.

The change begins by separating away the IO away from any of the business logic
in the `git::canonical` module. To follow along, there are two important submodules:

1. `voting` captures the different type of voting processes for commits and tags
  a. Tags are simple, where one `Oid` means one vote
  b. Commits are slightly more complicated. They begin with one `Oid` means one
     vote, but then it is expected that merge bases are calculated for pairs of
     commits. These merge bases are used to increase a vote for an `Oid` if it
     is the merge base of another commit.
2. `quorum` builds on top of `voting` and uses the voting processes as well as
    the `threshold` to find the quorum for the tag or commit reference.
  a. For tags, the first past the threshold wins, but if multiple pass then it
     is an error.
  b. For commits, the merge base process should be used to increase the votes,
     until the caller is ready to find the quorum. At this point, the commits
     that pass the `threshold` are then compared to find the commit that is the
     child-most commit of all other candidates. If they diverge, then an error
     is returned.

There is also a `convergence` module that captures the logic that is required
for the `radicle-remote-helper`. It essentially checks if a candidate object
matches the expected objects, tags or commits, and performs the necessary
convergence logic – checking that the candidate commit is converging with
at least of the other `Did`s.

These two quorum processes, and the convergence process, essentially act as
state machines and can be driven by the use of a Git repository for finding the
merge bases. This is where the `effects` module comes in. The `effects` capture
the necessary traits that are required to drive the state machines of the quorum
processes. It is expected that a Git repository implements these, and in fact, a
`git2::Repository` implementation is provided. The traits are useful, since it
means that a `git2::Repository` can be swapped out and the logic would stay the
same.

This all culminates into the new and improved `Canonical` and
`CanonicalWithConvergence`. Both of which have methods `find_quorum` for
performing the quorum process using a *single* provided repository.

This resulted in the semantic change of requiring that the
`radicle-remote-helper` pushes the candidate commit, irregardless of whether it
will be a fast-forward. For now, this is something that will be accepted while
the UX can be improved in the future by providing detailed warnings of the
divergence and ways to fix it. The benefit is that the tooling will never stop
someone from diverging if that is in fact what they want to do.
2025-08-25 18:57:50 +02:00
..
framework repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
git radicle: the great Canonical rewrite 2025-08-25 18:57:50 +02:00
workflow canonical: Support Annotated Tags 2025-08-04 17:00:54 +02:00
rad-auth-errors.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-auth.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-block.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-checkout-repo-config-linux.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-checkout-repo-config-macos.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-checkout.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-clean.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-clone-all.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-clone-connect.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-clone-directory.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-clone-partial-fail.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-clone-unknown.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-clone.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-cob-log.md cli: extend `rad cob log` behaviour 2025-08-19 15:01:26 +01:00
rad-cob-migrate.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-cob-multiset repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-cob-multiset.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-cob-operations.md cli: extend `rad cob log` behaviour 2025-08-19 15:01:26 +01:00
rad-cob-show.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-cob-update-identity.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-cob-update.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-config.md radicle: Keep pinned repos ordered in config 2025-07-19 12:59:02 +01:00
rad-diff.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-fetch.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-fork.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-id-collaboration.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-id-conflict.md cli: Add verbose printing of authors 2025-08-14 16:15:19 +01:00
rad-id-multi-delegate.md cli: Add verbose printing of authors 2025-08-14 16:15:19 +01:00
rad-id-private.md cli: extract document update logic 2025-07-16 16:41:16 +02:00
rad-id-threshold-soft-fork.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-id-threshold.md canonical: Support Annotated Tags 2025-08-04 17:00:54 +02:00
rad-id-unknown-field.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-id-update-delete-field.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-id.md cli: extend `rad cob log` behaviour 2025-08-19 15:01:26 +01:00
rad-inbox.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-detached-head.md cli: improve default branch pick 2025-07-23 07:43:27 +01:00
rad-init-existing.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-no-git.md cli: improve default branch pick 2025-07-23 07:43:27 +01:00
rad-init-no-seed.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-private-clone-seed.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-init-private-clone.md radicle-fetch: More fine-grained errors 2025-08-22 14:56:03 +02:00
rad-init-private-no-seed.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-private-seed.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-init-private.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-sync-not-connected.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-sync-preferred.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-sync-timeout.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-sync.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init-with-existing-remote.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-init.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-inspect-noauth.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-inspect.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-issue.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-merge-after-update.md canonical: Support Annotated Tags 2025-08-04 17:00:54 +02:00
rad-merge-no-ff.md canonical: Support Annotated Tags 2025-08-04 17:00:54 +02:00
rad-merge-via-push.md term, cli, remote-helper: Status Symbols 2025-08-13 13:45:21 +01:00
rad-node.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-patch-ahead-behind.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-change-base.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-checkout-force.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-patch-checkout-revision.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-checkout.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-delete.md cli: Add verbose printing of authors 2025-08-14 16:15:19 +01:00
rad-patch-detached-head.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-diff.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-draft.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-edit.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-fetch-1.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-fetch-2.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-merge-draft.md canonical: Support Annotated Tags 2025-08-04 17:00:54 +02:00
rad-patch-open-explore.md canonical: Support Annotated Tags 2025-08-04 17:00:54 +02:00
rad-patch-pull-update.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-patch-revert-merge.md canonical: Support Annotated Tags 2025-08-04 17:00:54 +02:00
rad-patch-update.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch-via-push.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-patch.md term, cli, remote-helper: Status Symbols 2025-08-13 13:45:21 +01:00
rad-publish.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-push-and-pull-patches.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-remote.md cli: Improve formatting of Node IDs and addresses 2025-07-18 21:44:06 +01:00
rad-review-by-hunk.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-seed-and-follow.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-seed-many.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-self.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-sync-without-node.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-sync.md cli/sync/status: Refactor output table 2025-08-13 13:45:22 +01:00
rad-unseed-many.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-unseed.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
rad-warn-old-nodes.md radicle-cli: Warn when using old names of nodes 2025-06-18 16:21:21 +02:00
rad-watch.md repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00