Files
heartwood/radicle-cli/examples/rad-patch-update.md
T
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

4.1 KiB

Let's explore the rad patch update plumbing command. First we create a patch:

$ git checkout -q -b feature/1
$ git commit -q -m "Not a real change" --allow-empty
$ git push rad HEAD:refs/patches
✓ Patch 2541d346ba0b9377b3d38852dfded43f23833fc1 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 * [new reference]   HEAD -> refs/patches
$ rad patch show 2541d346ba0b9377b3d38852dfded43f23833fc1
╭────────────────────────────────────────────────────╮
│ Title     Not a real change                        │
│ Patch     2541d346ba0b9377b3d38852dfded43f23833fc1 │
│ Author    z6MknSL…StBU8Vi (you)                    │
│ Head      51b2f0f77b9849bfaa3e9d3ff68ee2f57771d20c │
│ Branches  feature/1                                │
│ Commits   ahead 1, behind 0                        │
│ Status    open                                     │
├────────────────────────────────────────────────────┤
│ 51b2f0f Not a real change                          │
├────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) [      ...     ] │
╰────────────────────────────────────────────────────╯

We can make some changes to the repository:

$ git mv README README.md
$ git commit -q -m "Rename readme file"

Let's push the changes, but not to the magic ref, that way the push doesn't update our patch:

$ git push rad HEAD:refs/heads/feature/1

Now, instead of using git push to update the patch, as we normally would, we run:

$ rad patch update 2541d346ba0b9377b3d38852dfded43f23833fc1 -m "Updated patch"
d9c9ef902f2957d746bb53e744e69a5c3aa564bc

The command outputs the new Revision ID, which we can now see here:

$ rad patch show 2541d346ba0b9377b3d38852dfded43f23833fc1
╭──────────────────────────────────────────────────────────────────────────────╮
│ Title     Not a real change                                                  │
│ Patch     2541d346ba0b9377b3d38852dfded43f23833fc1                           │
│ Author    z6MknSL…StBU8Vi (you)                                              │
│ Head      4d272148458a17620541555b1f0905c01658aa9f                           │
│ Branches  feature/1                                                          │
│ Commits   ahead 2, behind 0                                                  │
│ Status    open                                                               │
├──────────────────────────────────────────────────────────────────────────────┤
│ 4d27214 Rename readme file                                                   │
│ 51b2f0f Not a real change                                                    │
├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) [     ...     ]                            │
│ ↑ updated to d9c9ef902f2957d746bb53e744e69a5c3aa564bc (4d27214) [    ...   ] │
╰──────────────────────────────────────────────────────────────────────────────╯