mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-18 19:10:30 +08:00
cli/id: Introduce rad id cache
Similar to `rad [issue|patch] cache`, this will re-compute cached state about the identity document. The identity COB does not cache to SQLite, but there is `refs/rad/id`, which can become stale.
This commit is contained in:
@@ -68,6 +68,14 @@ We will note that we found an inconsistency where the concurrent operations
|
||||
which is ordered first. Further analysis of the ordering of pairs of actions is
|
||||
required, but is left to future work.
|
||||
|
||||
We scanned the network for cases where these changes in evaluation also lead
|
||||
to changes in the identity document. There are some cases, but this happens
|
||||
rarely: Out of several thousand repositories, only around fifteen showed
|
||||
differences.
|
||||
|
||||
In case your repository is affected, you might need to run `rad id cache`. This
|
||||
re-evaluates the identity COB and updates the `refs/rad/id` reference.
|
||||
|
||||
## Improvements
|
||||
|
||||
- `rad patch list` includes a `Labels` column, showing any assigned labels to
|
||||
|
||||
@@ -9,7 +9,7 @@ use radicle::cob::identity::{self, IdentityMut, Revision, RevisionId};
|
||||
use radicle::identity::doc::update;
|
||||
use radicle::identity::{Doc, Identity, RawDoc, doc};
|
||||
use radicle::node::NodeId;
|
||||
use radicle::storage::{ReadStorage as _, WriteRepository};
|
||||
use radicle::storage::{ReadRepository as _, ReadStorage as _, WriteRepository};
|
||||
use radicle::{Profile, cob, crypto};
|
||||
use radicle_surf::diff::Diff;
|
||||
use radicle_term::Element;
|
||||
@@ -303,6 +303,19 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||
|
||||
print(revision, previous, &repo, &profile)?;
|
||||
}
|
||||
Command::Cache { storage: false } => {
|
||||
set_identity_head(&repo)?;
|
||||
}
|
||||
Command::Cache { storage: true } => {
|
||||
for info in profile.storage.repositories()? {
|
||||
if let Err(err) = set_identity_head(&profile.storage.repository(info.rid)?) {
|
||||
term::error(format!(
|
||||
"Failed to cache identity for repository {}: {err}",
|
||||
info.rid
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -514,6 +527,12 @@ fn update(
|
||||
}
|
||||
}
|
||||
|
||||
fn set_identity_head(repo: &radicle::storage::git::Repository) -> anyhow::Result<()> {
|
||||
repo.set_identity_head()?;
|
||||
term::success!("Successfully cached identity of repository {}", repo.id());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn on_identity_err(e: identity::Error, profile: &Profile) -> anyhow::Error {
|
||||
let e = anyhow::Error::from(e);
|
||||
|
||||
|
||||
@@ -241,6 +241,12 @@ pub(super) enum Command {
|
||||
#[arg(value_name = "REVISION_ID")]
|
||||
revision: Rev,
|
||||
},
|
||||
|
||||
/// Re-cache the identity
|
||||
Cache {
|
||||
#[arg(long)]
|
||||
storage: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user